aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Abeni <[email protected]>2025-07-08 16:04:28 +0000
committerPaolo Abeni <[email protected]>2025-07-08 16:07:28 +0000
commitbbca931fce262cdb3e5fddcc39e62f3bf9ac25cc (patch)
tree23adb10dcad947afdd03a34910047fdf9d3f5de5
parenttun: enable gso over UDP tunnel support. (diff)
downloadkernel-bbca931fce262cdb3e5fddcc39e62f3bf9ac25cc.tar.gz
kernel-bbca931fce262cdb3e5fddcc39e62f3bf9ac25cc.zip
vhost/net: enable gso over UDP tunnel support.
Vhost net need to know the exact virtio net hdr size to be able to copy such header correctly. Teach it about the newly defined UDP tunnel-related option and update the hdr size computation accordingly. Acked-by: Jason Wang <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
-rw-r--r--drivers/vhost/net.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 67d011b0d4f7..a759d7776573 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -75,6 +75,8 @@ static const u64 vhost_net_features[VIRTIO_FEATURES_DWORDS] = {
(1ULL << VIRTIO_NET_F_MRG_RXBUF) |
(1ULL << VIRTIO_F_ACCESS_PLATFORM) |
(1ULL << VIRTIO_F_RING_RESET),
+ VIRTIO_BIT(VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO) |
+ VIRTIO_BIT(VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO),
};
enum {
@@ -1624,6 +1626,12 @@ static int vhost_net_set_features(struct vhost_net *n, const u64 *features)
sizeof(struct virtio_net_hdr_mrg_rxbuf) :
sizeof(struct virtio_net_hdr);
+ if (virtio_features_test_bit(features,
+ VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO) ||
+ virtio_features_test_bit(features,
+ VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO))
+ hdr_len = sizeof(struct virtio_net_hdr_v1_hash_tunnel);
+
if (virtio_features_test_bit(features, VHOST_NET_F_VIRTIO_NET_HDR)) {
/* vhost provides vnet_hdr */
vhost_hlen = hdr_len;