From: Intel Date: Mon, 3 Jun 2013 00:00:00 +0000 (+0000) Subject: pci: store numa_node per device X-Git-Tag: spdx-start~11235 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b8539d50c560e53704680a38cdd32d3c39a23b49;p=dpdk.git pci: store numa_node per device Signed-off-by: Intel --- diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 2235acb1bf..1314d20f20 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -143,6 +143,7 @@ struct rte_pci_device { struct rte_intr_handle intr_handle; /**< Interrupt handle */ const struct rte_pci_driver *driver; /**< Associated driver */ uint16_t max_vfs; /**< sriov enable if not zero */ + int numa_node; /**< NUMA node connection */ unsigned int blacklisted:1; /**< Device is blacklisted */ }; diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index de975ad83f..063a070db9 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -774,6 +774,20 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, dev->max_vfs = (uint16_t)tmp; } + /* get numa node */ + rte_snprintf(filename, sizeof(filename), "%s/numa_node", + dirname); + if (access(filename, R_OK) != 0) { + /* if no NUMA support just set node to 0 */ + dev->numa_node = -1; + } else { + if (eal_parse_sysfs_value(filename, &tmp) < 0) { + free(dev); + return -1; + } + dev->numa_node = tmp; + } + /* parse resources */ rte_snprintf(filename, sizeof(filename), "%s/resource", dirname); if (pci_parse_sysfs_resource(filename, dev) < 0) { @@ -923,6 +937,12 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d id_table->subsystem_device_id != PCI_ANY_ID) continue; + struct rte_pci_addr *loc = &dev->addr; + + RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", + loc->domain, loc->bus, loc->devid, loc->function, + dev->numa_node); + RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->name);