From: Paolo Abeni <pabeni@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>, netdev@vger.kernel.org
Cc: "Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
"Jason Wang" <jasowang@redhat.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Yuri Benditovich" <yuri.benditovich@daynix.com>
Subject: Re: [PATCH v4 net-next 7/8] tun: enable gso over UDP tunnel support.
Date: Thu, 19 Jun 2025 22:30:41 +0200 [thread overview]
Message-ID: <f5bb7b71-bae6-49c6-970d-869a59f11a1f@redhat.com> (raw)
In-Reply-To: <0aa1055e-3e52-4275-a074-e6f27115a748@redhat.com>
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
next prev parent reply other threads:[~2025-06-19 20:30 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 16:12 [PATCH v4 net-next 0/8] virtio: introduce GSO over UDP tunnel Paolo Abeni
2025-06-17 16:12 ` [PATCH v4 net-next 1/8] virtio: introduce extended features Paolo Abeni
2025-06-18 1:51 ` Jason Wang
2025-06-18 8:31 ` Paolo Abeni
2025-06-19 2:14 ` Jakub Kicinski
2025-06-19 14:36 ` Paolo Abeni
2025-06-19 15:22 ` Jakub Kicinski
2025-06-17 16:12 ` [PATCH v4 net-next 2/8] virtio_pci_modern: allow configuring " Paolo Abeni
2025-06-18 2:27 ` Jason Wang
2025-06-19 14:56 ` Paolo Abeni
2025-06-17 16:12 ` [PATCH v4 net-next 3/8] vhost-net: " Paolo Abeni
2025-06-19 15:00 ` Akihiko Odaki
2025-06-19 20:13 ` Paolo Abeni
2025-06-20 5:59 ` Akihiko Odaki
2025-06-17 16:12 ` [PATCH v4 net-next 4/8] virtio_net: add supports for extended offloads Paolo Abeni
2025-06-18 2:36 ` Jason Wang
2025-06-17 16:12 ` [PATCH v4 net-next 5/8] net: implement virtio helpers to handle UDP GSO tunneling Paolo Abeni
2025-06-18 4:08 ` Jason Wang
2025-06-19 14:59 ` Paolo Abeni
2025-06-17 16:12 ` [PATCH v4 net-next 6/8] virtio_net: enable gso over UDP tunnel support Paolo Abeni
2025-06-18 4:15 ` Jason Wang
2025-06-17 16:12 ` [PATCH v4 net-next 7/8] tun: " Paolo Abeni
2025-06-18 4:15 ` Jason Wang
2025-06-19 14:42 ` Akihiko Odaki
2025-06-19 14:52 ` Paolo Abeni
2025-06-19 15:46 ` Akihiko Odaki
2025-06-19 17:27 ` Paolo Abeni
2025-06-21 5:00 ` Akihiko Odaki
2025-06-19 16:02 ` Akihiko Odaki
2025-06-19 17:41 ` Paolo Abeni
2025-06-19 20:30 ` Paolo Abeni [this message]
2025-06-21 5:04 ` Akihiko Odaki
2025-06-24 0:55 ` Jason Wang
2025-06-20 14:40 ` Willem de Bruijn
2025-06-20 15:51 ` Paolo Abeni
2025-06-20 22:09 ` Willem de Bruijn
2025-06-17 16:12 ` [PATCH v4 net-next 8/8] vhost/net: " Paolo Abeni
2025-06-18 4:15 ` Jason Wang
2025-06-17 19:58 ` [PATCH v4 net-next 0/8] virtio: introduce GSO over UDP tunnel Michael S. Tsirkin
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=f5bb7b71-bae6-49c6-970d-869a59f11a1f@redhat.com \
--to=pabeni@redhat.com \
--cc=akihiko.odaki@daynix.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=willemdebruijn.kernel@gmail.com \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yuri.benditovich@daynix.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).