[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f5bb7b71-bae6-49c6-970d-869a59f11a1f@redhat.com>
Date: Thu, 19 Jun 2025 22:30:41 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Akihiko Odaki <akihiko.odaki@...nix.com>, netdev@...r.kernel.org
Cc: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Jason Wang <jasowang@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, "Michael S. Tsirkin" <mst@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
<eperezma@...hat.com>, Yuri Benditovich <yuri.benditovich@...nix.com>
Subject: Re: [PATCH v4 net-next 7/8] tun: enable gso over UDP tunnel support.
On 6/19/25 7:41 PM, Paolo Abeni wrote:
> On 6/19/25 6:02 PM, Akihiko Odaki wrote:
>> On 2025/06/18 1:12, Paolo Abeni wrote:
>>> @@ -2426,7 +2453,17 @@ static int tun_xdp_one(struct tun_struct *tun,
>>> if (metasize > 0)
>>> skb_metadata_set(skb, metasize);
>>>
>>> - if (tun_vnet_hdr_to_skb(tun->flags, skb, gso)) {
>>> + /*
>>> + * Assume tunnel offloads are enabled if the received hdr is large
>>> + * enough.
>>> + */
>>> + if (READ_ONCE(tun->vnet_hdr_sz) >= TUN_VNET_TNL_SIZE &&
>>> + xdp->data - xdp->data_hard_start >= TUN_VNET_TNL_SIZE)
>>> + features = NETIF_F_GSO_UDP_TUNNEL |
>>> + NETIF_F_GSO_UDP_TUNNEL_CSUM;
>>
>> xdp->data - xdp->data_hard_start may not represent the header size.
>>
>> struct tun_xdp_hdr is filled in vhost_net_build_xdp() in
>> drivers/vhost/net.c. This function sets the two fields with
>> xdp_prepare_buff(), but the arguments passed to xdp_prepare_buff() does
>> not seem to represent the exact size of the header.
>
> Indeed the xdp->data - xdp->data_hard_start range additionally contains
> some padding and eventually the xdp specific headroom. The problem is
> that both info are vhost_net specific and tun can't (or at least shoul)
> not be aware of them.
>
> The only IMHO feasible refinement could be using xdp->data_meta instead
> of xdp->data when available. Alternatively I could drop entirely the test.
As the vhost_net padding is considerably larger than the largest
possible vnet_hdr_sz, I'll drop entirely the xdp check - so that I can
use the newly introduced tun_vnet_hdr_guest_features() helper here, too.
/P
Powered by blists - more mailing lists