linux/net
Daniel Borkmann 9e2103f361 net: Add lease info to queue-get response
Populate nested lease info to the queue-get response that returns the
ifindex, queue id with type and optionally netns id if the device
resides in a different netns.

Example with ynl client:

  # ip a
  [...]
  4: enp10s0f0np0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdp/id:24 qdisc mq state UP group default qlen 1000
    link/ether e8:eb:d3:a3:43:f6 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.2/24 scope global enp10s0f0np0
       valid_lft forever preferred_lft forever
    inet6 fe80::eaeb:d3ff:fea3:43f6/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
  [...]

  # ethtool -i enp10s0f0np0
  driver: mlx5_core
  [...]

  # ./pyynl/cli.py \
      --spec ~/netlink/specs/netdev.yaml \
      --do queue-get \
      --json '{"ifindex": 4, "id": 15, "type": "rx"}'
  {'id': 15,
   'ifindex': 4,
   'lease': {'ifindex': 8, 'netns-id': 0, 'queue': {'id': 1, 'type': 'rx'}},
   'napi-id': 8227,
   'type': 'rx',
   'xsk': {}}

  # ip netns list
  foo (id: 0)

  # ip netns exec foo ip a
  [...]
  8: nk@NONE: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
      link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::200:ff:fe00:0/64 scope link proto kernel_ll
         valid_lft forever preferred_lft forever
  [...]

  # ip netns exec foo ethtool -i nk
  driver: netkit
  [...]

  # ip netns exec foo ls /sys/class/net/nk/queues/
  rx-0  rx-1  tx-0

  # ip netns exec foo ./pyynl/cli.py \
      --spec ~/netlink/specs/netdev.yaml \
      --do queue-get \
      --json '{"ifindex": 8, "id": 1, "type": "rx"}'
  {'id': 1, 'ifindex': 8, 'type': 'rx'}

Note that the caller of netdev_nl_queue_fill_one() holds the netdevice
lock. For the queue-get we do not lock both devices. When queues get
{un,}leased, both devices are locked, thus if __netif_get_rx_queue_peer()
returns true, the peer pointer points to a valid device. The netns-id
is fetched via peernet2id_alloc() similarly as done in OVS.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Co-developed-by: David Wei <dw@davidwei.uk>
Signed-off-by: David Wei <dw@davidwei.uk>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260115082603.219152-4-daniel@iogearbox.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-01-20 11:58:49 +01:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth Bluetooth: hci_sync: enable PA Sync Lost event 2026-01-09 16:03:57 -05:00
bpf bpf: Fix reference count leak in bpf_prog_test_run_xdp() 2026-01-12 16:37:40 -08:00
bridge net: bridge: annotate data-races around fdb->{updated,used} 2026-01-09 17:36:21 -08:00
caif
can net: can: j1939: j1939_xtp_rx_rts_session_active(): deactivate session upon receiving the second rts 2026-01-15 09:52:39 +01:00
ceph libceph: make calc_target() set t->paused, not just clear it 2026-01-06 00:39:43 +01:00
core net: Add lease info to queue-get response 2026-01-20 11:58:49 +01:00
dcb
devlink
dns_resolver
dsa net: dsa: fix missing put_device() in dsa_tree_find_first_conduit() 2025-12-23 10:32:08 +01:00
ethernet
ethtool net: phy: Introduce PHY ports representation 2026-01-13 18:52:34 -08:00
handshake net/handshake: Fix null-ptr-deref in handshake_complete() 2025-12-22 12:36:40 +01:00
hsr
ieee802154
ife
ipv4 tcp: move tcp_rate_skb_sent() to tcp_output.c 2026-01-17 15:43:16 -08:00
ipv6 ipv6: annotate data-races in net/ipv6/route.c 2026-01-19 09:56:43 -08:00
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211 First set of changes for the current -next cycle, of note: 2026-01-12 17:02:02 -08:00
mac802154
mctp
mpls
mptcp mptcp: ensure context reset on disconnect() 2025-12-23 09:12:25 +01:00
ncsi
netfilter netfilter: nf_conncount: update last_gc only when GC has been performed 2026-01-02 10:44:28 +01:00
netlabel
netlink
netrom
nfc net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write 2025-12-28 09:15:42 +01:00
nsh
openvswitch net: openvswitch: Avoid needlessly taking the RTNL on vport destroy 2025-12-22 12:25:11 +01:00
packet
phonet
psample
psp
qrtr
rds net/rds: Give each connection path its own workqueue 2026-01-13 12:27:03 +01:00
rfkill
rose net: rose: fix invalid array index in rose_kill_by_device() 2025-12-30 11:45:51 +01:00
rxrpc
sched net/sched: cake: avoid separate allocation of struct cake_sched_config 2026-01-17 15:30:28 -08:00
sctp sctp: Clear inet_opt in sctp_v6_copy_ip_options(). 2025-12-18 16:18:00 +01:00
shaper
smc
strparser
sunrpc nfsd-6.19 fixes: 2025-12-24 09:23:04 -08:00
switchdev
tipc
tls
unix net: do not write to msg_get_inq in callee 2026-01-08 08:45:13 -08:00
vmw_vsock vsock: Make accept()ed sockets use custom setsockopt() 2026-01-05 16:14:50 -08:00
wireless First set of changes for the current -next cycle, of note: 2026-01-12 17:02:02 -08:00
x25
xdp net: Implement netdev_nl_queue_create_doit 2026-01-20 11:58:49 +01:00
xfrm xfrm: set ipv4 no_pmtu_disc flag only on output sa when direction is set 2025-12-15 11:06:25 +01:00
Kconfig
Kconfig.debug
Makefile
compat.c
devres.c
socket.c
sysctl_net.c