netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Expose netdev name in netdev netlink APIs
@ 2024-02-21 15:57 Joe Damato
  2024-02-21 15:57 ` [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs Joe Damato
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Joe Damato @ 2024-02-21 15:57 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Joe Damato, Alexei Starovoitov, Amritha Nambiar, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Jesper Dangaard Brouer,
	Larysa Zaremba, Maciej Fijalkowski, Paolo Abeni,
	Sridhar Samudrala, Stanislav Fomichev, Tariq Toukan

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-02-23 11:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 15:57 [PATCH net-next 0/2] Expose netdev name in netdev netlink APIs Joe Damato
2024-02-21 15:57 ` [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs Joe Damato
2024-02-21 19:12   ` Jakub Kicinski
2024-02-21 19:17     ` Joe Damato
2024-02-21 19:12   ` Nambiar, Amritha
2024-02-21 19:23     ` Joe Damato
2024-02-22 20:55   ` kernel test robot
2024-02-23 11:21   ` Dan Carpenter
2024-02-21 15:57 ` [PATCH net-next 2/2] netdev-genl: spec: Add ifname to netdev nl YAML spec Joe Damato
2024-02-21 19:09 ` [PATCH net-next 0/2] Expose netdev name in netdev netlink APIs Jakub Kicinski
2024-02-21 19:21   ` Joe Damato
2024-02-21 19:26     ` Jakub Kicinski
2024-02-21 19:29       ` Joe Damato

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).