[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <099a66e1-c271-488c-8997-daf07602d16b@gmail.com>
Date: Thu, 5 Jun 2025 21:25:03 +0700
From: Bui Quang Minh <minhquangbui99@...il.com>
To: Zvi Effron <zeffron@...tgames.com>
Cc: netdev@...r.kernel.org, "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio Pérez <eperezma@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>, virtualization@...ts.linux.dev,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH net] virtio-net: drop the multi-buffer XDP packet in
zerocopy
On 6/4/25 23:55, Zvi Effron wrote:
> On Tue, Jun 3, 2025 at 8:09 AM Bui Quang Minh <minhquangbui99@...il.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.
> Does it make more sense to return XDP_ABORTED? This seems like an unexpected
> exception case to me, but I'm not familiar enough with virtio-net's multibuffer
> support.
The following code after this treats XDP_DROP and XDP_ABORTED in the
same way. I don't have strong opinion between these 2 values here. We
may add a call to trace_xdp_exception in case we want XDP_ABORTED here.
Thanks,
Quang Minh.
>
>> Fixes: 99c861b44eb1 ("virtio_net: xsk: rx: support recv merge mode")
>> Cc: stable@...r.kernel.org
>> Signed-off-by: Bui Quang Minh <minhquangbui99@...il.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;
>> 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
>>
>>
Powered by blists - more mailing lists