[dpdk-dev,7/9] vdev: implement detach bus operation

Message ID 8293351024c3cbca680cca46f3dfe68c76697387.1495637723.git.gaetan.rivet@6wind.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Gaëtan Rivet May 24, 2017, 3:04 p.m. UTC
  From: Jan Blunck <jblunck@infradead.org>

Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 lib/librte_eal/common/eal_common_vdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 5fc516f..2095b01 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -352,10 +352,22 @@  vdev_find_device(int (*match)(const struct rte_device *dev, const void *data),
 	return NULL;
 }
 
+static int
+vdev_detach(struct rte_device *dev)
+{
+	/*
+	 * The virtual bus doesn't support 'unattached' devices so this is
+	 * actually equal to hotplugging removal of it.
+	 */
+	return rte_vdev_uninit(dev->name);
+}
+
 static struct rte_bus rte_vdev_bus = {
 	.scan = vdev_scan,
 	.probe = vdev_probe,
 	.find_device = vdev_find_device,
+	/* .attach = NULL, see comment on vdev_detach */
+	.detach = vdev_detach,
 };
 
 RTE_INIT(rte_vdev_bus_register);