From patchwork Fri Sep 28 11:23:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolong Ye X-Patchwork-Id: 45557 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8143E1B158; Fri, 28 Sep 2018 06:36:33 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id B13DF1B142 for ; Fri, 28 Sep 2018 06:36:29 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2018 21:36:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,313,1534834800"; d="scan'208";a="76766780" Received: from yexl-server.sh.intel.com ([10.67.110.207]) by orsmga007.jf.intel.com with ESMTP; 27 Sep 2018 21:35:51 -0700 From: Xiaolong Ye To: dev@dpdk.org, Maxime Coquelin , Tiwei Bie , Zhihong Wang Cc: xiao.w.wang@intel.com, Rami Rosen , Wang Haiyue , Xiaolong Ye Date: Fri, 28 Sep 2018 19:23:43 +0800 Message-Id: <20180928112344.42791-2-xiaolong.ye@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180928112344.42791-1-xiaolong.ye@intel.com> References: <20180926090638.4705-1-xiaolong.ye@intel.com> <20180928112344.42791-1-xiaolong.ye@intel.com> Subject: [dpdk-dev] [PATCH v7 1/2] vhost: introduce API to get vDPA device number X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" It's used to get number of available registered vDPA devices. Reviewed-by: Maxime coquelin Acked-by: Xiao Wang Signed-off-by: Xiaolong Ye --- lib/librte_vhost/rte_vdpa.h | 3 +++ lib/librte_vhost/rte_vhost_version.map | 1 + lib/librte_vhost/vdpa.c | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h index 90465ca26..b8223e337 100644 --- a/lib/librte_vhost/rte_vdpa.h +++ b/lib/librte_vhost/rte_vdpa.h @@ -84,4 +84,7 @@ rte_vdpa_find_device_id(struct rte_vdpa_dev_addr *addr); struct rte_vdpa_device * __rte_experimental rte_vdpa_get_device(int did); +/* Get current available vdpa device number */ +int __rte_experimental +rte_vdpa_get_device_num(void); #endif /* _RTE_VDPA_H_ */ diff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map index da220dd02..ae39b6e21 100644 --- a/lib/librte_vhost/rte_vhost_version.map +++ b/lib/librte_vhost/rte_vhost_version.map @@ -67,6 +67,7 @@ EXPERIMENTAL { rte_vdpa_unregister_device; rte_vdpa_find_device_id; rte_vdpa_get_device; + rte_vdpa_get_device_num; rte_vhost_driver_attach_vdpa_device; rte_vhost_driver_detach_vdpa_device; rte_vhost_driver_get_vdpa_device_id; diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c index c82fd4370..c2c5dff1d 100644 --- a/lib/librte_vhost/vdpa.c +++ b/lib/librte_vhost/vdpa.c @@ -113,3 +113,9 @@ rte_vdpa_get_device(int did) return vdpa_devices[did]; } + +int +rte_vdpa_get_device_num(void) +{ + return vdpa_device_num; +}