From: Tianyi Gao <tianyi@cloudflare.com>
To: netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, toke@redhat.com,
lorenzo@kernel.org, horms@kernel.org, shuah@kernel.org,
ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
john.fastabend@gmail.com, sdf@fomichev.me, joe@dama.to,
linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
kernel-team@cloudflare.com, tianyi.gao@linux.dev,
Tianyi Gao <tianyi@cloudflare.com>
Subject: [PATCH net-next v3 4/5] veth: use persistent NAPI config
Date: Sun, 15 Nov 2026 19:35:30 +0000 [thread overview]
Message-ID: <20261115193531.57679-5-tianyi@cloudflare.com> (raw)
In-Reply-To: <20261115193531.57679-1-tianyi@cloudflare.com>
veth deletes the NAPI instances on link down, when NAPI is no longer
needed for GRO or XDP, and when ethtool -L reduces the number of RX
queues. When veth adds them again, each queue gets a new NAPI ID and
loses its per-NAPI settings. An AF_XDP socket bound to the queue keeps
the old NAPI ID, so its busy polling stops.
Use netif_napi_add_config(), as Documentation/networking/napi.rst asks
drivers to do whenever possible. The queue then keeps its NAPI ID and
its settings. virtio_net made the same change in commit d5d715207e29
("virtio_net: Use persistent NAPI config").
Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
---
New in v3, as Sashiko suggested on v2 [1].
[1] https://lore.kernel.org/all/179470883411.2199510.13825316417997386083@kernel.org/
---
drivers/net/veth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 470c4f95e4a1..1c7ee3bf65f0 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1057,7 +1057,7 @@ static int veth_napi_enable_range(struct net_device *dev, int start, int end)
}
for (i = start; i < end; i++)
- netif_napi_add(dev, &priv->rq[i].xdp_napi, veth_poll);
+ netif_napi_add_config(dev, &priv->rq[i].xdp_napi, veth_poll, i);
for (i = start; i < end; i++) {
struct veth_rq *rq = &priv->rq[i];
--
2.56.0
next prev parent reply other threads:[~2026-11-15 19:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Tianyi Gao [this message]
2026-11-15 19:35 ` [PATCH net-next v3 5/5] selftests: net: veth: test that RX queues keep their NAPI IDs Tianyi Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261115193531.57679-5-tianyi@cloudflare.com \
--to=tianyi@cloudflare.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=joe@dama.to \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@cloudflare.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=tianyi.gao@linux.dev \
--cc=toke@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox