[v7,02/14] bus/ifpga: add function for AFU search by name
Checks
Commit Message
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 | 13 +++++++++++++
drivers/bus/ifpga/rte_bus_ifpga.h | 9 +++++++++
drivers/bus/ifpga/rte_bus_ifpga_version.map | 6 ++++++
3 files changed, 28 insertions(+)
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
return NULL;
}
+struct rte_afu_device *__rte_experimental
+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,
@@ -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_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+
+/**
* Register a ifpga afu device driver.
*
* @param driver
@@ -8,3 +8,9 @@ DPDK_18.05 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file