On Wed, Jun 24, 2020 at 11:28:46AM +0300, tal...@mellanox.com wrote: > From: Tal Shnaiderman <tal...@mellanox.com> > > Uses SetupAPI.h functions to scan PCI tree. > Uses DEVPKEY_Device_Numa_Node to get the PCI NUMA node. > Uses SPDRP_BUSNUMBER and SPDRP_BUSNUMBER to get the BDF. > scanning currently supports types RTE_KDRV_NONE. > > Signed-off-by: Tal Shnaiderman <tal...@mellanox.com> > --- > drivers/bus/pci/windows/pci.c | 263 > ++++++++++++++++++++++++++- > lib/librte_eal/rte_eal_exports.def | 1 + > lib/librte_eal/windows/include/rte_windows.h | 1 + > 3 files changed, 261 insertions(+), 4 deletions(-) > > int > rte_pci_scan(void) > { > - return 0; > + int ret = -1; > + DWORD device_index = 0, found_device = 0; > + HDEVINFO dev_info; > + SP_DEVINFO_DATA device_info_data; > + > + /* for debug purposes, PCI can be disabled */ > + if (!rte_eal_has_pci()) > + return 0; > + > + dev_info = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, TEXT("PCI"), NULL, > + DIGCF_PRESENT);
Should we search for PCI devices by all classes to account for future support of drivers that are not part of the the Net class (e.g. netuio driver)? E.g.: SetupDiGetClassDevs(NULL, TEXT("PCI"), NULL, DIGCF_PRESENT | DIGCF_ALLCLASSES); Alternatively, since this patchset supports only RTE_KDRV_NONE, we can change it when introducing support for other types. > + if (dev_info == INVALID_HANDLE_VALUE) { > + RTE_LOG_WIN32_ERR("SetupDiGetClassDevs(pci_scan)"); > + RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n"); > + goto end; > +