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, and the kernel side of the implementation has been merged into the net-next tree; this series updates the virtio implementation to support such a feature. Currently the qemu virtio support limits the features space to 64 bits, 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 larger part of this series (patches 3-11) actually deals with extending the features space. The extended features are carried by fixed size uint64_t arrays, bringing the current maximum features number to 128. The patches use some syntactic sugar to try to minimize the otherwise very large code churn. Specifically the extended features are boundled in an union with 'legacy' features definition, allowing no changes in the virtio devices not needing the extended features set. The actual offload implementation is in patches 12 and 13 and boils down to propagating the new offload to the tun devices and the vhost backend. Finally patch 1 is a small pre-req refactor that ideally could enter the tree separately; it's presented here in the same series to help reviewers more easily getting the full picture and patch 2 is a needed linux headers update. Tested with basic stream transfer with all the possible permutations of host kernel/qemu/guest kernel with/without GSO over UDP tunnel support, vs snapshots creation and restore and vs migration. Sharing again as RFC as the kernel bits have not entered the Linus tree yet - but they should on next merge window. --- v2 -> v3: - consolidated suffixes for new fields to '_ex' - avoid pre/post load trickery and relay on reset zeroing the features - cleaned-up virtio store implementation deduplicating a bit of code - many more cleanups, see the individual patches changelog for the details - I left patch 1 unmodified, still some hope we could live with that;) Paolo Abeni (13): net: bundle all offloads in a single struct linux-headers: Update to Linux ~v6.16-rc5 net-next virtio: introduce extended features type virtio: serialize extended features state virtio: add support for negotiating extended features virtio-pci: implement support for extended features vhost: add support for negotiating extended features qmp: update virtio features map to support extended features vhost-backend: implement extended features support vhost-net: implement extended features support virtio-net: implement extended features support net: implement tunnel probing net: implement UDP tunnel features offloading hw/net/e1000e_core.c | 5 +- hw/net/igb_core.c | 5 +- hw/net/vhost_net-stub.c | 8 +- hw/net/vhost_net.c | 46 ++-- hw/net/virtio-net.c | 226 +++++++++++++------ hw/net/vmxnet3.c | 13 +- hw/virtio/vhost-backend.c | 62 ++++- hw/virtio/vhost.c | 73 +++++- hw/virtio/virtio-bus.c | 11 +- hw/virtio/virtio-hmp-cmds.c | 3 +- hw/virtio/virtio-pci.c | 54 ++++- hw/virtio/virtio-qmp.c | 89 +++++--- hw/virtio/virtio-qmp.h | 3 +- hw/virtio/virtio.c | 102 ++++++--- include/hw/virtio/vhost-backend.h | 6 + include/hw/virtio/vhost.h | 33 ++- include/hw/virtio/virtio-features.h | 123 ++++++++++ include/hw/virtio/virtio-net.h | 2 +- include/hw/virtio/virtio-pci.h | 2 +- include/hw/virtio/virtio.h | 11 +- include/net/net.h | 20 +- include/net/vhost_net.h | 33 ++- include/standard-headers/linux/ethtool.h | 4 +- include/standard-headers/linux/vhost_types.h | 5 + include/standard-headers/linux/virtio_net.h | 33 +++ linux-headers/linux/vhost.h | 7 + net/net.c | 17 +- net/netmap.c | 3 +- net/tap-bsd.c | 8 +- net/tap-linux.c | 38 +++- net/tap-linux.h | 9 + net/tap-solaris.c | 9 +- net/tap-stub.c | 8 +- net/tap.c | 21 +- net/tap_int.h | 5 +- qapi/virtio.json | 8 +- 36 files changed, 857 insertions(+), 248 deletions(-) create mode 100644 include/hw/virtio/virtio-features.h -- 2.50.0