Re: [PATCH net-next 8/8] vhost/net: enable gso over UDP tunnel support.
From: Jason Wang <jasowang@redhat.com>
Date: 2025-05-26 04:41:05
On Wed, May 21, 2025 at 6:34 PM Paolo Abeni [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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. Signed-off-by: Paolo Abeni <pabeni@redhat.com> --- drivers/vhost/net.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index b894685dded3e..985f9662a9003 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c@@ -78,7 +78,9 @@ enum { }; #ifdef VIRTIO_HAS_EXTENDED_FEATURES -#define VHOST_NET_FEATURES_EX VHOST_NET_FEATURES +#define VHOST_NET_FEATURES_EX (VHOST_NET_FEATURES | \ + (VIRTIO_BIT(VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO)) | \ + (VIRTIO_BIT(VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO))) #endif enum {@@ -1621,12 +1623,16 @@ static long vhost_net_reset_owner(struct vhost_net *n) static int vhost_net_set_features(struct vhost_net *n, virtio_features_t features) { size_t vhost_hlen, sock_hlen, hdr_len; + bool has_tunnel; int i; hdr_len = (features & ((1ULL << VIRTIO_NET_F_MRG_RXBUF) | (1ULL << VIRTIO_F_VERSION_1))) ? sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); + has_tunnel = !!(features & (VIRTIO_BIT(VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO) | + VIRTIO_BIT(VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO))); + hdr_len += has_tunnel ? sizeof(struct virtio_net_hdr_tunnel) : 0;
Same as patch 7, this seems to ignore the hash report fields. Thanks
if (features & (1 << VHOST_NET_F_VIRTIO_NET_HDR)) {
/* vhost provides vnet_hdr */
vhost_hlen = hdr_len;
--
2.49.0