From: Rosen Xu Date: Tue, 16 Apr 2019 03:17:39 +0000 (+0800) Subject: bus/ifpga: support AFU device search by name X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=dc384b50870680be1357261990087c56572180c3;p=dpdk.git bus/ifpga: support AFU device search by name In many scenarios, AFU is needed searched by name, this function add the feature. Signed-off-by: Rosen Xu Signed-off-by: Andy Pei --- diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 55d3abf9fe..dfd6b1fba9 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -73,6 +73,19 @@ ifpga_find_afu_dev(const struct rte_rawdev *rdev, 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 820eeaabe8..88a6289642 100644 --- a/drivers/bus/ifpga/rte_bus_ifpga.h +++ b/drivers/bus/ifpga/rte_bus_ifpga.h @@ -119,6 +119,15 @@ rte_ifpga_device_name(const struct rte_afu_device *afu) return NULL; } +/** + * 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. * diff --git a/drivers/bus/ifpga/rte_bus_ifpga_version.map b/drivers/bus/ifpga/rte_bus_ifpga_version.map index a027979796..964c9a9c45 100644 --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map @@ -8,3 +8,10 @@ DPDK_18.05 { local: *; }; + +DPDK_19.05 { + global: + + rte_ifpga_find_afu_by_name; + +} DPDK_18.05;