rte_eth_dev_socket_id return
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Tue Aug 16 22:08:34 CEST 2022
2022-08-14 15:36 (UTC+0700), Danil Onishchenko:
> Hello,
>
> I faced a confusing behavior of rte_eth_dev_socket_id() function. In my
> application I configured eth port and if after that I call
> rte_eth_dev_socket_id(port) it returns -1. In documentation of the
> function it is said "Returns: The NUMA socket ID to which the Ethernet
> device is connected or a default of zero if the socket could not be
> determined. -1 is returned is the port_id value is out of range.".
> However if call rte_eth_dev_is_valid_port(port) with the same port id it
> returns 1. The documentation of this function says "Returns: 0 if port
> is out of range or not attached, 1 if device is attached". It looks like
> this functions can't return -1 and 1 respectively for the same port
> number. Are there any other cases when the first one can return -1?
Hi Danil,
This function returns whatever the bus driver discovers.
Assuming Linux and PCI, the bus driver reads
/sys/bus/pci/devices/<addr>/numa_node
Does this file contain "-1" for your device?
It's a DPDK bug anyway that documentation doesn't match behavior.
Relevant bus driver code:
/* get numa node, default to 0 if not present */
snprintf(filename, sizeof(filename), "%s/numa_node",
dirname);
if (access(filename, F_OK) != -1) {
if (eal_parse_sysfs_value(filename, &tmp) == 0)
dev->device.numa_node = tmp;
else
dev->device.numa_node = -1;
} else {
dev->device.numa_node = 0;
}
More information about the users
mailing list