MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pci_scan_one

Function pci_scan_one

dpdk/drivers/bus/pci/windows/pci.c:360–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360static int
361pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
362{
363 struct rte_pci_device_internal *pdev = NULL;
364 struct rte_pci_device *dev = NULL;
365 int ret = -1;
366 char pci_device_info[REGSTR_VAL_MAX_HCID_LEN];
367 struct rte_pci_addr addr;
368 struct rte_pci_id pci_id;
369
370 ret = get_device_pci_address(dev_info, device_info_data, &addr);
371 if (ret != 0)
372 goto end;
373
374 if (rte_pci_ignore_device(&addr)) {
375 /*
376 * We won't add this device, but we want to continue
377 * looking for supported devices
378 */
379 ret = ERROR_CONTINUE;
380 goto end;
381 }
382
383 ret = get_pci_hardware_id(dev_info, device_info_data,
384 pci_device_info, sizeof(pci_device_info));
385 if (ret != 0)
386 goto end;
387
388 ret = parse_pci_hardware_id((const char *)&pci_device_info, &pci_id);
389 if (ret != 0) {
390 /*
391 * We won't add this device, but we want to continue
392 * looking for supported devices
393 */
394 ret = ERROR_CONTINUE;
395 goto end;
396 }
397
398 pdev = malloc(sizeof(*pdev));
399 if (pdev == NULL) {
400 RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci device\n");
401 goto end;
402 }
403
404 memset(pdev, 0, sizeof(*pdev));
405 dev = &pdev->device;
406
407 dev->device.bus = &rte_pci_bus.bus;
408 dev->addr = addr;
409 dev->id = pci_id;
410 dev->max_vfs = 0; /* TODO: get max_vfs */
411
412 pci_common_set(dev);
413
414 set_kernel_driver_type(device_info_data, dev);
415
416 /* get resources */
417 if (get_device_resource_info(dev_info, device_info_data, dev)

Callers 1

rte_pci_scanFunction · 0.70

Calls 14

get_device_pci_addressFunction · 0.85
rte_pci_ignore_deviceFunction · 0.85
get_pci_hardware_idFunction · 0.85
parse_pci_hardware_idFunction · 0.85
mallocFunction · 0.85
memsetFunction · 0.85
pci_common_setFunction · 0.85
set_kernel_driver_typeFunction · 0.85
get_device_resource_infoFunction · 0.85
rte_pci_add_deviceFunction · 0.85
rte_pci_addr_cmpFunction · 0.85
rte_pci_insert_deviceFunction · 0.85

Tested by

no test coverage detected