[dpdk-dev] [PATCH v2 02/11] bus: add device iterator
Gaetan Rivet
gaetan.rivet at 6wind.com
Wed May 31 15:17:47 CEST 2017
From: Jan Blunck <jblunck at infradead.org>
Signed-off-by: Jan Blunck <jblunck at infradead.org>
Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
---
lib/librte_eal/common/include/rte_bus.h | 7 +++++++
lib/librte_eal/common/include/rte_dev.h | 15 +++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index 006feca..4545b03 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -82,6 +82,12 @@ typedef int (*rte_bus_scan_t)(void);
typedef int (*rte_bus_probe_t)(void);
/**
+ * Device iterator to find a particular device on a bus.
+ */
+typedef struct rte_device * (*rte_bus_find_device_t)(rte_dev_match_t match,
+ const void *data);
+
+/**
* A structure describing a generic bus.
*/
struct rte_bus {
@@ -89,6 +95,7 @@ struct rte_bus {
const char *name; /**< Name of the bus */
rte_bus_scan_t scan; /**< Scan for devices attached to bus */
rte_bus_probe_t probe; /**< Probe devices on bus */
+ rte_bus_find_device_t find_device; /**< Find device on bus */
};
/**
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index de20c06..f017814 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -191,6 +191,21 @@ int rte_eal_dev_attach(const char *name, const char *devargs);
*/
int rte_eal_dev_detach(const char *name);
+/**
+ * Device match function.
+ *
+ * @param dev
+ * Device handle.
+ *
+ * @param data
+ * Data to match against.
+ *
+ * @return
+ * 0 if the device does not match.
+ * !0 otherwise.
+ */
+typedef int (*rte_dev_match_t)(const struct rte_device *dev, const void *data);
+
#define RTE_PMD_EXPORT_NAME_ARRAY(n, idx) n##idx[]
#define RTE_PMD_EXPORT_NAME(name, idx) \
--
2.1.4
More information about the dev
mailing list