[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1708531057-67392-1-git-send-email-jdamato@fastly.com>
Date: Wed, 21 Feb 2024 07:57:28 -0800
From: Joe Damato <jdamato@...tly.com>
To: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Joe Damato <jdamato@...tly.com>,
Alexei Starovoitov <ast@...nel.org>,
Amritha Nambiar <amritha.nambiar@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Larysa Zaremba <larysa.zaremba@...el.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Paolo Abeni <pabeni@...hat.com>,
Sridhar Samudrala <sridhar.samudrala@...el.com>,
Stanislav Fomichev <sdf@...gle.com>,
Tariq Toukan <tariqt@...dia.com>
Subject: [PATCH net-next 0/2] Expose netdev name in netdev netlink APIs
Greetings:
The netdev netlink APIs currently provide the ifindex of a device
associated with the NIC queue or NAPI when the netlink API is used. In
order for user applications to map this back to a human readable device
name, user applications must issue a subsequent ioctl (SIOCGIFNAME) in
order to map an ifindex back to a device name.
This patch set adds ifname to the API so that when queue or NAPI
information is retrieved, the human readable string is included. The netdev
netlink YAML spec has been updated to include this field, as well.
This saves the subsequent call to ioctl and makes the netlink information
more user friendly. Applications might use this information in conjunction
with SO_INCOMING_NAPI_ID to map NAPI IDs to specific NICs with application
specific configuration (e.g. NUMA zone and CPU layout information).
An example using the netlink cli tool before this change:
$ ./cli.py --spec netdev.yaml --dump queue-get --json='{"ifindex": 7}'
[{'id': 0, 'ifindex': 7, 'type': 'rx'},
{'id': 1, 'ifindex': 7, 'type': 'rx'},
{'id': 2, 'ifindex': 7, 'type': 'rx'},
...
$ ./cli.py --spec netdev.yaml --dump napi-get --json='{"ifindex": 7}'
[{'id': 448, 'ifindex': 7},
{'id': 447, 'ifindex': 7},
{'id': 446, 'ifindex': 7},
...
An example after this change:
$ ./cli.py --spec netdev.yaml --dump queue-get --json='{"ifindex": 7}'
[{'id': 0, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'},
{'id': 1, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'},
{'id': 2, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'},
...
$ ./cli.py --spec netdev.yaml --dump napi-get --json='{"ifindex": 7}'
[{'id': 448, 'ifindex': 7, 'ifname': 'eth1'},
{'id': 447, 'ifindex': 7, 'ifname': 'eth1'},
{'id': 446, 'ifindex': 7, 'ifname': 'eth1'},
...
Thanks,
Joe
Joe Damato (2):
netdev-genl: Add ifname for queue and NAPI APIs
netdev-genl: spec: Add ifname to netdev nl YAML spec
Documentation/netlink/specs/netdev.yaml | 10 ++++++++++
include/uapi/linux/netdev.h | 2 ++
net/core/netdev-genl.c | 22 +++++++++++++++++-----
tools/include/uapi/linux/netdev.h | 2 ++
4 files changed, 31 insertions(+), 5 deletions(-)
--
2.7.4
Powered by blists - more mailing lists