[dpdk-dev] [PATCH] eal/linux: fix negative value for undetermined numa_node

Cunming Liang cunming.liang at intel.com
Fri Jul 31 03:36:12 CEST 2015


The patch sets zero as the default value of pci device numa_node
if the socket could not be determined.
It provides the same default value as FreeBSD which has no NUMA support,
and makes the return value of rte_eth_dev_socket_id() be consistent
with the API description.

Signed-off-by: Cunming Liang <cunming.liang at intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 0e62f65..f573092 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -325,8 +325,8 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 	snprintf(filename, sizeof(filename), "%s/numa_node",
 		 dirname);
 	if (access(filename, R_OK) != 0) {
-		/* if no NUMA support just set node to -1 */
-		dev->numa_node = -1;
+		/* if no NUMA support, set default to 0 */
+		dev->numa_node = 0;
 	} else {
 		if (eal_parse_sysfs_value(filename, &tmp) < 0) {
 			free(dev);
-- 
2.4.3



More information about the dev mailing list