Skip to contentSkip to conversation

bus/pci: fix probing for non-netuio bound devices

PATCH Superseded Pallavi Kadam 4 participants 9 messages Feb 10, 2021 – Mar 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus/pci: fix probing for non-netuio bound devices

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

---
 drivers/bus/pci/windows/pci.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/bus/pci/windows/pci.c +7 -8
index f66258452..16edaa769 100644
@@ -23,20 +23,19 @@ DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc,
  * the registry hive for PCI devices.
  */
 
-/* The functions below are not implemented on Windows,
+/* Some of the functions below are not implemented on Windows,
  * but need to be defined for compilation purposes
  */
 
 /* Map pci device */
 int
-rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
+rte_pci_map_device(struct rte_pci_device *dev)
 {
-	/* This function is not implemented on Windows.
-	 * We really should short-circuit the call to these functions by
-	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
-	 * in the rte_pci_driver flags.
-	 */
-	return 0;
+	/* Only return success for devices bound to netuio */
+	if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+		return 0;
+	else
+		return -EINVAL;
 }
 
 /* Unmap pci device */
Signature · 1 line
2.18.0.windows.1
#1 lore raw
Quoted 33 lines

Subject: [PATCH] bus/pci: fix probing for non-netuio bound devices

External email: Use caution opening links or attachments

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

---
 drivers/bus/pci/windows/pci.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/bus/pci/windows/pci.c +1 -1
index f66258452..16edaa769 100644
@@ -23,20 +23,19 @@
 DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40,
 0x45bc,
  * the registry hive for PCI devices.
  */
 
-/* The functions below are not implemented on Windows,
+/* Some of the functions below are not implemented on Windows,
  * but need to be defined for compilation purposes
  */
 
 /* Map pci device */
 int

drivers/bus/pci/windows/pci.c line 36

Quoted 10 lines
drivers/bus/pci/windows/pci.c +2 -7
-rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
+rte_pci_map_device(struct rte_pci_device *dev)
 {
-       /* This function is not implemented on Windows.
-        * We really should short-circuit the call to these functions by
-        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
-        * in the rte_pci_driver flags.
-        */
-       return 0;
+       /* Only return success for devices bound to netuio */

Maybe extend this comment to mention where the mapping is actually done?

drivers/bus/pci/windows/pci.c DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc, · line 38

Quoted 4 lines
drivers/bus/pci/windows/pci.c +4 -0
+       if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+               return 0;
+       else
+               return -EINVAL;	

The function should return -1 here to match the behavior with other OS implementations.

Quoted 5 lines
drivers/bus/pci/windows/pci.c +0 -0
 }

/* Unmap pci device */
--
2.18.0.windows.1

#2 lore raw
Quoted 31 lines · Tal Shnaiderman
Quoted 31 lines

Subject: [PATCH] bus/pci: fix probing for non-netuio bound devices

External email: Use caution opening links or attachments

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

---
  drivers/bus/pci/windows/pci.c | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)
drivers/bus/pci/windows/pci.c +1 -1
index f66258452..16edaa769 100644
@@ -23,20 +23,19 @@
 DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40,
 0x45bc,
   * the registry hive for PCI devices.
   */
 
-/* The functions below are not implemented on Windows,
+/* Some of the functions below are not implemented on Windows,
   * but need to be defined for compilation purposes
   */
 
Quoted 13 lines

drivers/bus/pci/windows/pci.c DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc, · line 34

Quoted 12 lines
drivers/bus/pci/windows/pci.c +2 -7
  /* Map pci device */
  int
-rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
+rte_pci_map_device(struct rte_pci_device *dev)
  {
-       /* This function is not implemented on Windows.
-        * We really should short-circuit the call to these functions by
-        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
-        * in the rte_pci_driver flags.
-        */
-       return 0;
+       /* Only return success for devices bound to netuio */

Maybe extend this comment to mention where the mapping is actually done?

Modified the comment in v2.

Quoted 6 lines

drivers/bus/pci/windows/pci.c DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc, · line 38

Quoted 5 lines
drivers/bus/pci/windows/pci.c +4 -0
+       if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+               return 0;
+       else
+               return -EINVAL;	

The function should return -1 here to match the behavior with other OS implementations.

Replaced the return value in v2.

Thanks.

Quoted 6 lines
Quoted 6 lines
drivers/bus/pci/windows/pci.c +0 -0
  }

