#include <rte_malloc.h>
#include <rte_log.h>
#include <rte_errno.h>
-#include <rte_bus_pci.h>
#include <rte_pci.h>
#include <rte_string_fns.h>
#include <mlx5_glue.h>
#include <mlx5_common.h>
+#include <mlx5_common_pci.h>
#include <mlx5_devx_cmds.h>
#include <mlx5_prm.h>
#include <mlx5_nl.h>
struct rte_vdpa_device *vdev = rte_vhost_get_vdpa_device(vid);
struct mlx5_vdpa_priv *priv =
mlx5_vdpa_find_priv_resource_by_vdev(vdev);
+ int ret;
if (priv == NULL) {
DRV_LOG(ERR, "Invalid vDPA device: %s.", vdev->device->name);
DRV_LOG(ERR, "Too big vring id: %d.", vring);
return -E2BIG;
}
- return mlx5_vdpa_virtq_enable(priv, vring, state);
+ pthread_mutex_lock(&priv->vq_config_lock);
+ ret = mlx5_vdpa_virtq_enable(priv, vring, state);
+ pthread_mutex_unlock(&priv->vq_config_lock);
+ return ret;
}
static int
}
/**
- * DPDK callback to register a PCI device.
+ * DPDK callback to register a mlx5 PCI device.
*
* This function spawns vdpa device out of a given PCI device.
*
struct mlx5_hca_attr attr;
int ret;
- if (mlx5_class_get(pci_dev->device.devargs) != MLX5_CLASS_VDPA) {
- DRV_LOG(DEBUG, "Skip probing - should be probed by other mlx5"
- " driver.");
- return 1;
- }
ibv = mlx5_vdpa_get_ib_device_match(&pci_dev->addr);
if (!ibv) {
DRV_LOG(ERR, "No matching IB device for PCI slot "
}
mlx5_vdpa_config_get(pci_dev->device.devargs, priv);
SLIST_INIT(&priv->mr_list);
+ pthread_mutex_init(&priv->vq_config_lock, NULL);
pthread_mutex_lock(&priv_list_lock);
TAILQ_INSERT_TAIL(&priv_list, priv, next);
pthread_mutex_unlock(&priv_list_lock);
priv->var = NULL;
}
mlx5_glue->close_device(priv->ctx);
+ pthread_mutex_destroy(&priv->vq_config_lock);
rte_free(priv);
}
return 0;
}
};
-static struct rte_pci_driver mlx5_vdpa_driver = {
- .driver = {
- .name = "mlx5_vdpa",
+static struct mlx5_pci_driver mlx5_vdpa_driver = {
+ .driver_class = MLX5_CLASS_VDPA,
+ .pci_driver = {
+ .driver = {
+ .name = "mlx5_vdpa",
+ },
+ .id_table = mlx5_vdpa_pci_id_map,
+ .probe = mlx5_vdpa_pci_probe,
+ .remove = mlx5_vdpa_pci_remove,
+ .drv_flags = 0,
},
- .id_table = mlx5_vdpa_pci_id_map,
- .probe = mlx5_vdpa_pci_probe,
- .remove = mlx5_vdpa_pci_remove,
- .drv_flags = 0,
};
RTE_LOG_REGISTER(mlx5_vdpa_logtype, pmd.vdpa.mlx5, NOTICE)
{
mlx5_common_init();
if (mlx5_glue)
- rte_pci_register(&mlx5_vdpa_driver);
+ mlx5_pci_driver_register(&mlx5_vdpa_driver);
}
RTE_PMD_EXPORT_NAME(net_mlx5_vdpa, __COUNTER__);