Getting network port ID by ethdev port ID

Ivan Malov ivan.malov at arknetworks.am
Mon Jun 5 16:03:04 CEST 2023


Hi Thomas,

Thanks for responding. Please see below.

On Mon, 5 Jun 2023, Thomas Monjalon wrote:

> Hello,
>
> 05/06/2023 15:09, Ivan Malov:
>> Dear community,
>>
>> Is there any means in DPDK to discover relationship between
>> network/physical ports of the given adapter/board and
>> etdevs deployed in DPDK application on top of it?
>>
>> For example, in Linux, there are facilities like
>>
>>> /sys/class/net/<iface>/phys_port_name
>>> /sys/class/net/<iface>/dev_port
>>
>> and
>>
>>> devlink port show
>>
>> Do we have something similar in DPDK?
>
> We can get the device name of a port:
> 	rte_eth_dev_get_name_by_port()

I'm afraid this won't do. Consider the following example.
Say, there's a NIC with two network ports and two PFs,
0000:01:00.0 and 0000:01:00.1. The user plugs these
PFs to DPDK application. The resulting ethdev IDs
are 0 and 1. If the user invokes the said API,
they will get 0000:01:00.0 and 0000:01:00.1.
But that's not what is really needed.

We seek a means to get the network port ID by
ethdev ID. For example, something like this:
- get_netport_by_ethdev(0) => 0
- get_netport_by_ethdev(1) => 1

If two different PCI functions are associated with the
same network port (0, for instance), this should be
- get_netport_by_ethdev(0) => 0
- get_netport_by_ethdev(1) => 0

Do we have something like that in DPDK?

>
>> If no, would the feature be worthwhile implementing?
>
> We may have discrepancies in different device classes.

I mean precisely "ethdev"s. I do realise, though, that
an ethdev may be backed by a vdev (af_xdp, etc.) = in
such cases the assumed "get_netport" method could
just return (-ENOTSUP). What do you think?

> Feel free to make a global status of device names.
>
Could you please elaborate on this?

Thank you.


More information about the dev mailing list