bus/ifpga: support AFU device search by name
authorRosen Xu <rosen.xu@intel.com>
Tue, 16 Apr 2019 03:17:39 +0000 (11:17 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 19 Apr 2019 12:51:54 +0000 (14:51 +0200)
In many scenarios, AFU is needed searched by name, this
function add the feature.

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Signed-off-by: Andy Pei <andy.pei@intel.com>
drivers/bus/ifpga/ifpga_bus.c
drivers/bus/ifpga/rte_bus_ifpga.h
drivers/bus/ifpga/rte_bus_ifpga_version.map

index 55d3abf..dfd6b1f 100644 (file)
@@ -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,
index 820eeaa..88a6289 100644 (file)
@@ -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.
  *
index a027979..964c9a9 100644 (file)
@@ -8,3 +8,10 @@ DPDK_18.05 {
 
        local: *;
 };
+
+DPDK_19.05 {
+       global:
+
+       rte_ifpga_find_afu_by_name;
+
+} DPDK_18.05;