[dpdk-dev,5/9] bus: introduce attach/detach functionality
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 | 3 +++
lib/librte_eal/common/include/rte_bus.h | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
@@ -52,6 +52,9 @@ rte_bus_register(struct rte_bus *bus)
RTE_VERIFY(bus->probe);
RTE_VERIFY(bus->find_device);
+ /* Buses supporting attach also require detach */
+ RTE_VERIFY(!bus->attach || bus->detach);
+
TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
}
@@ -89,6 +89,20 @@ typedef struct rte_device * (*rte_bus_find_device_t)(
const void *data);
/**
+ * Implementation specific probe function which is responsible for linking
+ * devices on that bus with applicable drivers.
+ *
+ */
+typedef int (*rte_bus_attach_t)(struct rte_device *dev);
+
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from assigned driver.
+ *
+ */
+typedef int (*rte_bus_detach_t)(struct rte_device *dev);
+
+/**
* A structure describing a generic bus.
*/
struct rte_bus {
@@ -97,6 +111,8 @@ struct rte_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 */
+ rte_bus_attach_t attach; /**< Probe single device for drivers */
+ rte_bus_detach_t detach; /**< Remove single device from driver */
};
/**