Skip to contentSkip to conversation

bus/pci: fix Windows kernel driver categories

PATCH Superseded Thomas Monjalon 5 participants 12 messages Mar 16, 2021 – Mar 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus/pci: fix Windows kernel driver categories

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN (mlx case),
and RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used
instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO.

While adding the new value RTE_PCI_KDRV_NET_UIO, the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
---
 drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
 drivers/bus/pci/windows/pci.c | 14 +++++++-------
 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/bus/pci/rte_bus_pci.h +7 -6
index fdda046515..3d009cc74b 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 struct rte_devargs;
 
 enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* not listed - may be a bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* error */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
 };
 
 /**
drivers/bus/pci/windows/pci.c +7 -7
index 8f906097f4..3f0ce1fb83 100644
@@ -38,7 +38,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 	 * Devices that are bound to netuio are mapped at
 	 * the bus probing stage.
 	 */
-	if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_NET_UIO)
 		return 0;
 	else
 		return -1;
@@ -207,14 +207,14 @@ get_device_resource_info(HDEVINFO dev_info,
 	int ret;
 
 	switch (dev->kdrv) {
-	case RTE_PCI_KDRV_NONE:
-		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
+	case RTE_PCI_KDRV_UNKNOWN:
+		/* mem_resource is unneeded */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
 		break;
-	case RTE_PCI_KDRV_NIC_UIO:
-		/* get device info from netuio kernel driver */
+	case RTE_PCI_KDRV_NET_UIO:
+		/* get device info from NetUIO kernel driver */
 		ret = get_netuio_device_info(dev_info, dev_info_data, dev);
 		if (ret != 0) {
 			RTE_LOG(DEBUG, EAL,
@@ -323,9 +323,9 @@ set_kernel_driver_type(PSP_DEVINFO_DATA device_info_data,
 {
 	/* set kernel driver type based on device class */
 	if (IsEqualGUID(&(device_info_data->ClassGuid), &GUID_DEVCLASS_NETUIO))
-		dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
+		dev->kdrv = RTE_PCI_KDRV_NET_UIO;
 	else
-		dev->kdrv = RTE_PCI_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 }
 
 static int
Signature · 1 line
2.30.1
Acked-by on v1 1/1
#1 lore raw

2021-03-17 00:11 (UTC+0100), Thomas Monjalon:
[...]

Quoted 8 lines
drivers/bus/pci/rte_bus_pci.h +0 -0
index fdda046515..3d009cc74b 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 struct rte_devargs;
 
 enum rte_pci_kernel_driver {

drivers/bus/pci/rte_bus_pci.h TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver); · line 58

Quoted 10 lines
drivers/bus/pci/rte_bus_pci.h +4 -6
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* not listed - may be a bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_generic for Linux */

Module name is "uio_pci_generic", otherwise

#2 lore raw

17/03/2021 23:43, Dmitry Kozlyuk:

Quoted 9 lines

2021-03-17 00:11 (UTC+0100), Thomas Monjalon:
[...]

Quoted 7 lines
drivers/bus/pci/rte_bus_pci.h +0 -0
index fdda046515..3d009cc74b 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 struct rte_devargs;
 
Quoted 13 lines

drivers/bus/pci/rte_bus_pci.h TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver); · line 58

Quoted 11 lines
drivers/bus/pci/rte_bus_pci.h +4 -6
 enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* not listed - may be a bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_generic for Linux */

Module name is "uio_pci_generic", otherwise

Oops, yes I will fix.

Quoted 1 line
#3 lore raw
In reply to Thomas Monjalon

Hi Thomas,

Quoted 4 lines · Thomas Monjalon

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN (mlx case),
and RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used
instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO.

Shouldn't the mlx case actually remain RTE_PCI_KDRV_NONE?

mlx does not require a UIO-like kernel driver...No? And NONE implies that no kernel driver is used/required. Not sure what is correct here.

Quoted 26 lines

While adding the new value RTE_PCI_KDRV_NET_UIO, the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
---
  drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
  drivers/bus/pci/windows/pci.c | 14 +++++++-------
  2 files changed, 14 insertions(+), 13 deletions(-)
drivers/bus/pci/rte_bus_pci.h +0 -5
index fdda046515..3d009cc74b 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
  struct rte_devargs;
 
  enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,

drivers/bus/pci/rte_bus_pci.h TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver); · line 63

Quoted 10 lines
drivers/bus/pci/rte_bus_pci.h +7 -1
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* not listed - may be a bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* error */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
  };
 

Any chance we can re-order the enums, so that _NONE and _UNKNOWN are at the top?

This will change the value, and break code where this value was hard-coded. But how likely is that...?

ranjit m.

Quoted 45 lines
drivers/bus/pci/rte_bus_pci.h +0 -0
  /**
drivers/bus/pci/windows/pci.c +7 -7
index 8f906097f4..3f0ce1fb83 100644
@@ -38,7 +38,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
  	 * Devices that are bound to netuio are mapped at
  	 * the bus probing stage.
  	 */
-	if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_NET_UIO)
  		return 0;
  	else
  		return -1;
@@ -207,14 +207,14 @@ get_device_resource_info(HDEVINFO dev_info,
  	int ret;
 
  	switch (dev->kdrv) {
-	case RTE_PCI_KDRV_NONE:
-		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
+	case RTE_PCI_KDRV_UNKNOWN:
+		/* mem_resource is unneeded */
  		dev->mem_resource[0].phys_addr = 0;
  		dev->mem_resource[0].len = 0;
  		dev->mem_resource[0].addr = NULL;
  		break;
-	case RTE_PCI_KDRV_NIC_UIO:
-		/* get device info from netuio kernel driver */
+	case RTE_PCI_KDRV_NET_UIO:
+		/* get device info from NetUIO kernel driver */
  		ret = get_netuio_device_info(dev_info, dev_info_data, dev);
  		if (ret != 0) {
  			RTE_LOG(DEBUG, EAL,
@@ -323,9 +323,9 @@ set_kernel_driver_type(PSP_DEVINFO_DATA device_info_data,
  {
  	/* set kernel driver type based on device class */
  	if (IsEqualGUID(&(device_info_data->ClassGuid), &GUID_DEVCLASS_NETUIO))
-		dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
+		dev->kdrv = RTE_PCI_KDRV_NET_UIO;
  	else
-		dev->kdrv = RTE_PCI_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
  }
 
  static int
#4 lore raw

18/03/2021 00:17, Ranjit Menon:

Quoted 11 lines

Hi Thomas,

Quoted 4 lines · Thomas Monjalon

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN (mlx case),
and RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used
instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO.

Shouldn't the mlx case actually remain RTE_PCI_KDRV_NONE?

mlx does not require a UIO-like kernel driver...No? And NONE implies that no kernel driver is used/required. Not sure what is correct here.

No this is a bifurcated model, meaning kernel and userland work together. The PCI device is bound to the kernel driver, but the driver is not listed because no special treatment is required.

Quoted 31 lines
Quoted 31 lines

While adding the new value RTE_PCI_KDRV_NET_UIO, the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
---
  drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
  drivers/bus/pci/windows/pci.c | 14 +++++++-------
  2 files changed, 14 insertions(+), 13 deletions(-)
drivers/bus/pci/rte_bus_pci.h +4 -6
index fdda046515..3d009cc74b 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
  struct rte_devargs;
 
  enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* not listed - may be a bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_generic for Linux */
Quoted 8 lines

drivers/bus/pci/rte_bus_pci.h TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver); · line 63

Quoted 5 lines
drivers/bus/pci/rte_bus_pci.h +3 -0
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* error */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
  };
 

Any chance we can re-order the enums, so that _NONE and _UNKNOWN are at the top?

No, it would break the ABI.

Quoted 2 lines

This will change the value, and break code where this value was hard-coded. But how likely is that...?

The problem is when loading the new PCI bus driver with an old device driver.

#5 lore raw
Quoted 54 lines · Thomas Monjalon

18/03/2021 00:17, Ranjit Menon:

Quoted 11 lines

Hi Thomas,

Quoted 4 lines · Thomas Monjalon

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN (mlx case),
and RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used
instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO.

Shouldn't the mlx case actually remain RTE_PCI_KDRV_NONE?

mlx does not require a UIO-like kernel driver...No? And NONE implies that no kernel driver is used/required. Not sure what is correct here.

No this is a bifurcated model, meaning kernel and userland work together. The PCI device is bound to the kernel driver, but the driver is not listed because no special treatment is required.

Quoted 30 lines
Quoted 30 lines

While adding the new value RTE_PCI_KDRV_NET_UIO, the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
---
   drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
   drivers/bus/pci/windows/pci.c | 14 +++++++-------
   2 files changed, 14 insertions(+), 13 deletions(-)
drivers/bus/pci/rte_bus_pci.h +3 -6
index fdda046515..3d009cc74b 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
   struct rte_devargs;
 
   enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* not listed - may be a bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
Quoted 8 lines

drivers/bus/pci/rte_bus_pci.h TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver); · line 63

Quoted 6 lines
drivers/bus/pci/rte_bus_pci.h +4 -0
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* error */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
   };
 

Any chance we can re-order the enums, so that _NONE and _UNKNOWN are at the top?

Quoted 8 lines

No, it would break the ABI.

Quoted 2 lines

This will change the value, and break code where this value was hard-coded. But how likely is that...?

The problem is when loading the new PCI bus driver with an old device driver.

OK. Thanks for the explanation, Thomas.

ranjit m.

#6 lore raw
In reply to Thomas Monjalon

Hi, Thomas

Quoted 11 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Wednesday, March 17, 2021 1:12
To: [email protected]
Cc: [email protected]; [email protected]; Tal Shnaiderman <[email protected]>; Narcisa Vasile <[email protected]>; Ranjit Menon <[email protected]>; John Alexander <[email protected]>; Pallavi Kadam <[email protected]>
Subject: [dpdk-dev] [PATCH] bus/pci: fix Windows kernel driver categories

Quoted 4 lines

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN (mlx case), and RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO.

As far as I understand - under Windows there is always some kernel driver backing the device, hence, RTE_PCI_KDRV_NONE is not an option and RTE_PCI_KDRV_UNKNOWN is more appropriate. I would add this extra explanation in commit message.

With best regards,
Slava

Quoted 87 lines

While adding the new value RTE_PCI_KDRV_NET_UIO, the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
---
 drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
drivers/bus/pci/windows/pci.c | 14 +++++++-------
 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/bus/pci/rte_bus_pci.h +1 -6
index fdda046515..3d009cc74b 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 struct rte_devargs;
 
 enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* not listed - may be a bifurcated

driver */

drivers/bus/pci/rte_bus_pci.h +6 -0
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* error */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
 };
 
 /**
drivers/bus/pci/windows/pci.c +5 -5
index 8f906097f4..3f0ce1fb83 100644
@@ -38,7 +38,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 	 * Devices that are bound to netuio are mapped at
 	 * the bus probing stage.
 	 */
-	if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_NET_UIO)
 		return 0;
 	else
 		return -1;
