[dpdk-dev] [PATCH] bus/pci: netuio interface for windows

Tal Shnaiderman talshn at nvidia.com
Sun Sep 13 20:42:51 CEST 2020


> Subject: [PATCH] bus/pci: netuio interface for windows
> 
> This patch adds implementations to probe PCI devices bound to netuio with
> the help of "netuio" class device changes.
> Now Windows will support both "netuio" and "net" device class and can set
> kernel driver type based on the device class selection.
> 
> Note: Few definitions and structures have been copied from
> netuio_interface.h file from ("[v3] windows/netuio: add Windows NetUIO
> kernel driver") series and this will be fixed once the exact path for netuio
> source code is known.
> 
> Signed-off-by: Pallavi Kadam <pallavi.kadam at intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon at intel.com>
> ---
>  drivers/bus/pci/windows/pci.c | 293 +++++++++++++++++++++++++++++--
> ---
>  1 file changed, 257 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
> index c80bd5571..38db87a2a 100644
> --- a/drivers/bus/pci/windows/pci.c
> +++ b/drivers/bus/pci/windows/pci.c

I think it will be better to split the pci implementation into 2 files and add pci_netuio.c
(similarly to Linux with pci_uio.c and pci_vfio.c), moving all of the netuio-specific definitions and functions in this patch to the new file.

[snip]

> -int
> -rte_pci_scan(void)
> +static int
> +pci_scan_device_class(const GUID *guid)
>  {
>         int   ret = -1;
>         DWORD device_index = 0, found_device = 0;
>         HDEVINFO dev_info;
>         SP_DEVINFO_DATA device_info_data;
> +       const char *class;
> 
> -       /* for debug purposes, PCI can be disabled */
> -       if (!rte_eal_has_pci())
> -               return 0;
> +       if (IsEqualGUID((const void *)guid,
> +           (const void *)&GUID_DEVCLASS_NETUIO))
> +               class = netuio_class;
> +       else
> +               class = net_class;
> 
> -       dev_info = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, TEXT("PCI"),
> NULL,
> -                               DIGCF_PRESENT);
> +       dev_info = SetupDiGetClassDevs(guid, TEXT("PCI"), NULL,
> + DIGCF_PRESENT);

Is there a way to get both GUID_DEVCLASS_NET and GUID_DEVCLASS_NETUIO in a single call here?
We could avoid calling this function twice if we could get all of the devices.

>         if (dev_info == INVALID_HANDLE_VALUE) {
>                 RTE_LOG_WIN32_ERR("SetupDiGetClassDevs(pci_scan)");
> -               RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n");
> +               RTE_LOG(ERR, EAL, "Unable to enumerate %s PCI devices.\n",
> +                           class);
>                 goto end;
>         }
> 
> @@ -415,7 +614,8 @@ rte_pci_scan(void)
>                 device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
>         }
> 
> -       RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", found_device);
> +       RTE_LOG(DEBUG, EAL, "PCI scan found %lu %s devices\n",
> +               found_device, class);
>         ret = 0;
>  end:
>         if (dev_info != INVALID_HANDLE_VALUE) @@ -423,3 +623,24 @@
> rte_pci_scan(void)
> 
>         return ret;
>  }
> +
> +/*
> + * Scan the contents of the PCI bus looking for devices  */ int
> +rte_pci_scan(void)
> +{
> +       int   ret = -1;
> +
> +       /* for debug purposes, PCI can be disabled */
> +       if (!rte_eal_has_pci())
> +               return 0;
> +
> +       /* first, scan for netUIO class devices */
> +       ret = pci_scan_device_class(&GUID_DEVCLASS_NETUIO);

ret is overwritten later on.

> +
> +       /* then, scan for the standard net class devices */
> +       ret = pci_scan_device_class(&GUID_DEVCLASS_NET);
> +
> +       return ret;
> +}
> --
> 2.18.0.windows.1



More information about the dev mailing list