* [PATCH net v2] xsk: Bring back busy polling support in XDP_COPY
@ 2025-05-16 21:36 Samiullah Khawaja
2025-05-16 22:00 ` Stanislav Fomichev
2025-05-21 9:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Samiullah Khawaja @ 2025-05-16 21:36 UTC (permalink / raw)
To: Jakub Kicinski, David S . Miller , Eric Dumazet, Paolo Abeni,
almasrymina, willemb, stfomichev
Cc: netdev, skhawaja
Commit 5ef44b3cb43b ("xsk: Bring back busy polling support") fixed the
busy polling support in xsk for XDP_ZEROCOPY after it was broken in
commit 86e25f40aa1e ("net: napi: Add napi_config"). The busy polling
support with XDP_COPY remained broken since the napi_id setup in
xsk_rcv_check was removed.
Bring back the setup of napi_id for XDP_COPY so socket level SO_BUSYPOLL
can be used to poll the underlying napi.
Do the setup of napi_id for XDP_COPY in xsk_bind, as it is done
currently for XDP_ZEROCOPY. The setup of napi_id for XDP_COPY in
xsk_bind is safe because xsk_rcv_check checks that the rx queue at which
the packet arrives is equal to the queue_id that was supplied in bind.
This is done for both XDP_COPY and XDP_ZEROCOPY mode.
Tested using AF_XDP support in virtio-net by running the xsk_rr AF_XDP
benchmarking tool shared here:
https://lore.kernel.org/all/20250320163523.3501305-1-skhawaja@google.com/T/
Enabled socket busy polling using following commands in qemu,
```
sudo ethtool -L eth0 combined 1
echo 400 | sudo tee /proc/sys/net/core/busy_read
echo 100 | sudo tee /sys/class/net/eth0/napi_defer_hard_irqs
echo 15000 | sudo tee /sys/class/net/eth0/gro_flush_timeout
```
Fixes: 5ef44b3cb43b ("xsk: Bring back busy polling support")
Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
---
v2:
- Mark Napi ID in xsk_bind for XDP_COPY.
v1:
https://lore.kernel.org/netdev/Z-Lby6WMFkHaaJxB@mini-arch/T/#mdd713c1e2b0caf3bb5f625884709af95e30ccc4d
net/xdp/xsk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 4abc81f33d3e..72c000c0ae5f 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -1304,7 +1304,7 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
xs->queue_id = qid;
xp_add_xsk(xs->pool, xs);
- if (xs->zc && qid < dev->real_num_rx_queues) {
+ if (qid < dev->real_num_rx_queues) {
struct netdev_rx_queue *rxq;
rxq = __netif_get_rx_queue(dev, qid);
--
2.49.0.1112.g889b7c5bd8-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net v2] xsk: Bring back busy polling support in XDP_COPY
2025-05-16 21:36 [PATCH net v2] xsk: Bring back busy polling support in XDP_COPY Samiullah Khawaja
@ 2025-05-16 22:00 ` Stanislav Fomichev
2025-05-21 9:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Stanislav Fomichev @ 2025-05-16 22:00 UTC (permalink / raw)
To: Samiullah Khawaja
Cc: Jakub Kicinski, David S . Miller , Eric Dumazet, Paolo Abeni,
almasrymina, willemb, netdev
On 05/16, Samiullah Khawaja wrote:
> Commit 5ef44b3cb43b ("xsk: Bring back busy polling support") fixed the
> busy polling support in xsk for XDP_ZEROCOPY after it was broken in
> commit 86e25f40aa1e ("net: napi: Add napi_config"). The busy polling
> support with XDP_COPY remained broken since the napi_id setup in
> xsk_rcv_check was removed.
>
> Bring back the setup of napi_id for XDP_COPY so socket level SO_BUSYPOLL
> can be used to poll the underlying napi.
>
> Do the setup of napi_id for XDP_COPY in xsk_bind, as it is done
> currently for XDP_ZEROCOPY. The setup of napi_id for XDP_COPY in
> xsk_bind is safe because xsk_rcv_check checks that the rx queue at which
> the packet arrives is equal to the queue_id that was supplied in bind.
> This is done for both XDP_COPY and XDP_ZEROCOPY mode.
>
> Tested using AF_XDP support in virtio-net by running the xsk_rr AF_XDP
> benchmarking tool shared here:
> https://lore.kernel.org/all/20250320163523.3501305-1-skhawaja@google.com/T/
>
> Enabled socket busy polling using following commands in qemu,
>
> ```
> sudo ethtool -L eth0 combined 1
> echo 400 | sudo tee /proc/sys/net/core/busy_read
> echo 100 | sudo tee /sys/class/net/eth0/napi_defer_hard_irqs
> echo 15000 | sudo tee /sys/class/net/eth0/gro_flush_timeout
> ```
>
> Fixes: 5ef44b3cb43b ("xsk: Bring back busy polling support")
> Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Looks good to me. But note that I never understood why those __sk_mark_napi_id_once
calls were there in the receive path in the first place. Presumably
because of the unstable napi ids. Now, with the napi config, it should
be safe to resolve both copy/non-copy modes during the bind.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net v2] xsk: Bring back busy polling support in XDP_COPY
2025-05-16 21:36 [PATCH net v2] xsk: Bring back busy polling support in XDP_COPY Samiullah Khawaja
2025-05-16 22:00 ` Stanislav Fomichev
@ 2025-05-21 9:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-21 9:30 UTC (permalink / raw)
To: Samiullah Khawaja
Cc: kuba, davem, edumazet, pabeni, almasrymina, willemb, stfomichev,
netdev
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Fri, 16 May 2025 21:36:38 +0000 you wrote:
> Commit 5ef44b3cb43b ("xsk: Bring back busy polling support") fixed the
> busy polling support in xsk for XDP_ZEROCOPY after it was broken in
> commit 86e25f40aa1e ("net: napi: Add napi_config"). The busy polling
> support with XDP_COPY remained broken since the napi_id setup in
> xsk_rcv_check was removed.
>
> Bring back the setup of napi_id for XDP_COPY so socket level SO_BUSYPOLL
> can be used to poll the underlying napi.
>
> [...]
Here is the summary with links:
- [net,v2] xsk: Bring back busy polling support in XDP_COPY
https://git.kernel.org/netdev/net/c/b95ed5517354
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-21 9:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-16 21:36 [PATCH net v2] xsk: Bring back busy polling support in XDP_COPY Samiullah Khawaja
2025-05-16 22:00 ` Stanislav Fomichev
2025-05-21 9:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).