Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] veth: link RX queues to their NAPI instances
@ 2026-11-05 14:33 Tianyi Gao
  2026-11-05 14:33 ` [PATCH net-next 1/3] veth: refactor NAPI enable paths Tianyi Gao
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tianyi Gao @ 2026-11-05 14:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, toke, lorenzo,
	horms, bpf, shuah, hawk, kernel-team, ast, daniel, john.fastabend,
	sdf, linux-kselftest, jiayuan.chen, Tianyi Gao

veth does not link its RX queues to their NAPI instances. queue-get
therefore reports no napi-id for them. napi-get lists the NAPI instances
of a veth, and their thread PIDs when NAPI is threaded. It does not show
which RX queue each instance polls. Userspace cannot tell which NAPI
thread to pin for a given queue, or which NAPI to change with napi-set.

There is also no way to busy poll an AF_XDP socket bound to a veth
queue. xsk_bind() takes the socket's NAPI ID from the RX queue, and a
veth RX queue has none.

Patch 1 is a cleanup to ease review of patch 2. veth_enable_xdp_range()
adds the NAPI instances only to pass their napi_id to
xdp_rxq_info_reg(), which no longer uses it. Patch 1 moves
netif_napi_add() into the loop that enables the NAPI instances. It also
removes the arguments and wrappers that came with adding the NAPI
instances in two places.

Patch 2 calls netif_queue_set_napi() in veth_napi_enable_range(), after
napi_enable(). In veth_napi_del_range(), it clears the link with NULL
before napi_disable().

Patch 3 adds RX queue NAPI link checks to veth.sh. The napi-id of every
RX queue must match a NAPI instance of the device. The queues must be
linked only while NAPI is enabled. The checks run with GRO on and with
XDP attached, and across RX channel changes and link down/up.

---
While working on patch 1, I noticed a pre-existing race in
veth_disable_xdp(). Jakub already pointed it out in [1] and suggested
fixing it as part of Jiayuan's series. This series only drops an
argument on that path. It does not depend on that fix. If the fix does
not end up there, I can send a separate patch for it.

[1] https://lore.kernel.org/all/20260917185814.0f944e78@kernel.org/

Tianyi Gao (3):
  veth: refactor NAPI enable paths
  veth: link RX queues to their NAPI instances
  selftests: net: veth: test RX queue NAPI links

 drivers/net/veth.c                  | 83 ++++++++---------------------
 tools/testing/selftests/net/veth.sh | 79 ++++++++++++++++++++++++++-
 2 files changed, 99 insertions(+), 63 deletions(-)


base-commit: 0822d2fe38262e8b55c5ea55c970022bca8dd2a9
-- 
2.56.0


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

end of thread, other threads:[~2026-11-05 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05 14:33 [PATCH net-next 0/3] veth: link RX queues to their NAPI instances Tianyi Gao
2026-11-05 14:33 ` [PATCH net-next 1/3] veth: refactor NAPI enable paths Tianyi Gao
2026-11-05 14:33 ` [PATCH net-next 2/3] veth: link RX queues to their NAPI instances Tianyi Gao
2026-11-05 14:33 ` [PATCH net-next 3/3] selftests: net: veth: test RX queue NAPI links Tianyi Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox