]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge branch 'virtio_udp_tunnel_08_07_2025' of https://github.com/pabeni/linux-devel
authorJakub Kicinski <kuba@kernel.org>
Thu, 10 Jul 2025 20:32:35 +0000 (13:32 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Jul 2025 20:32:35 +0000 (13:32 -0700)
Paolo Abeni says:

====================
virtio: introduce GSO over UDP tunnel

Some virtualized deployments use UDP tunnel pervasively and are impacted
negatively by the lack of GSO support for such kind of traffic in the
virtual NIC driver.

The virtio_net specification recently introduced support for GSO over
UDP tunnel, this series updates the virtio implementation to support
such a feature.

Currently the kernel virtio support limits the feature space to 64,
while the virtio specification allows for a larger number of features.
Specifically the GSO-over-UDP-tunnel-related virtio features use bits
65-69.

The first four patches in this series rework the virtio and vhost
feature support to cope with up to 128 bits. The limit is set by
a define and could be easily raised in future, as needed.

This implementation choice is aimed at keeping the code churn as
limited as possible. For the same reason, only the virtio_net driver is
reworked to leverage the extended feature space; all other
virtio/vhost drivers are unaffected, but could be upgraded to support
the extended features space in a later time.

The last four patches bring in the actual GSO over UDP tunnel support.
As per specification, some additional fields are introduced into the
virtio net header to support the new offload. The presence of such
fields depends on the negotiated features.

New helpers are introduced to convert the UDP-tunneled skb metadata to
an extended virtio net header and vice versa. Such helpers are used by
the tun and virtio_net driver to cope with the newly supported offloads.

Tested with basic stream transfer with all the possible permutations of
host kernel/qemu/guest kernel with/without GSO over UDP tunnel support.
====================

Link: https://patch.msgid.link/cover.1751874094.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1  2 
drivers/net/tun.c
drivers/net/virtio_net.c
drivers/vhost/net.c

index 447c379595049dff36ffd6e4f3a2ad1c24f38377,abc91f28dac42fbbe269aa7d93085aeb46f49a59..49bcd12a4ac84b4100ae0870a81b2b2738c2e07c
@@@ -2356,12 -2378,15 +2378,14 @@@ static int tun_xdp_one(struct tun_struc
                       struct tun_page *tpage)
  {
        unsigned int datasize = xdp->data_end - xdp->data;
 -      struct tun_xdp_hdr *hdr = xdp->data_hard_start;
 +      struct virtio_net_hdr *gso = xdp->data_hard_start;
+       struct virtio_net_hdr_v1_hash_tunnel *tnl_hdr;
 -      struct virtio_net_hdr *gso = &hdr->gso;
        struct bpf_prog *xdp_prog;
        struct sk_buff *skb = NULL;
        struct sk_buff_head *queue;
+       netdev_features_t features;
        u32 rxhash = 0, act;
 -      int buflen = hdr->buflen;
 +      int buflen = xdp->frame_sz;
        int metasize = 0;
        int ret = 0;
        bool skb_xdp = false;
Simple merge
Simple merge