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

veth does not link its RX queues to their NAPI instances, so queue-get
reports no napi-id for them. napi-get lists each NAPI instance, and its
thread PID when NAPI is threaded, but not the RX queue it 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 veth_napi_enable_range(), before the loop that
enables the NAPI instances. It also drops the napi_already_on and
delete_napi arguments and two wrappers.

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-ids of the
RX queues must be the IDs of the NAPI instances 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.

Patch 4 uses netif_napi_add_config(). veth deletes the NAPI instance of
an RX queue when it no longer needs it. With a persistent NAPI config,
the queue keeps its NAPI ID and settings when veth adds the instance
again.

Patch 5 adds checks to veth.sh that each RX queue keeps its NAPI ID.

---
Changes in v3:
- Patch 1: add all NAPI instances before enabling any, as before the
  series (Sashiko [1]).
- Patch 3: reword the commit message. No code change.
- New patch 4: use netif_napi_add_config() (Sashiko [2]).
- New patch 5: check that each RX queue keeps its NAPI ID.
- v2: https://lore.kernel.org/all/20261111015922.67745-1-tianyi@cloudflare.com/

[1] https://lore.kernel.org/all/179470883254.2199510.15270739408094114749@kernel.org/
[2] https://lore.kernel.org/all/179470883411.2199510.13825316417997386083@kernel.org/

Changes in v2:
- Rebase on net-next. Patch 3 no longer applied after commit
  c1f04ea0aa0f ("selftests: net: check veth carrier after changing
  channel counts"). The conflict is in context only. No code change.
- v1: https://lore.kernel.org/all/20261105143356.17062-1-tianyi@cloudflare.com/

Tianyi Gao (5):
  veth: refactor NAPI enable paths
  veth: link RX queues to their NAPI instances
  selftests: net: veth: test RX queue NAPI links
  veth: use persistent NAPI config
  selftests: net: veth: test that RX queues keep their NAPI IDs

 drivers/net/veth.c                  |  85 ++++++----------------
 tools/testing/selftests/net/veth.sh | 108 +++++++++++++++++++++++++++-
 2 files changed, 130 insertions(+), 63 deletions(-)


base-commit: 6964ff21c5d8b75649211a52dbfd92753e605649
-- 
2.56.0


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

end of thread, other threads:[~2026-11-15 19:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 19:35 [PATCH net-next v3 0/5] veth: link RX queues to their NAPI instances Tianyi Gao
2026-11-15 19:35 ` [PATCH net-next v3 1/5] veth: refactor NAPI enable paths Tianyi Gao
2026-11-15 19:35 ` [PATCH net-next v3 2/5] veth: link RX queues to their NAPI instances Tianyi Gao
2026-11-15 19:35 ` [PATCH net-next v3 3/5] selftests: net: veth: test RX queue NAPI links Tianyi Gao
2026-11-15 19:35 ` [PATCH net-next v3 4/5] veth: use persistent NAPI config Tianyi Gao
2026-11-15 19:35 ` [PATCH net-next v3 5/5] selftests: net: veth: test that RX queues keep their NAPI IDs Tianyi Gao

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