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

Function rte_pci_scan

dpdk/drivers/bus/pci/linux/pci.c:443–484  ·  view source on GitHub ↗

* Scan the content of the PCI bus, and the devices in the devices * list */

Source from the content-addressed store, hash-verified

441 * list
442 */
443int
444rte_pci_scan(void)
445{
446 struct dirent *e;
447 DIR *dir;
448 char dirname[PATH_MAX];
449 struct rte_pci_addr addr;
450
451 /* for debug purposes, PCI can be disabled */
452 if (!rte_eal_has_pci())
453 return 0;
454
455 dir = opendir(rte_pci_get_sysfs_path());
456 if (dir == NULL) {
457 RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n",
458 __func__, strerror(errno));
459 return -1;
460 }
461
462 while ((e = readdir(dir)) != NULL) {
463 if (e->d_name[0] == '.')
464 continue;
465
466 if (parse_pci_addr_format(e->d_name, sizeof(e->d_name), &addr) != 0)
467 continue;
468
469 if (rte_pci_ignore_device(&addr))
470 continue;
471
472 snprintf(dirname, sizeof(dirname), "%s/%s",
473 rte_pci_get_sysfs_path(), e->d_name);
474
475 if (pci_scan_one(dirname, &addr) < 0)
476 goto error;
477 }
478 closedir(dir);
479 return 0;
480
481error:
482 closedir(dir);
483 return -1;
484}
485
486#if defined(RTE_ARCH_X86)
487bool

Callers

nothing calls this directly

Calls 9

rte_eal_has_pciFunction · 0.85
opendirFunction · 0.85
rte_pci_get_sysfs_pathFunction · 0.85
readdirFunction · 0.85
parse_pci_addr_formatFunction · 0.85
rte_pci_ignore_deviceFunction · 0.85
snprintfFunction · 0.85
closedirFunction · 0.85
pci_scan_oneFunction · 0.70

Tested by

no test coverage detected