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