From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: Paolo Abeni <pabeni@redhat.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: Fri, 20 Jun 2025 00:46:20 +0900 [thread overview]
Message-ID: <bc579418-646f-4ccc-bf9c-976b264c4da2@daynix.com> (raw)
In-Reply-To: <4e0a0a37-9164-465a-b18b-7d97c88d444e@redhat.com>
On 2025/06/19 23:52, Paolo Abeni wrote:
> On 6/19/25 4:42 PM, Akihiko Odaki wrote:
>> On 2025/06/18 1:12, Paolo Abeni wrote:
>>> @@ -1721,7 +1733,12 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
>>> if (tun->flags & IFF_VNET_HDR) {
>>> int vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz);
>>>
>>> - hdr_len = tun_vnet_hdr_get(vnet_hdr_sz, tun->flags, from, &gso);
>>> + if (vnet_hdr_sz >= TUN_VNET_TNL_SIZE)
>>> + features = NETIF_F_GSO_UDP_TUNNEL |
>>> + NETIF_F_GSO_UDP_TUNNEL_CSUM;
>>
>> I think you should use tun->set_features instead of tun->vnet_hdr_sz to
>> tell if these features are enabled.
>
> This is the guest -> host direction. tun->set_features refers to the
> opposite one. The problem is that tun is not aware of the features
> negotiated in the guest -> host direction.
>
> The current status (for baremetal/plain offload) is allowing any known
> feature the other side send - if the virtio header is consistent.
> This code follows a similar schema.
>
> Note that using 'tun->set_features' instead of 'vnet_hdr_sz' the tun
> driver will drop all the (legit) GSO over UDP packet sent by the guest
> when the VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO has been negotiated and
> VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO has not.
This explanation makes sense. In that case I suggest:
- creating a new function named tun_vnet_hdr_tnl_get() and
- passing vnet_hdr_sz to tun_vnet_hdr_tnl_to_skb()
tun_vnet.h contains the virtio-related logic for better code
organization and reuse with tap.c. tap.c can reuse the conditionals on
vnet_hdr_sz when tap.c gains the UDP tunneling support.
next prev parent reply other threads:[~2025-06-19 15:46 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 [this message]
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
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=bc579418-646f-4ccc-bf9c-976b264c4da2@daynix.com \
--to=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=pabeni@redhat.com \
--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).