bus/vdev: do not reference devargs list
authorGaetan Rivet <gaetan.rivet@6wind.com>
Mon, 23 Apr 2018 23:54:44 +0000 (01:54 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 25 Apr 2018 01:58:03 +0000 (03:58 +0200)
This list should not be operated upon by drivers.
Use the public API to achieve the same functionalities.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
drivers/bus/vdev/vdev.c

index 38ed70a..45ef058 100644 (file)
@@ -229,7 +229,7 @@ insert_vdev(const char *name, const char *args, struct rte_vdev_device **p_dev)
        }
 
        TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
-       TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
+       rte_eal_devargs_insert(devargs);
 
        if (p_dev)
                *p_dev = dev;
@@ -259,9 +259,7 @@ rte_vdev_init(const char *name, const char *args)
                        /* If fails, remove it from vdev list */
                        devargs = dev->device.devargs;
                        TAILQ_REMOVE(&vdev_device_list, dev, next);
-                       TAILQ_REMOVE(&devargs_list, devargs, next);
-                       free(devargs->args);
-                       free(devargs);
+                       rte_eal_devargs_remove(devargs->bus->name, devargs->name);
                        free(dev);
                }
        }
@@ -309,9 +307,7 @@ rte_vdev_uninit(const char *name)
 
        TAILQ_REMOVE(&vdev_device_list, dev, next);
        devargs = dev->device.devargs;
-       TAILQ_REMOVE(&devargs_list, devargs, next);
-       free(devargs->args);
-       free(devargs);
+       rte_eal_devargs_remove(devargs->bus->name, devargs->name);
        free(dev);
 
 unlock:
@@ -443,10 +439,7 @@ vdev_scan(void)
        rte_spinlock_unlock(&vdev_custom_scan_lock);
 
        /* for virtual devices we scan the devargs_list populated via cmdline */
-       TAILQ_FOREACH(devargs, &devargs_list, next) {
-
-               if (devargs->bus != &rte_vdev_bus)
-                       continue;
+       RTE_EAL_DEVARGS_FOREACH("vdev", devargs) {
 
                dev = calloc(1, sizeof(*dev));
                if (!dev)