tun: enable gso over UDP tunnel support.
authorPaolo Abeni <pabeni@redhat.com>
Tue, 8 Jul 2025 15:55:30 +0000 (17:55 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 8 Jul 2025 16:07:26 +0000 (18:07 +0200)
commit288f30435132d2f9e7a29ec9b9745a4f9dc7fd37
treeeef1c5c86a5743e739ba4a80952c8ec26728c78b
parent56a06bd40fab64448aa6b84aa06b3dc470c1254a
tun: enable gso over UDP tunnel support.

Add new tun features to represent the newly introduced virtio
GSO over UDP tunnel offload. Allows detection and selection of
such features via the existing TUNSETOFFLOAD ioctl and compute
the expected virtio header size and tunnel header offset using
the current netdev features, so that we can plug almost seamless
the newly introduced virtio helpers to serialize the extended
virtio header.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
v6 -> v7:
  - rebased

v4 -> v5:
  - encapsulate the guest feature guessing in a tun helper
  - dropped irrelevant check on xdp buff headroom
  - do not remove unrelated black line
  - avoid line len > 80 char

v3 -> v4:
  - virtio tnl-related fields are at fixed offset, cleanup
    the code accordingly.
  - use netdev features instead of flags bit to check for
    the configured offload
  - drop packet in case of enabled features/configured hdr
    size mismatch

v2 -> v3:
  - cleaned-up uAPI comments
  - use explicit struct layout instead of raw buf.
drivers/net/tun.c
drivers/net/tun_vnet.h
include/uapi/linux/if_tun.h