/* Unmap pci device */
--
2.18.0.windows.1

#3 lore raw

PATCH v2 1/1 bus/pci: fix probing for non-netuio bound devices

In reply to Pallavi Kadam

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

v2 changes:
- Extended the comment to mention about mapping
- replaced the return errno value with -1

---
 drivers/bus/pci/windows/pci.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/bus/pci/windows/pci.c +9 -7
index f66258452..00e7849b0 100644
@@ -23,20 +23,22 @@ DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc,
  * the registry hive for PCI devices.
  */
 
-/* The functions below are not implemented on Windows,
+/* Some of the functions below are not implemented on Windows,
  * but need to be defined for compilation purposes
  */
 
 /* Map pci device */
 int
-rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
+rte_pci_map_device(struct rte_pci_device *dev)
 {
-	/* This function is not implemented on Windows.
-	 * We really should short-circuit the call to these functions by
-	 * clearing the RTE_PCI_DRV_NEED_MAPPING flag
-	 * in the rte_pci_driver flags.
+	/* Only return success for devices bound to netuio.
+	 * Devices that are bound to netuio are mapped at
+	 * the bus probing stage.
 	 */
-	return 0;
+	if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+		return 0;
+	else
+		return -1;
 }
 
 /* Unmap pci device */
Signature · 1 line
2.18.0.windows.1
Acked-by on v2 1/1
#4 lore raw
Quoted 55 lines

Subject: [PATCH v2] bus/pci: fix probing for non-netuio bound devices

External email: Use caution opening links or attachments

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

v2 changes:
- Extended the comment to mention about mapping
- replaced the return errno value with -1

---
 drivers/bus/pci/windows/pci.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/bus/pci/windows/pci.c +9 -7
index f66258452..00e7849b0 100644
@@ -23,20 +23,22 @@
 DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40,
 0x45bc,
  * the registry hive for PCI devices.
  */
 
-/* The functions below are not implemented on Windows,
+/* Some of the functions below are not implemented on Windows,
  * but need to be defined for compilation purposes
  */
 
 /* Map pci device */
 int
-rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
+rte_pci_map_device(struct rte_pci_device *dev)
 {
-       /* This function is not implemented on Windows.
-        * We really should short-circuit the call to these functions by
-        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
-        * in the rte_pci_driver flags.
+       /* Only return success for devices bound to netuio.
+        * Devices that are bound to netuio are mapped at
+        * the bus probing stage.
         */
-       return 0;
+       if (dev->kdrv == RTE_PCI_KDRV_NIC_UIO)
+               return 0;
+       else
+               return -1;
 }
Quoted 3 lines

/* Unmap pci device */
--
2.18.0.windows.1

#5 lore raw
Quoted 7 lines
Quoted 7 lines

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

v2 changes:
- Extended the comment to mention about mapping
- replaced the return errno value with -1

The changelog should be below the line "---"
so it is skipped when applying the patch.

Missing 'Fixes' tag:

Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
Quoted 5 lines
Quoted 3 lines

Applied, thanks

#6 lore raw
Quoted 9 lines · Thomas Monjalon
Quoted 7 lines
Quoted 7 lines

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

v2 changes:
- Extended the comment to mention about mapping
- replaced the return errno value with -1

The changelog should be below the line "---"
so it is skipped when applying the patch.

Thanks, Thomas. Will keep this in mind.

Quoted 12 lines

Missing 'Fixes' tag:

Fixes c76ec01b4591 ("bus/pci: support netuio on Windows")
Quoted 4 lines
Quoted 3 lines

Applied, thanks

Tested-by Narcisa Vasile Acked-by on v2 1/1
#7 lore raw
In reply to Pallavi Kadam
Quoted 4 lines · Pallavi Kadam

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

Quoted 8 lines

v2 changes:
- Extended the comment to mention about mapping
- replaced the return errno value with -1

---

Tested-by Acked-by on v1 1/1
#8 lore raw
In reply to Pallavi Kadam

drivers/bus/pci/windows/pci.c

Quoted 12 lines · Pallavi Kadam

Implement rte_pci_map_device() to distinguish between the devices bound to netuio and NDIS devices.
Only return success for the netuio devices.

---
 drivers/bus/pci/windows/pci.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/bus/pci/windows/pci.c +0 -0