[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <896749de-39b6-4081-91f3-1e316706a0e9@linux.alibaba.com>
Date: Wed, 24 Jan 2024 19:04:02 +0800
From: Heng Qi <hengqi@...ux.alibaba.com>
To: Liang Chen <liangchen.linux@...il.com>
Cc: virtualization@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
"Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Subject: Re: [PATCH v2 2/3] virtio_net: Add missing virtio header in skb for
XDP_PASS
在 2024/1/24 下午4:57, Liang Chen 写道:
> For the XDP_PASS scenario of the XDP path, the skb constructed with
> xdp_buff does not include the virtio header. Adding the virtio header
> information back when creating the skb.
>
> Signed-off-by: Liang Chen <liangchen.linux@...il.com>
> ---
> drivers/net/virtio_net.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index b56828804e5f..2de46eb4c661 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1270,6 +1270,9 @@ static struct sk_buff *receive_small_xdp(struct net_device *dev,
> if (unlikely(!skb))
> goto err;
>
> + /* Store the original virtio header for subsequent use by the driver. */
> + memcpy(skb_vnet_common_hdr(skb), &virtnet_xdp.hdr, vi->hdr_len);
If xdp push or xdp pull modifies xdp_buff, will the original header
still apply to the modified data?
Thanks,
Heng
> +
> if (metasize)
> skb_metadata_set(skb, metasize);
>
> @@ -1635,6 +1638,9 @@ static struct sk_buff *receive_mergeable_xdp(struct net_device *dev,
> head_skb = build_skb_from_xdp_buff(dev, vi, xdp, xdp_frags_truesz);
> if (unlikely(!head_skb))
> break;
> + /* Store the original virtio header for subsequent use by the driver. */
> + memcpy(skb_vnet_common_hdr(head_skb), &virtnet_xdp.hdr, vi->hdr_len);
> +
> return head_skb;
>
> case XDP_TX:
Powered by blists - more mailing lists