Thread (39 messages) 39 messages, 7 authors, 2025-06-24

Re: [PATCH v4 net-next 7/8] tun: enable gso over UDP tunnel support.

From: Paolo Abeni <pabeni@redhat.com>
Date: 2025-06-19 14:53:03

On 6/19/25 4:42 PM, Akihiko Odaki wrote:
On 2025/06/18 1:12, Paolo Abeni wrote:
quoted
@@ -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.

/P
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help