From: Jason Wang <jasowang@redhat.com>
To: Bui Quang Minh <minhquangbui99@gmail.com>
Cc: netdev@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net] virtio-net: drop the multi-buffer XDP packet in zerocopy
Date: Thu, 5 Jun 2025 08:46:16 +0800 [thread overview]
Message-ID: <CACGkMEvnn52XaidBdD9yGy8Yfpw3vu+QLcd8JoBSNS5ZEtmMqw@mail.gmail.com> (raw)
In-Reply-To: <0bc8547d-aa8f-4d96-9191-fd52d1bec74e@gmail.com>
On Wed, Jun 4, 2025 at 10:17 PM Bui Quang Minh <minhquangbui99@gmail.com> wrote:
>
> On 6/4/25 07:37, Jason Wang wrote:
> > On Tue, Jun 3, 2025 at 11:07 PM Bui Quang Minh <minhquangbui99@gmail.com> wrote:
> >> In virtio-net, we have not yet supported multi-buffer XDP packet in
> >> zerocopy mode when there is a binding XDP program. However, in that
> >> case, when receiving multi-buffer XDP packet, we skip the XDP program
> >> and return XDP_PASS. As a result, the packet is passed to normal network
> >> stack which is an incorrect behavior. This commit instead returns
> >> XDP_DROP in that case.
> >>
> >> Fixes: 99c861b44eb1 ("virtio_net: xsk: rx: support recv merge mode")
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
> >> ---
> >> drivers/net/virtio_net.c | 11 ++++++++---
> >> 1 file changed, 8 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> >> index e53ba600605a..4c35324d6e5b 100644
> >> --- a/drivers/net/virtio_net.c
> >> +++ b/drivers/net/virtio_net.c
> >> @@ -1309,9 +1309,14 @@ static struct sk_buff *virtnet_receive_xsk_merge(struct net_device *dev, struct
> >> ret = XDP_PASS;
> > It would be simpler to just assign XDP_DROP here?
> >
> > Or if you wish to stick to the way, we can simply remove this assignment.
>
> This XDP_PASS is returned for the case when there is no XDP program
> binding (!prog).
You're right.
Acked-by: Jason Wang <jasowang@redhat.com>
Thanks
>
> >
> >> rcu_read_lock();
> >> prog = rcu_dereference(rq->xdp_prog);
> >> - /* TODO: support multi buffer. */
> >> - if (prog && num_buf == 1)
> >> - ret = virtnet_xdp_handler(prog, xdp, dev, xdp_xmit, stats);
> >> + if (prog) {
> >> + /* TODO: support multi buffer. */
> >> + if (num_buf == 1)
> >> + ret = virtnet_xdp_handler(prog, xdp, dev, xdp_xmit,
> >> + stats);
> >> + else
> >> + ret = XDP_DROP;
> >> + }
> >> rcu_read_unlock();
> >>
> >> switch (ret) {
> >> --
> >> 2.43.0
> >>
> > Thanks
> >
>
>
> Thanks,
> Quang Minh.
>
>
next prev parent reply other threads:[~2025-06-05 0:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 15:06 [PATCH net] virtio-net: drop the multi-buffer XDP packet in zerocopy Bui Quang Minh
2025-06-04 0:37 ` Jason Wang
2025-06-04 14:17 ` Bui Quang Minh
2025-06-05 0:46 ` Jason Wang [this message]
2025-06-04 16:55 ` Zvi Effron
2025-06-05 14:25 ` Bui Quang Minh
2025-06-05 11:03 ` Paolo Abeni
2025-06-05 14:33 ` Bui Quang Minh
2025-06-05 14:48 ` Jakub Kicinski
2025-06-06 15:48 ` Bui Quang Minh
2025-06-09 16:58 ` Jakub Kicinski
2025-06-10 15:18 ` Bui Quang Minh
2025-06-10 20:37 ` Jakub Kicinski
2025-06-13 15:58 ` Bui Quang Minh
2025-06-13 1:51 ` Xuan Zhuo
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=CACGkMEvnn52XaidBdD9yGy8Yfpw3vu+QLcd8JoBSNS5ZEtmMqw@mail.gmail.com \
--to=jasowang@redhat.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@google.com \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minhquangbui99@gmail.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--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 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).