From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E5D554C99 for ; Tue, 2 Apr 2019 15:56:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Apr 2019 06:56:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,300,1549958400"; d="scan'208";a="132302670" Received: from dpdkx8602.sh.intel.com ([10.67.110.200]) by orsmga006.jf.intel.com with ESMTP; 02 Apr 2019 06:56:13 -0700 From: "Xu, Rosen" To: dev@dpdk.org Cc: ferruh.yigit@intel.com, tianfei.zhang@intel.com, dan.wei@intel.com, rosen.xu@intel.com, andy.pei@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com, santos.chen@intel.com, zhang.zhang@intel.com Date: Tue, 2 Apr 2019 21:57:02 +0800 Message-Id: <1554213434-60684-3-git-send-email-rosen.xu@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1554213434-60684-1-git-send-email-rosen.xu@intel.com> References: <1551338000-120348-1-git-send-email-rosen.xu@intel.com> <1554213434-60684-1-git-send-email-rosen.xu@intel.com> Subject: [dpdk-dev] [PATCH v3 02/14] drivers/bus/ifpga: add function for AFU search by name 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: , X-List-Received-Date: Tue, 02 Apr 2019 13:56:16 -0000 From: Rosen Xu In many scenarios, AFU is needed searched by name, this function add the feature. Signed-off-by: Rosen Xu Signed-off-by: Andy Pei --- drivers/bus/ifpga/ifpga_bus.c | 13 +++++++++++++ drivers/bus/ifpga/rte_bus_ifpga.h | 9 +++++++++ drivers/bus/ifpga/rte_bus_ifpga_version.map | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 55d3abf..dfd6b1f 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) return NULL; } +struct rte_afu_device * +rte_ifpga_find_afu_by_name(const char *name) +{ + struct rte_afu_device *afu_dev = NULL; + + TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) { + if (afu_dev && + !strcmp(afu_dev->device.name, name)) + return afu_dev; + } + return NULL; +} + static const char * const valid_args[] = { #define IFPGA_ARG_NAME "ifpga" IFPGA_ARG_NAME, diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/rte_bus_ifpga.h index 820eeaa..88a6289 100644 --- a/drivers/bus/ifpga/rte_bus_ifpga.h +++ b/drivers/bus/ifpga/rte_bus_ifpga.h @@ -120,6 +120,15 @@ struct rte_afu_driver { } /** + * Find AFU by AFU name. + * + * @param name + * A pointer to AFU name string. + */ +struct rte_afu_device * +rte_ifpga_find_afu_by_name(const char *name); + +/** * Register a ifpga afu device driver. * * @param driver diff --git a/drivers/bus/ifpga/rte_bus_ifpga_version.map b/drivers/bus/ifpga/rte_bus_ifpga_version.map index a027979..8f9b781 100644 --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map @@ -1,6 +1,7 @@ -DPDK_18.05 { +DPDK_19.05 { global: + rte_ifpga_find_afu_by_name; rte_ifpga_get_integer32_arg; rte_ifpga_get_string_arg; rte_ifpga_driver_register; -- 1.8.3.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6EAEEA0679 for ; Tue, 2 Apr 2019 15:56:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E5AC4C9C; Tue, 2 Apr 2019 15:56:17 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E5D554C99 for ; Tue, 2 Apr 2019 15:56:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Apr 2019 06:56:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,300,1549958400"; d="scan'208";a="132302670" Received: from dpdkx8602.sh.intel.com ([10.67.110.200]) by orsmga006.jf.intel.com with ESMTP; 02 Apr 2019 06:56:13 -0700 From: "Xu, Rosen" To: dev@dpdk.org Cc: ferruh.yigit@intel.com, tianfei.zhang@intel.com, dan.wei@intel.com, rosen.xu@intel.com, andy.pei@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com, santos.chen@intel.com, zhang.zhang@intel.com Date: Tue, 2 Apr 2019 21:57:02 +0800 Message-Id: <1554213434-60684-3-git-send-email-rosen.xu@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1554213434-60684-1-git-send-email-rosen.xu@intel.com> References: <1551338000-120348-1-git-send-email-rosen.xu@intel.com> <1554213434-60684-1-git-send-email-rosen.xu@intel.com> Subject: [dpdk-dev] [PATCH v3 02/14] drivers/bus/ifpga: add function for AFU search by name 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190402135702.vlWV87JUuJ4-KO3P-OkaMbtJISQX0TY2MF8TqNAGbSw@z> From: Rosen Xu In many scenarios, AFU is needed searched by name, this function add the feature. Signed-off-by: Rosen Xu Signed-off-by: Andy Pei --- drivers/bus/ifpga/ifpga_bus.c | 13 +++++++++++++ drivers/bus/ifpga/rte_bus_ifpga.h | 9 +++++++++ drivers/bus/ifpga/rte_bus_ifpga_version.map | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 55d3abf..dfd6b1f 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) return NULL; } +struct rte_afu_device * +rte_ifpga_find_afu_by_name(const char *name) +{ + struct rte_afu_device *afu_dev = NULL; + + TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) { + if (afu_dev && + !strcmp(afu_dev->device.name, name)) + return afu_dev; + } + return NULL; +} + static const char * const valid_args[] = { #define IFPGA_ARG_NAME "ifpga" IFPGA_ARG_NAME, diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/rte_bus_ifpga.h index 820eeaa..88a6289 100644 --- a/drivers/bus/ifpga/rte_bus_ifpga.h +++ b/drivers/bus/ifpga/rte_bus_ifpga.h @@ -120,6 +120,15 @@ struct rte_afu_driver { } /** + * Find AFU by AFU name. + * + * @param name + * A pointer to AFU name string. + */ +struct rte_afu_device * +rte_ifpga_find_afu_by_name(const char *name); + +/** * Register a ifpga afu device driver. * * @param driver diff --git a/drivers/bus/ifpga/rte_bus_ifpga_version.map b/drivers/bus/ifpga/rte_bus_ifpga_version.map index a027979..8f9b781 100644 --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map @@ -1,6 +1,7 @@ -DPDK_18.05 { +DPDK_19.05 { global: + rte_ifpga_find_afu_by_name; rte_ifpga_get_integer32_arg; rte_ifpga_get_string_arg; rte_ifpga_driver_register; -- 1.8.3.1