netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Yuri Benditovich" <yuri.benditovich@daynix.com>,
	"Akihiko Odaki" <akihiko.odaki@daynix.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	kvm@vger.kernel.org, linux-doc@vger.kernel.org
Subject: [PATCH v6 net-next 9/9] vhost/net: enable gso over UDP tunnel support.
Date: Tue, 24 Jun 2025 16:09:51 +0200	[thread overview]
Message-ID: <df8e82aa4d26bdc03a5c6e43f15e52397a1bf85c.1750753211.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1750753211.git.pabeni@redhat.com>

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 <jasowang@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
v3 -> v4:
  - rebased
---
 drivers/vhost/net.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index c8fb7c10fe0b..08914b736a31 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;
-- 
2.49.0


  parent reply	other threads:[~2025-06-24 14:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 14:09 [PATCH v6 net-next 0/9] virtio: introduce GSO over UDP tunnel Paolo Abeni
2025-06-24 14:09 ` [PATCH v6 net-next 1/9] scripts/kernel_doc.py: properly handle VIRTIO_DECLARE_FEATURES Paolo Abeni
2025-06-24 14:09 ` [PATCH v6 net-next 2/9] virtio: introduce extended features Paolo Abeni
2025-06-24 14:09 ` [PATCH v6 net-next 3/9] virtio_pci_modern: allow configuring " Paolo Abeni
2025-06-24 14:09 ` [PATCH v6 net-next 4/9] vhost-net: " Paolo Abeni
2025-06-27  6:41   ` kernel test robot
2025-06-27 10:28     ` Paolo Abeni
2025-06-27 12:18       ` Michael S. Tsirkin
2025-06-27 12:44         ` Paolo Abeni
2025-06-27 12:47           ` Michael S. Tsirkin
2025-07-04 14:09             ` Paolo Abeni
2025-06-27 13:11     ` Paolo Abeni
2025-06-27 14:36       ` Paolo Abeni
2025-07-06  7:33         ` Michael S. Tsirkin
2025-06-24 14:09 ` [PATCH v6 net-next 5/9] virtio_net: add supports for extended offloads Paolo Abeni
2025-06-24 14:09 ` [PATCH v6 net-next 6/9] net: implement virtio helpers to handle UDP GSO tunneling Paolo Abeni
2025-06-24 14:09 ` [PATCH v6 net-next 7/9] virtio_net: enable gso over UDP tunnel support Paolo Abeni
2025-06-24 14:09 ` [PATCH v6 net-next 8/9] tun: " Paolo Abeni
2025-06-24 14:09 ` Paolo Abeni [this message]
2025-07-08  7:12 ` [PATCH v6 net-next 0/9] virtio: introduce GSO over UDP tunnel Paolo Abeni

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=df8e82aa4d26bdc03a5c6e43f15e52397a1bf85c.1750753211.git.pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=yuri.benditovich@daynix.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).