DPDK usage discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Danil Onishchenko <danil.onishchenko.info@gmail.com>
Cc: users@dpdk.org
Subject: Re: rte_eth_dev_socket_id return
Date: Tue, 16 Aug 2022 23:08:34 +0300	[thread overview]
Message-ID: <20220816230834.751a2288@sovereign> (raw)
In-Reply-To: <daaa2955-fa7a-4625-4d83-c2a0f12ed4bd@gmail.com>

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;
	}

  reply	other threads:[~2022-08-16 20:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-14  8:36 Danil Onishchenko
2022-08-16 20:08 ` Dmitry Kozlyuk [this message]
2022-08-22 11:31   ` Danil Onishchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220816230834.751a2288@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=danil.onishchenko.info@gmail.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).