This method must be implemented to allow using a unified, generic API to
hotplug devices, including virtual ones.
VDEV devices actually exist unattached after performing a scan on the
rte_devargs list. As such it makes sense to be able to perform a device
hotplug afterward.
Finally, missing this generic interface forces the EAL to be dependent
on vdev-specific API, which hinders the plan of moving the vdev bus to
drivers/bus.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
return NULL;
}
+static int
+vdev_plug(struct rte_device *dev, const char *args __rte_unused)
+{
+ return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
+}
+
static int
vdev_unplug(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);
}
.scan = vdev_scan,
.probe = vdev_probe,
.find_device = vdev_find_device,
- /* .plug = NULL, see comment on vdev_unplug */
+ .plug = vdev_plug,
.unplug = vdev_unplug,
.parse = vdev_parse,
};
struct rte_device device; /**< Inherit core device */
};
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+ container_of(ptr, struct rte_vdev_device, device)
+
static inline const char *
rte_vdev_device_name(const struct rte_vdev_device *dev)
{