@@ -207,14 +207,14 @@ get_device_resource_info(HDEVINFO dev_info,
 	int ret;
 
 	switch (dev->kdrv) {
-	case RTE_PCI_KDRV_NONE:
-		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
+	case RTE_PCI_KDRV_UNKNOWN:
+		/* mem_resource is unneeded */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
 		break;
-	case RTE_PCI_KDRV_NIC_UIO:
-		/* get device info from netuio kernel driver */
+	case RTE_PCI_KDRV_NET_UIO:
+		/* get device info from NetUIO kernel driver */
 		ret = get_netuio_device_info(dev_info, dev_info_data,
 dev);
 		if (ret != 0) {
drivers/bus/pci/windows/pci.c +2 -2
 			RTE_LOG(DEBUG, EAL,
@@ -323,9 +323,9 @@ set_kernel_driver_type(PSP_DEVINFO_DATA
 device_info_data,  {
 	/* set kernel driver type based on device class */
 	if (IsEqualGUID(&(device_info_data->ClassGuid),
 &GUID_DEVCLASS_NETUIO))
-		dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
+		dev->kdrv = RTE_PCI_KDRV_NET_UIO;
 	else
-		dev->kdrv = RTE_PCI_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 }
 

static int
--
2.30.1

#7 lore raw

18/03/2021 09:36, Slava Ovsiienko:

Quoted 10 lines

From: Thomas Monjalon

Quoted 4 lines

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN (mlx case), and RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO.

As far as I understand - under Windows there is always some kernel driver backing the device, hence, RTE_PCI_KDRV_NONE is not an option and RTE_PCI_KDRV_UNKNOWN is more appropriate. I would add this extra explanation in commit message.

The reason is that NONE is not appropriate because there *is* a kernel driver backing the device in mlx case.
And it is aligning with Linux.

I will improve the message and comments.

#8 lore raw

PATCH v2 1/1 bus/pci: fix Windows kernel driver categories

In reply to Thomas Monjalon

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN.
This value covers the mlx case where the kernel driver is in place, offering a bifurcated mode to the userspace driver.
When the kernel driver is listed as unknown,
there is no special treatment in DPDK probing, contrary to UIO modes.

The value RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO. While adding the new value RTE_PCI_KDRV_NET_UIO
(at the end for ABI compatibility),
the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")

---
v2: improve comments and commit message

---
 drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
 drivers/bus/pci/windows/pci.c | 14 +++++++-------
 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/bus/pci/rte_bus_pci.h +7 -6
index fdda046515..876abddefb 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 struct rte_devargs;
 
 enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated driver */
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* no attached driver */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
 };
 
 /**
drivers/bus/pci/windows/pci.c +7 -7
index 8f906097f4..d39a7748b8 100644
@@ -38,7 +38,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 	 * Devices that are bound to netuio are mapped at
 	 * the bus probing stage.
 	 */
-	if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_NET_UIO)
 		return 0;
 	else
 		return -1;
@@ -207,14 +207,14 @@ get_device_resource_info(HDEVINFO dev_info,
 	int ret;
 
 	switch (dev->kdrv) {
-	case RTE_PCI_KDRV_NONE:
-		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
+	case RTE_PCI_KDRV_UNKNOWN:
+		/* bifurcated driver case - mem_resource is unneeded */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
 		break;
-	case RTE_PCI_KDRV_NIC_UIO:
-		/* get device info from netuio kernel driver */
+	case RTE_PCI_KDRV_NET_UIO:
+		/* get device info from NetUIO kernel driver */
 		ret = get_netuio_device_info(dev_info, dev_info_data, dev);
 		if (ret != 0) {
 			RTE_LOG(DEBUG, EAL,
@@ -323,9 +323,9 @@ set_kernel_driver_type(PSP_DEVINFO_DATA device_info_data,
 {
 	/* set kernel driver type based on device class */
 	if (IsEqualGUID(&(device_info_data->ClassGuid), &GUID_DEVCLASS_NETUIO))
-		dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
+		dev->kdrv = RTE_PCI_KDRV_NET_UIO;
 	else
-		dev->kdrv = RTE_PCI_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 }
 
 static int
Signature · 1 line
2.30.1
Acked-by on v2 1/1
#9 lore raw
Quoted 97 lines

Subject: [PATCH v2] bus/pci: fix Windows kernel driver categories

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN.
This value covers the mlx case where the kernel driver is in place, offering a bifurcated mode to the userspace driver.
When the kernel driver is listed as unknown, there is no special treatment in DPDK probing, contrary to UIO modes.

The value RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO.
While adding the new value RTE_PCI_KDRV_NET_UIO (at the end for ABI compatibility), the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")

---
v2: improve comments and commit message

---
 drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
drivers/bus/pci/windows/pci.c | 14 +++++++-------
 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/bus/pci/rte_bus_pci.h +1 -6
index fdda046515..876abddefb 100644
@@ -52,12 +52,13 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 struct rte_devargs;
 
 enum rte_pci_kernel_driver {
-	RTE_PCI_KDRV_UNKNOWN = 0,
-	RTE_PCI_KDRV_IGB_UIO,
-	RTE_PCI_KDRV_VFIO,
-	RTE_PCI_KDRV_UIO_GENERIC,
-	RTE_PCI_KDRV_NIC_UIO,
-	RTE_PCI_KDRV_NONE,
+	RTE_PCI_KDRV_UNKNOWN = 0,  /* may be misc UIO or bifurcated

driver */

drivers/bus/pci/rte_bus_pci.h +6 -0
+	RTE_PCI_KDRV_IGB_UIO,      /* igb_uio for Linux */
+	RTE_PCI_KDRV_VFIO,         /* VFIO for Linux */
+	RTE_PCI_KDRV_UIO_GENERIC,  /* uio_pci_generic for Linux */
+	RTE_PCI_KDRV_NIC_UIO,      /* nic_uio for FreeBSD */
+	RTE_PCI_KDRV_NONE,         /* no attached driver */
+	RTE_PCI_KDRV_NET_UIO,      /* NetUIO for Windows */
 };
 
 /**
drivers/bus/pci/windows/pci.c +5 -5
index 8f906097f4..d39a7748b8 100644
@@ -38,7 +38,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 	 * Devices that are bound to netuio are mapped at
 	 * the bus probing stage.
 	 */
-	if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_NET_UIO)
 		return 0;
 	else
 		return -1;
@@ -207,14 +207,14 @@ get_device_resource_info(HDEVINFO dev_info,
 	int ret;
 
 	switch (dev->kdrv) {
-	case RTE_PCI_KDRV_NONE:
-		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
+	case RTE_PCI_KDRV_UNKNOWN:
+		/* bifurcated driver case - mem_resource is unneeded */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
 		break;
-	case RTE_PCI_KDRV_NIC_UIO:
-		/* get device info from netuio kernel driver */
+	case RTE_PCI_KDRV_NET_UIO:
+		/* get device info from NetUIO kernel driver */
 		ret = get_netuio_device_info(dev_info, dev_info_data,
 dev);
 		if (ret != 0) {
drivers/bus/pci/windows/pci.c +2 -2
 			RTE_LOG(DEBUG, EAL,
@@ -323,9 +323,9 @@ set_kernel_driver_type(PSP_DEVINFO_DATA
 device_info_data,  {
 	/* set kernel driver type based on device class */
 	if (IsEqualGUID(&(device_info_data->ClassGuid),
 &GUID_DEVCLASS_NETUIO))
-		dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
+		dev->kdrv = RTE_PCI_KDRV_NET_UIO;
 	else
-		dev->kdrv = RTE_PCI_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 }
 
Quoted 3 lines

static int
--
2.30.1

Acked-by on v2 1/1
#10 lore raw
In reply to Thomas Monjalon
Quoted 17 lines · Thomas Monjalon

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN.
This value covers the mlx case where the kernel driver is in place, offering a bifurcated mode to the userspace driver.
When the kernel driver is listed as unknown,
there is no special treatment in DPDK probing, contrary to UIO modes.

The value RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO. While adding the new value RTE_PCI_KDRV_NET_UIO
(at the end for ABI compatibility),
the enum of kernel driver categories is annotated.

Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
Quoted 9 lines

---
v2: improve comments and commit message

---
  drivers/bus/pci/rte_bus_pci.h | 13 +++++++------
  drivers/bus/pci/windows/pci.c | 14 +++++++-------
  2 files changed, 14 insertions(+), 13 deletions(-)
author Applied
#11 lore raw

18/03/2021 23:07, Ranjit Menon:

Quoted 14 lines · Thomas Monjalon
Quoted 13 lines

In Windows probing, the value RTE_PCI_KDRV_NONE was used instead of RTE_PCI_KDRV_UNKNOWN.
This value covers the mlx case where the kernel driver is in place, offering a bifurcated mode to the userspace driver.
When the kernel driver is listed as unknown,
there is no special treatment in DPDK probing, contrary to UIO modes.

The value RTE_PCI_KDRV_NIC_UIO (FreeBSD) was re-used instead of having a new RTE_PCI_KDRV_NET_UIO for Windows NetUIO. While adding the new value RTE_PCI_KDRV_NET_UIO
(at the end for ABI compatibility),
the enum of kernel driver categories is annotated.

Quoted 8 lines
Quoted 6 lines
Fixes b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")

Applied