static struct vdev_device_list vdev_device_list =
TAILQ_HEAD_INITIALIZER(vdev_device_list);
-static rte_spinlock_t vdev_device_list_lock = RTE_SPINLOCK_INITIALIZER;
+/* The lock needs to be recursive because a vdev can manage another vdev. */
+static rte_spinlock_recursive_t vdev_device_list_lock =
+ RTE_SPINLOCK_RECURSIVE_INITIALIZER;
struct vdev_driver_list vdev_driver_list =
TAILQ_HEAD_INITIALIZER(vdev_driver_list);
struct rte_devargs *devargs;
int ret;
- rte_spinlock_lock(&vdev_device_list_lock);
+ rte_spinlock_recursive_lock(&vdev_device_list_lock);
ret = insert_vdev(name, args, &dev);
if (ret == 0) {
ret = vdev_probe_all_drivers(dev);
free(dev);
}
}
- rte_spinlock_unlock(&vdev_device_list_lock);
+ rte_spinlock_recursive_unlock(&vdev_device_list_lock);
return ret;
}
if (name == NULL)
return -EINVAL;
- rte_spinlock_lock(&vdev_device_list_lock);
+ rte_spinlock_recursive_lock(&vdev_device_list_lock);
dev = find_vdev(name);
if (!dev) {
free(dev);
unlock:
- rte_spinlock_unlock(&vdev_device_list_lock);
+ rte_spinlock_recursive_unlock(&vdev_device_list_lock);
return ret;
}
ou->num = 1;
num = 0;
- rte_spinlock_lock(&vdev_device_list_lock);
+ rte_spinlock_recursive_lock(&vdev_device_list_lock);
TAILQ_FOREACH(dev, &vdev_device_list, next) {
devname = rte_vdev_device_name(dev);
if (strlen(devname) == 0) {
devname, strerror(rte_errno));
num++;
}
- rte_spinlock_unlock(&vdev_device_list_lock);
+ rte_spinlock_recursive_unlock(&vdev_device_list_lock);
ou->type = VDEV_SCAN_REP;
ou->num = num;
if (!dev)
return -1;
- rte_spinlock_lock(&vdev_device_list_lock);
+ rte_spinlock_recursive_lock(&vdev_device_list_lock);
if (find_vdev(devargs->name)) {
- rte_spinlock_unlock(&vdev_device_list_lock);
+ rte_spinlock_recursive_unlock(&vdev_device_list_lock);
free(dev);
continue;
}
TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
- rte_spinlock_unlock(&vdev_device_list_lock);
+ rte_spinlock_recursive_unlock(&vdev_device_list_lock);
}
return 0;
const struct rte_vdev_device *vstart;
struct rte_vdev_device *dev;
- rte_spinlock_lock(&vdev_device_list_lock);
+ rte_spinlock_recursive_lock(&vdev_device_list_lock);
if (start != NULL) {
vstart = RTE_DEV_TO_VDEV_CONST(start);
dev = TAILQ_NEXT(vstart, next);
break;
dev = TAILQ_NEXT(dev, next);
}
- rte_spinlock_unlock(&vdev_device_list_lock);
+ rte_spinlock_recursive_unlock(&vdev_device_list_lock);
return dev ? &dev->device : NULL;
}