[dpdk-dev,2/9] bus: add device iterator
Checks
Commit Message
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
lib/librte_eal/common/eal_common_bus.c | 1 +
lib/librte_eal/common/include/rte_bus.h | 8 ++++++++
2 files changed, 9 insertions(+)
@@ -50,6 +50,7 @@ rte_bus_register(struct rte_bus *bus)
/* A bus should mandatorily have the scan implemented */
RTE_VERIFY(bus->scan);
RTE_VERIFY(bus->probe);
+ RTE_VERIFY(bus->find_device);
TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
@@ -82,6 +82,13 @@ 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)(
+ int (*match)(const struct rte_device *dev, const void *data),
+ const void *data);
+
+/**
* A structure describing a generic bus.
*/
struct rte_bus {
@@ -89,6 +96,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 */
};
/**