[PATCH RFC 16/16] net: make vhost-net aware of GSO over UDP tunnel hdr layout

Paolo Abeni posted 16 patches 5 months, 4 weeks ago
There is a newer version of this series
[PATCH RFC 16/16] net: make vhost-net aware of GSO over UDP tunnel hdr layout
Posted by Paolo Abeni 5 months, 4 weeks ago
When the GSO over UDP tunnel offload is enabled, the virtio net
header includes additional fields to support such offload.

The vhost backend must be aware of the exact header layout, to
copy it correctly. The tunnel-related field are present if either
the guest or the host negotiated any UDP tunnel related feature:
add them to host kernel supported features list, to allow qemu
transder to such backend the needed information.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 hw/net/vhost_net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 58d7619fc8..c8e02d1732 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -52,6 +52,10 @@ static const int kernel_feature_bits[] = {
     VIRTIO_F_NOTIFICATION_DATA,
     VIRTIO_NET_F_RSC_EXT,
     VIRTIO_NET_F_HASH_REPORT,
+#ifdef CONFIG_INT128
+    VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO,
+    VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO,
+#endif
     VHOST_INVALID_FEATURE_BIT
 };
 
-- 
2.49.0
Re: [PATCH RFC 16/16] net: make vhost-net aware of GSO over UDP tunnel hdr layout
Posted by Akihiko Odaki 5 months, 3 weeks ago
On 2025/05/21 20:34, Paolo Abeni wrote:
> When the GSO over UDP tunnel offload is enabled, the virtio net
> header includes additional fields to support such offload.
> 
> The vhost backend must be aware of the exact header layout, to
> copy it correctly. The tunnel-related field are present if either
> the guest or the host negotiated any UDP tunnel related feature:
> add them to host kernel supported features list, to allow qemu
> transder to such backend the needed information.

s/transder/transfer/

This patch should be squashed into the previous patch ("[PATCH RFC 
15/16] net: implement tnl feature offloading") as QEMU only with the 
previous patch will incorrectly enable tunnel offloading even when vhost 
doesn't support it.

> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
>   hw/net/vhost_net.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 58d7619fc8..c8e02d1732 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -52,6 +52,10 @@ static const int kernel_feature_bits[] = {
>       VIRTIO_F_NOTIFICATION_DATA,
>       VIRTIO_NET_F_RSC_EXT,
>       VIRTIO_NET_F_HASH_REPORT,
> +#ifdef CONFIG_INT128
> +    VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO,
> +    VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO,
> +#endif
>       VHOST_INVALID_FEATURE_BIT
>   };
>
Re: [PATCH RFC 16/16] net: make vhost-net aware of GSO over UDP tunnel hdr layout
Posted by Lei Yang 5 months, 3 weeks ago
Tested this series of patches with vhost-net regression tests,
everything works fine.

Tested-by: Lei Yang <leiyang@redhat.com>

On Fri, May 23, 2025 at 4:24 PM Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> On 2025/05/21 20:34, Paolo Abeni wrote:
> > When the GSO over UDP tunnel offload is enabled, the virtio net
> > header includes additional fields to support such offload.
> >
> > The vhost backend must be aware of the exact header layout, to
> > copy it correctly. The tunnel-related field are present if either
> > the guest or the host negotiated any UDP tunnel related feature:
> > add them to host kernel supported features list, to allow qemu
> > transder to such backend the needed information.
>
> s/transder/transfer/
>
> This patch should be squashed into the previous patch ("[PATCH RFC
> 15/16] net: implement tnl feature offloading") as QEMU only with the
> previous patch will incorrectly enable tunnel offloading even when vhost
> doesn't support it.
>
> >
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> > ---
> >   hw/net/vhost_net.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> >
> > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> > index 58d7619fc8..c8e02d1732 100644
> > --- a/hw/net/vhost_net.c
> > +++ b/hw/net/vhost_net.c
> > @@ -52,6 +52,10 @@ static const int kernel_feature_bits[] = {
> >       VIRTIO_F_NOTIFICATION_DATA,
> >       VIRTIO_NET_F_RSC_EXT,
> >       VIRTIO_NET_F_HASH_REPORT,
> > +#ifdef CONFIG_INT128
> > +    VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO,
> > +    VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO,
> > +#endif
> >       VHOST_INVALID_FEATURE_BIT
> >   };
> >
>
>