[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <179b050d-52b0-7201-9b1c-702d0978d496@redhat.com>
Date: Wed, 21 Apr 2021 10:18:43 +0800
From: Jason Wang <jasowang@...hat.com>
To: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
Guenter Roeck <linux@...ck-us.net>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH net-next] virtio-net: restrict build_skb() use to some
arches
在 2021/4/21 上午4:01, Eric Dumazet 写道:
> From: Eric Dumazet <edumazet@...gle.com>
>
> build_skb() is supposed to be followed by
> skb_reserve(skb, NET_IP_ALIGN), so that IP headers are word-aligned.
> (Best practice is to reserve NET_IP_ALIGN+NET_SKB_PAD, but the NET_SKB_PAD
> part is only a performance optimization if tunnel encaps are added.)
>
> Unfortunately virtio_net has not provisioned this reserve.
> We can only use build_skb() for arches where NET_IP_ALIGN == 0
>
> We might refine this later, with enough testing.
>
> Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Reported-by: Guenter Roeck <linux@...ck-us.net>
> Cc: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> Cc: Jason Wang <jasowang@...hat.com>
> Cc: "Michael S. Tsirkin" <mst@...hat.com>
> Cc: virtualization@...ts.linux-foundation.org
Acked-by: Jason Wang <jasowang@...hat.com>
> ---
> drivers/net/virtio_net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 2e28c04aa6351d2b4016f7d277ce104c4970069d..74d2d49264f3f3b7039be70331d4a44c53b8cc28 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -416,7 +416,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
>
> shinfo_size = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
>
> - if (len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
> + if (!NET_IP_ALIGN && len > GOOD_COPY_LEN && tailroom >= shinfo_size) {
> skb = build_skb(p, truesize);
> if (unlikely(!skb))
> return NULL;
Powered by blists - more mailing lists