/* Head of devices. */
static TAILQ_HEAD(mlx5_devices, mlx5_common_device) devices_list =
TAILQ_HEAD_INITIALIZER(devices_list);
+static pthread_mutex_t devices_list_lock;
static const struct {
const char *name;
static void
dev_release(struct mlx5_common_device *dev)
{
+ pthread_mutex_lock(&devices_list_lock);
TAILQ_REMOVE(&devices_list, dev, next);
+ pthread_mutex_unlock(&devices_list_lock);
rte_free(dev);
}
if (!dev)
return -ENOMEM;
dev->dev = eal_dev;
+ pthread_mutex_lock(&devices_list_lock);
TAILQ_INSERT_HEAD(&devices_list, dev, next);
+ pthread_mutex_unlock(&devices_list_lock);
new_device = true;
}
/*
if (mlx5_common_initialized)
return;
+ pthread_mutex_init(&devices_list_lock, NULL);
mlx5_glue_constructor();
mlx5_common_driver_init();
mlx5_common_initialized = true;