From: Paolo Abeni <pabeni@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Dmitry Fleytman <dmitry.fleytman@gmail.com>,
Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Luigi Rizzo <lrizzo@google.com>,
Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
Vincenzo Maffione <v.maffione@gmail.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH RFC v3 12/13] net: implement tunnel probing
Date: Tue, 22 Jul 2025 09:33:02 +0200 [thread overview]
Message-ID: <b865db9f-725f-4ca7-9101-caf4b3caa430@redhat.com> (raw)
In-Reply-To: <CACGkMEunxuooL+z=Oz1FsNabNuh=QwfMbzG0k0S+avL3LxEV7w@mail.gmail.com>
On 7/22/25 5:50 AM, Jason Wang wrote:
> On Fri, Jul 18, 2025 at 4:54 PM Paolo Abeni <pabeni@redhat.com> wrote:
>> Tap devices support GSO over UDP tunnel offload. Probe for such
>> feature in a similar manner to other offloads.
>>
>> GSO over UDP tunnel needs to be enabled in addition to a "plain"
>> offload (TSO or USO).
>>
>> No need to check separately for the outer header checksum offload:
>> the kernel is going to support both of them or none.
>>
>> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
>> ---
>> v2 -> v3:
>> - use bool type for tap_probe_has_tunnel()
>> - rebased on top of 2deec9ab7d ("virtio-net: Move
>> virtio_net_get_features() down")
>> - _array -> _ex
>>
>> v1 -> v2:
>> - peer_has_tunnel return a bool
>> - move TUN_F definition in net/tun-linux.h
>> ---
>> hw/net/virtio-net.c | 37 +++++++++++++++++++++++++++++++++++++
>> include/net/net.h | 3 +++
>> net/net.c | 9 +++++++++
>> net/tap-bsd.c | 5 +++++
>> net/tap-linux.c | 11 +++++++++++
>> net/tap-linux.h | 9 +++++++++
>> net/tap-solaris.c | 5 +++++
>> net/tap-stub.c | 5 +++++
>> net/tap.c | 11 +++++++++++
>> net/tap_int.h | 1 +
>> 10 files changed, 96 insertions(+)
>>
>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index 53413ec4d5..70c85f7f77 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -649,6 +649,15 @@ static int peer_has_uso(VirtIONet *n)
>> return qemu_has_uso(qemu_get_queue(n->nic)->peer);
>> }
>>
>> +static bool peer_has_tunnel(VirtIONet *n)
>
> Nit: it looks better to use peer_has_udp_gso_tunnel().
>
>> +{
>> + if (!peer_has_vnet_hdr(n)) {
>> + return false;
>> + }
>> +
>> + return qemu_has_tunnel(qemu_get_queue(n->nic)->peer);
>> +}
>> +
>> static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs,
>> int version_1, int hash_report)
>> {
>> @@ -3070,6 +3079,13 @@ static void virtio_net_get_features(VirtIODevice *vdev, uint64_t *features,
>> virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO4);
>> virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO6);
>>
>> + virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO);
>> + virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO);
>> + virtio_clear_feature_ex(features,
>> + VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM);
>> + virtio_clear_feature_ex(features,
>> + VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM);
>> +
>> virtio_clear_feature_ex(features, VIRTIO_NET_F_HASH_REPORT);
>> }
>>
>> @@ -3083,6 +3099,15 @@ static void virtio_net_get_features(VirtIODevice *vdev, uint64_t *features,
>> virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO6);
>> }
>>
>> + if (!peer_has_tunnel(n)) {
>> + virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO);
>> + virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO);
>> + virtio_clear_feature_ex(features,
>> + VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM);
>> + virtio_clear_feature_ex(features,
>> + VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM);
>> + }
>> +
>> if (!get_vhost_net(nc->peer)) {
>> if (!use_own_hash) {
>> virtio_clear_feature_ex(features, VIRTIO_NET_F_HASH_REPORT);
>> @@ -4137,6 +4162,10 @@ static const VMStateDescription vmstate_virtio_net = {
>> .dev_unplug_pending = dev_unplug_pending,
>> };
>>
>> +#define DEFINE_PROP_FEATURE(_name, _state, _field, _bit, _defval) \
>> + DEFINE_PROP_BIT64(_name, _state, _field[VIRTIO_DWORD(_bit)], \
>> + (_bit) % 64, _defval)
>> +
>> static const Property virtio_net_properties[] = {
>> DEFINE_PROP_BIT64("csum", VirtIONet, host_features,
>> VIRTIO_NET_F_CSUM, true),
>> @@ -4245,6 +4274,14 @@ static const Property virtio_net_properties[] = {
>> rss_data.specified_hash_types,
>> VIRTIO_NET_HASH_REPORT_UDPv6_EX - 1,
>> ON_OFF_AUTO_AUTO),
>> + DEFINE_PROP_FEATURE("host_tunnel", VirtIONet, host_features_ex,
>> + VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO, true),
>> + DEFINE_PROP_FEATURE("host_tunnel_csum", VirtIONet, host_features_ex,
>> + VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM, true),
>> + DEFINE_PROP_FEATURE("guest_tunnel", VirtIONet, host_features_ex,
>> + VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO, true),
>> + DEFINE_PROP_FEATURE("guest_tunnel_csum", VirtIONet, host_features_ex,
>> + VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM, true),
>> };
>
> Need compatibility work like:
>
> d83f46d189 ("virtio-pci: compat page aligned ATS")
If I read correctly the only missing pieces are the hw_compat_10_1
entries, am I correct?
If so, as mentioned here:
https://lists.gnu.org/archive/html/qemu-devel/2025-07/msg05032.html
I'll add the needed entries after that the hw_compat_10_1 will be created.
Thanks,
Paolo
next prev parent reply other threads:[~2025-07-22 7:34 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 8:52 [PATCH RFC v3 00/13] virtio: introduce support for GSO over UDP tunnel Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 01/13] net: bundle all offloads in a single struct Paolo Abeni
2025-07-20 10:31 ` Akihiko Odaki
2025-07-18 8:52 ` [PATCH RFC v3 02/13] linux-headers: Update to Linux ~v6.16-rc5 net-next Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 03/13] virtio: introduce extended features type Paolo Abeni
2025-07-20 10:41 ` Akihiko Odaki
2025-07-21 7:33 ` Paolo Abeni
2025-07-21 7:49 ` Akihiko Odaki
2025-07-21 8:45 ` Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 04/13] virtio: serialize extended features state Paolo Abeni
2025-07-18 15:06 ` Stefano Garzarella
2025-07-20 10:44 ` Akihiko Odaki
2025-07-21 7:51 ` Paolo Abeni
2025-07-21 7:55 ` Akihiko Odaki
2025-07-18 8:52 ` [PATCH RFC v3 05/13] virtio: add support for negotiating extended features Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 06/13] virtio-pci: implement support for " Paolo Abeni
2025-07-22 3:28 ` Jason Wang
2025-07-22 7:37 ` Paolo Abeni
2025-07-23 5:47 ` Jason Wang
2025-07-23 11:21 ` Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 07/13] vhost: add support for negotiating " Paolo Abeni
2025-07-18 14:36 ` Stefano Garzarella
2025-07-21 2:53 ` Lei Yang
2025-07-21 8:21 ` Paolo Abeni
2025-07-21 7:00 ` Paolo Abeni
2025-07-22 3:32 ` Jason Wang
2025-07-22 16:55 ` Paolo Abeni
2025-07-23 5:56 ` Jason Wang
2025-07-18 8:52 ` [PATCH RFC v3 08/13] qmp: update virtio features map to support " Paolo Abeni
2025-07-18 10:18 ` Stefano Garzarella
2025-07-18 10:23 ` Paolo Abeni
2025-07-18 10:28 ` Stefano Garzarella
2025-07-19 6:57 ` Markus Armbruster
2025-07-21 7:07 ` Paolo Abeni
2025-07-21 7:23 ` Akihiko Odaki
2025-07-21 7:45 ` Stefano Garzarella
2025-07-21 8:04 ` Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 09/13] vhost-backend: implement extended features support Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 10/13] vhost-net: " Paolo Abeni
2025-07-18 13:01 ` Stefano Garzarella
2025-07-18 14:33 ` Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 11/13] virtio-net: " Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 12/13] net: implement tunnel probing Paolo Abeni
2025-07-18 11:17 ` Stefano Garzarella
2025-07-21 8:48 ` Paolo Abeni
2025-07-22 3:50 ` Jason Wang
2025-07-22 7:33 ` Paolo Abeni [this message]
2025-07-23 5:47 ` Jason Wang
2025-07-22 4:15 ` Akihiko Odaki
2025-07-18 8:52 ` [PATCH RFC v3 13/13] net: implement UDP tunnel features offloading Paolo Abeni
2025-07-18 13:22 ` Stefano Garzarella
2025-07-18 13:44 ` Paolo Abeni
2025-07-18 13:48 ` Stefano Garzarella
2025-07-18 15:21 ` Stefano Garzarella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b865db9f-725f-4ca7-9101-caf4b3caa430@redhat.com \
--to=pabeni@redhat.com \
--cc=armbru@redhat.com \
--cc=cohuck@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=eblake@redhat.com \
--cc=g.lettieri@iet.unipi.it \
--cc=jasowang@redhat.com \
--cc=lrizzo@google.com \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=sriram.yagnaraman@ericsson.com \
--cc=v.maffione@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).