[v3,1/2] bus/pci: add Mellanox kernel driver type
Checks
Commit Message
When checking RTE_PCI_DRV_IOVA_AS_VA flag to determine IOVA mode,
pci_one_device_has_iova_va() returns true only if kernel driver of the
device is vfio. However, Mellanox mlx4/5 PMD doesn't need to be detached
from kernel driver and attached to VFIO/UIO. Control path still goes
through the existing kernel driver, which is mlx4_core/mlx5_core. In order
to make RTE_PCI_DRV_IOVA_AS_VA effective for mlx4/mlx5 PMD, a new kernel
driver type has to be introduced.
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
v3:
* make commit log more explanatory
v2:
* add RTE_KDRV_NIC_MLX
drivers/bus/pci/linux/pci.c | 6 +++++-
lib/librte_eal/common/include/rte_dev.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
Comments
02/05/2019 11:07, Yongseok Koh:
> When checking RTE_PCI_DRV_IOVA_AS_VA flag to determine IOVA mode,
> pci_one_device_has_iova_va() returns true only if kernel driver of the
> device is vfio. However, Mellanox mlx4/5 PMD doesn't need to be detached
> from kernel driver and attached to VFIO/UIO. Control path still goes
> through the existing kernel driver, which is mlx4_core/mlx5_core. In order
> to make RTE_PCI_DRV_IOVA_AS_VA effective for mlx4/mlx5 PMD, a new kernel
> driver type has to be introduced.
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Applied, thanks
@@ -329,6 +329,9 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
dev->kdrv = RTE_KDRV_IGB_UIO;
else if (!strcmp(driver, "uio_pci_generic"))
dev->kdrv = RTE_KDRV_UIO_GENERIC;
+ else if (!strcmp(driver, "mlx4_core") ||
+ !strcmp(driver, "mlx5_core"))
+ dev->kdrv = RTE_KDRV_NIC_MLX;
else
dev->kdrv = RTE_KDRV_UNKNOWN;
} else
@@ -568,7 +571,8 @@ pci_one_device_has_iova_va(void)
FOREACH_DRIVER_ON_PCIBUS(drv) {
if (drv && drv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) {
FOREACH_DEVICE_ON_PCIBUS(dev) {
- if (dev->kdrv == RTE_KDRV_VFIO &&
+ if ((dev->kdrv == RTE_KDRV_VFIO ||
+ dev->kdrv == RTE_KDRV_NIC_MLX) &&
rte_pci_match(drv, dev))
return 1;
}
@@ -63,6 +63,7 @@ enum rte_kernel_driver {
RTE_KDRV_VFIO,
RTE_KDRV_UIO_GENERIC,
RTE_KDRV_NIC_UIO,
+ RTE_KDRV_NIC_MLX,
RTE_KDRV_NONE,
};