netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>,
	 Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	 netdev@vger.kernel.org
Cc: "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>,
	"Akihiko Odaki" <akihiko.odaki@daynix.com>
Subject: Re: [PATCH v4 net-next 7/8] tun: enable gso over UDP tunnel support.
Date: Fri, 20 Jun 2025 18:09:43 -0400	[thread overview]
Message-ID: <6855dc27a51d2_1ca4329428@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <81b7e1a5-3c7c-484d-a588-de67eb907bbf@redhat.com>

Paolo Abeni wrote:
> On 6/20/25 4:40 PM, Willem de Bruijn wrote:
> > Paolo Abeni wrote:
> >> @@ -1698,7 +1700,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
> >>  	struct sk_buff *skb;
> >>  	size_t total_len = iov_iter_count(from);
> >>  	size_t len = total_len, align = tun->align, linear;
> >> -	struct virtio_net_hdr gso = { 0 };
> >> +	struct virtio_net_hdr_v1_hash_tunnel hdr;
> > 
> > Not for this series.
> > 
> > But one day virtio will need a policy on how multiple optional
> > features can be composed, and simple APIs to get to those optional
> > headers. Perhaps something like skb extensions.
> > 
> > Now, each new extention means adding yet another struct and updating
> > all sites that access it.
> > 
> > A minimal rule may be that options can be entirely independent, but
> > if they exist at least their headers are always in a fixed order.
> > Which is already implied by the current extensions, i.e., hash comes
> > before tunnel if present.
> 
> If I read correctly, you are suggesting that negotiating tunnel and not
> hash would yield this layout:
> 
> < basic vnet hdr> <tnl fields>
> 
> with no gaps/data between the basic header fields and the tunnel-related
> one. Am I correct?
> 
> This has been discussed in the previous revisions, and a recent
> specification update explicitly states differently: with tunnel support
> and without hash report the only possible layout is:
> 
> < basic vnet hdr> <hash report field (unused)> <tnl fields>

Indeed. Long-term it seems odd to just keep extending the header with
every optional feature, even when disabled.

> Since it's in the spec it's too late to change it, unless we add yet
> another feature for that. I'm gladly leaving that joy and fun to someone
> else:)

Agreed!

> FTR the initial revisions of this series, before I stumbled upon the
> mentioned spec change, followed the schema you mentioned.
> 
> >> @@ -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;
> > 
> > Maybe a helper virtio_net_has_opt_tunnel(), to encapsulate whatever
> > conditions have to be met. As those conditions are not obvious.
> > 
> > Especially if needed in multiple locations. Not sure if that is the
> > case here, I have not checked that.
> 
> Yep, as an outcome of Ajihiko's review I'm encapsulation the above in
> a new helper - tun_vnet_hdr_guest_features() to be more generic.

Saw that. Awesome.
 
> >> @@ -2812,6 +2849,8 @@ static void tun_get_iff(struct tun_struct *tun, struct ifreq *ifr)
> >>  
> >>  }
> >>  
> >> +#define PLAIN_GSO (NETIF_F_GSO_UDP_L4 | NETIF_F_TSO | NETIF_F_TSO6)
> >> +
> > 
> > Minor/subjective: prefer const unsigned int at function scope over untyped
> > file scope macros.
> 
> Unless it's blocking I would keep the current code here.

Ack.

> >> +static inline int
> >> +tun_vnet_hdr_tnl_to_skb(unsigned int flags, netdev_features_t features,
> >> +			struct sk_buff *skb,
> >> +			const struct virtio_net_hdr_v1_hash_tunnel *hdr)
> >> +{
> >> +	return virtio_net_hdr_tnl_to_skb(skb, hdr,
> >> +					 !!(features & NETIF_F_GSO_UDP_TUNNEL),
> >> +					 !!(features & NETIF_F_GSO_UDP_TUNNEL_CSUM),
> > 
> > Double exclamation points not needed. Compiler does the right thing
> > when arguments are of type bool.
> 
> Will drop in the next revision.
> 
> Thanks!
> 
> Paolo
> 



  reply	other threads:[~2025-06-20 22:09 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
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 [this message]
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=6855dc27a51d2_1ca4329428@willemb.c.googlers.com.notmuch \
    --to=willemdebruijn.kernel@gmail.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=pabeni@redhat.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).