src/dpdk/drivers/bus/pci/windows/pci.c
int
rte_pci_scan(void)
{
	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(NULL, TEXT("PCI"), NULL,
		DIGCF_PRESENT | DIGCF_ALLCLASSES);
	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;
	}

	device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
	device_index = 0;

	while (SetupDiEnumDeviceInfo(dev_info, device_index,
	    &device_info_data)) {
		device_index++;
		/* we only want to enumerate net & netuio class devices */
		if (IsEqualGUID(&(device_info_data.ClassGuid),
		    &GUID_DEVCLASS_NET) ||
			IsEqualGUID(&(device_info_data.ClassGuid),
			    &GUID_DEVCLASS_NETUIO)) {
			ret = pci_scan_one(dev_info, &device_info_data);
			if (ret == ERROR_SUCCESS)
				found_device++;
			else if (ret != ERROR_CONTINUE)
				goto end;
		}
		memset(&device_info_data, 0, sizeof(SP_DEVINFO_DATA));
		device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
	}

	RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", found_device);
	ret = 0;
end:
	if (dev_info != INVALID_HANDLE_VALUE)
		SetupDiDestroyDeviceInfoList(dev_info);

	return ret;
}
/*
 * Scan the contents of the PCI bus
 * and add all network class devices into the devices list.
 */
Scan the contents of the PCI bus
and add all network class devices into the devices list.
Scan the contents of the PCI bus and add all network class devices into the devices list .
int
rte_pci_scan(void)
{
	int   ret = -1;
	DWORD device_index = 0, found_device = 0;
	HDEVINFO dev_info;
	SP_DEVINFO_DATA device_info_data;
	if (!rte_eal_has_pci())
		return 0;
	dev_info = SetupDiGetClassDevs(NULL, TEXT("PCI"), NULL,
		DIGCF_PRESENT | DIGCF_ALLCLASSES);
	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;
	}
	device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
	device_index = 0;
	while (SetupDiEnumDeviceInfo(dev_info, device_index,
	    &device_info_data)) {
		device_index++;
		if (IsEqualGUID(&(device_info_data.ClassGuid),
		    &GUID_DEVCLASS_NET) ||
			IsEqualGUID(&(device_info_data.ClassGuid),
			    &GUID_DEVCLASS_NETUIO)) {
			ret = pci_scan_one(dev_info, &device_info_data);
			if (ret == ERROR_SUCCESS)
				found_device++;
			else if (ret != ERROR_CONTINUE)
				goto end;
		}
		memset(&device_info_data, 0, sizeof(SP_DEVINFO_DATA));
		device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
	}
	RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", found_device);
	ret = 0;
end:
	if (dev_info != INVALID_HANDLE_VALUE)
		SetupDiDestroyDeviceInfoList(dev_info);
	return ret;
}
int rte_pci_scan ( void ) { int ret = -1 ; DWORD device_index = 0 , found_device = 0 ; HDEVINFO dev_info ; SP_DEVINFO_DATA device_info_data ; if ( ! rte_eal_has_pci ( ) ) return 0 ; dev_info = SetupDiGetClassDevs ( NULL , TEXT ( " " ) , NULL , DIGCF_PRESENT | DIGCF_ALLCLASSES ) ; if ( dev_info == INVALID_HANDLE_VALUE ) { RTE_LOG_WIN32_ERR ( " " ) ; RTE_LOG ( ERR , EAL , " \n " ) ; goto end ; } device_info_data . cbSize = sizeof ( SP_DEVINFO_DATA ) ; device_index = 0 ; while ( SetupDiEnumDeviceInfo ( dev_info , device_index , & device_info_data ) ) { device_index ++ ; if ( IsEqualGUID ( & ( device_info_data . ClassGuid ) , & GUID_DEVCLASS_NET ) || IsEqualGUID ( & ( device_info_data . ClassGuid ) , & GUID_DEVCLASS_NETUIO ) ) { ret = pci_scan_one ( dev_info , & device_info_data ) ; if ( ret == ERROR_SUCCESS ) found_device ++ ; else if ( ret != ERROR_CONTINUE ) goto end ; } memset ( & device_info_data , 0 , sizeof ( SP_DEVINFO_DATA ) ) ; device_info_data . cbSize = sizeof ( SP_DEVINFO_DATA ) ; } RTE_LOG ( DEBUG , EAL , " \n " , found_device ) ; ret = 0 ; end : if ( dev_info != INVALID_HANDLE_VALUE ) SetupDiDestroyDeviceInfoList ( dev_info ) ; return ret ; }
Scan the contents of the PCI bus
 and add all network class devices into the devices list.
Scan the contents of the PCI bus and add all network class devices into the devices list .
/* for debug purposes, PCI can be disabled */ /* we only want to enumerate net & netuio class devices */