#define VDEV_MP_KEY "bus_vdev_mp"
-int vdev_logtype_bus;
-
/* Forward declare to access virtual bus name */
static struct rte_bus rte_vdev_bus;
struct rte_vdev_driver *driver;
int ret;
+ if (rte_dev_is_probed(&dev->device))
+ return -EEXIST;
+
name = rte_vdev_device_name(dev);
VDEV_LOG(DEBUG, "Search driver to probe device %s", name);
else
devargs->args = strdup("");
- ret = snprintf(devargs->name, sizeof(devargs->name), "%s", name);
+ ret = strlcpy(devargs->name, name, sizeof(devargs->name));
if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
free(devargs->args);
free(devargs);
if (rte_mp_action_register(VDEV_MP_KEY, vdev_action) < 0 &&
rte_errno != EEXIST) {
+ /* for primary, unsupported IPC is not an error */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY &&
+ rte_errno == ENOTSUP)
+ goto scan;
VDEV_LOG(ERR, "Failed to add vdev mp action");
return -1;
}
/* Fall through to allow private vdevs in secondary process */
}
+scan:
/* call custom scan callbacks if any */
rte_spinlock_lock(&vdev_custom_scan_lock);
TAILQ_FOREACH(custom_scan, &vdev_custom_scans, next) {
vdev_probe(void)
{
struct rte_vdev_device *dev;
- int ret = 0;
+ int r, ret = 0;
/* call the init function for each virtual device */
TAILQ_FOREACH(dev, &vdev_device_list, next) {
* we call each driver probe.
*/
- if (rte_dev_is_probed(&dev->device))
- continue;
-
- if (vdev_probe_all_drivers(dev)) {
+ r = vdev_probe_all_drivers(dev);
+ if (r != 0) {
+ if (r == -EEXIST)
+ continue;
VDEV_LOG(ERR, "failed to initialize %s device",
rte_vdev_device_name(dev));
ret = -1;
};
RTE_REGISTER_BUS(vdev, rte_vdev_bus);
-
-RTE_INIT(vdev_init_log)
-{
- vdev_logtype_bus = rte_log_register("bus.vdev");
- if (vdev_logtype_bus >= 0)
- rte_log_set_level(vdev_logtype_bus, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(vdev_logtype_bus, bus.vdev, NOTICE);