From: Jan Blunck <jblu...@infradead.org>

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

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);
-- 
2.1.4

Reply via email to