[v2,1/2] bus/pci: add Mellanox kernel driver type

Message ID 20190502074357.32031-1-yskoh@mellanox.com (mailing list archive)
State Superseded, archived
Headers
Series [v2,1/2] bus/pci: add Mellanox kernel driver type |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Yongseok Koh May 2, 2019, 7:43 a.m. UTC
  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
drivers, which is mlx4_core/mlx5_core.

Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---

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

Thomas Monjalon May 2, 2019, 8:10 a.m. UTC | #1
02/05/2019 09:43, Yongseok Koh:
> 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
> drivers, which is mlx4_core/mlx5_core.

The real change here is to handle RTE_PCI_DRV_IOVA_AS_VA
with Mellanox kernel drivers.
It think it should be explained in the commit log,
because there is no other reason for not using RTE_KDRV_UNKNOWN.

> @@ -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;
>  			}
  

Patch

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index c99d523f0a..b931cf9d10 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -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;
 			}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 56dd52ad9e..a17023d88b 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -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,
 };