From: Menglong Dong <menglong.dong@linux.dev>
To: menglong8.dong@gmail.com, Jakub Kicinski <kuba@kernel.org>
Cc: jasowang@redhat.com, mst@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com,
magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
sdf@fomichev.me, horms@kernel.org, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
bjorn@kernel.org, kerneljasonxing@gmail.com,
netdev@vger.kernel.org, virtualization@lists.linux.dev,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net-next 1/3] net: busy-poll: introduce sk_tx_busy_loop()
Date: Sun, 14 Jun 2026 18:12:46 +0800 [thread overview]
Message-ID: <TYn10tJ2SIGF1pAhF26DRQ@linux.dev> (raw)
In-Reply-To: <20260613112113.55d9313f@kernel.org>
On 2026/6/14 02:21, Jakub Kicinski wrote:
> On Thu, 11 Jun 2026 15:12:40 +0800 menglong8.dong@gmail.com wrote:
> > For now, we use sk_busy_loop() for both rx and tx path. The sk_busy_loop()
> > will call napi_busy_loop() for the specified napi_id. However, some
> > nic drivers have tx napi, such as virtio-net. In this case, sk_busy_loop()
> > doesn't work, as it can only schedule the NAPI for the rx queue.
> >
> > Therefore, introduce sk_tx_busy_loop() for the nic drivers that support tx
> > napi, which will schedule the tx napi if available.
>
> First, I thought the only difference with Tx NAPI is that it can't be
> busy polled. So if you want to poll an instance don't register it as
> a Tx one instead of adding all this "tx polling" stuff in the core?
I see. Register the tx NAPI with netif_napi_add_config() allow us
busy poll it. But we still have two NAPI instance: rx NAPI and tx NAPI.
sk_busy_loop() can only busy poll on one of them.
Before AF_XDP, we don't have the need to send packet via tx NAPI, which
means that we don't need to busy poll it.
I analyst some nic drivers on the implement of AF_XDP. Some of them
will check xsk tx ring of current queue and send the data in it in the
rx NAPI, such as mlx5. Some of them will allocate a extra "rxtx" NAPI
for the AF_XDP zero-copy queue, which will poll both the data receiving
and sending.
In the case about, they will do the data sending and receiving for the
AF_XDP in a single NAPI instance.
However, some driver receiving the data in rx NAPI and send data in
tx NAPI for AF_XDP. In this case, we can't use sk_busy_loop() for both
rx path and tx path, as we need to wake different NAPI instance.
>
> Second, can this problem happen for any other NIC or is it purely
> an artifact of virtio's delayed Tx completion handling?
According to my analysis, only virtio-net and ICSSG driver have
split NAPI for AF_XDP. I don't have a ICSSG nic, but the codex tell
me that it does have the same problem.
I'm not sure if it is a good idea to introduce the sk_tx_busy_loop().
Maybe we can modify the driver instead by using the same NAPI
for both data sending and receiving, just like others do. The
advantage of introduce sk_tx_busy_loop() is that we can split the
data sending and receiving, which maybe more efficient.
>
> Third, this series does not apply.
Ah, I'll rebase this series if a V2 is acceptable.
Thanks!
Menglong Dong
>
>
next prev parent reply other threads:[~2026-06-14 10:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 7:12 [PATCH net-next 0/3] xsk: support tx napi busy_poll menglong8.dong
2026-06-11 7:12 ` [PATCH net-next 1/3] net: busy-poll: introduce sk_tx_busy_loop() menglong8.dong
2026-06-12 7:13 ` sashiko-bot
2026-06-13 18:21 ` Jakub Kicinski
2026-06-14 10:12 ` Menglong Dong [this message]
2026-06-11 7:12 ` [PATCH net-next 2/3] virtio_net: initialize napi.tx_napi in virtnet_alloc_queues() menglong8.dong
2026-06-11 7:12 ` [PATCH net-next 3/3] xsk: replace sk_busy_loop with sk_tx_busy_loop in __xsk_sendmsg() menglong8.dong
2026-06-11 18:40 ` [PATCH net-next 0/3] xsk: support tx napi busy_poll Maciej Fijalkowski
2026-06-12 1:09 ` Menglong Dong
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=TYn10tJ2SIGF1pAhF26DRQ@linux.dev \
--to=menglong.dong@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=menglong8.dong@gmail.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.