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

Message ID 20210210203654.10132-1-pallavi.kadam@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] bus/pci: fix probing for non-netuio bound devices |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing warning Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Kadam, Pallavi Feb. 10, 2021, 8:36 p.m. UTC
  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

Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 drivers/bus/pci/windows/pci.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
  

Comments

Tal Shnaiderman Feb. 11, 2021, 7:30 p.m. UTC | #1
> 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
> 
> Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  drivers/bus/pci/windows/pci.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
> index f66258452..00e7849b0 100644
> --- a/drivers/bus/pci/windows/pci.c
> +++ b/drivers/bus/pci/windows/pci.c
> @@ -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 */
> --
> 2.18.0.windows.1

Acked-by: Tal Shnaiderman <talshn@nvidia.com>
  
Narcisa Ana Maria Vasile March 5, 2021, 2:04 a.m. UTC | #2
On Wed, Feb 10, 2021 at 12:36:54PM -0800, Pallavi Kadam wrote:
> 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
> 
> Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---

Tested-by: Narcisa Vasile <navsile@linux.microsoft.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
  
Thomas Monjalon March 16, 2021, 11:20 a.m. UTC | #3
> > 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")
Cc: stable@dpdk.org

> > Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> 
> Acked-by: Tal Shnaiderman <talshn@nvidia.com>

Applied, thanks
  
Kadam, Pallavi March 17, 2021, 4:41 p.m. UTC | #4
On 3/16/2021 4:20 AM, Thomas Monjalon wrote:
>>> 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.
>
> Missing 'Fixes' tag:
> Fixes: c76ec01b4591 ("bus/pci: support netuio on Windows")
> Cc: stable@dpdk.org
>
>>> Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
>>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> Acked-by: Tal Shnaiderman <talshn@nvidia.com>
> Applied, thanks
>
>
  

Patch

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index f66258452..00e7849b0 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -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 */