[dpdk-dev] [PATCH 5/9] bus: introduce attach/detach functionality
Gaetan Rivet
gaetan.rivet at 6wind.com
Wed May 24 17:04:57 CEST 2017
From: Jan Blunck <jblunck at infradead.org>
Signed-off-by: Jan Blunck <jblunck at 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(+)
diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index b8f8384..9fda287 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -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);
}
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index 3b22fb8..201b0ff 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -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 */
};
/**
--
2.1.4
More information about the dev
mailing list