From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3975B2D3A9B for ; Tue, 24 Jun 2025 14:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750774292; cv=none; b=s4drmezny0ykTuLhwzK0kB3bixKNFl0iiJISTKJOdKJ/SKOFJ7sg6FfX4ply6fSy4FA2D2SCwEYy8hxzxduLsoUJ/r97SfcyPPU/YXgt931U5HzsEqClEFLcYl9PxhiTn+J+5gJ8soThsEzgzy2TjqplMaYU4GJhRQRS62SNV0g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750774292; c=relaxed/simple; bh=U2AMmH4dHPz07x6g312pS1lWM4vWlUn6AfhgroEtBZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I9+s0MKSvuKli4obF/LizVArwnTJRXg68XyUU1EGik5t/gc6+0oslepB4XkpzIv77WBZ8HP3qZMkbUDjXeuuz2Up01ixCOzNoi6ssFx1qC896oX2GKgtcFPu6r4gSVXJ0DrSzQImzZobRQsG8dll560VXruRHkz8DoeYMBwWBFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KS1aPjdF; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KS1aPjdF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750774290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EmFVGkDZSCXgOKTUYGLw8iU5EekwuYpkDHdca2yu7FE=; b=KS1aPjdFDNxBH/4KW/JhDMUGkwUym+tVIadsmWgGMSHJn85kqssSkFUwWMkqeZrm+ert/K dXotNX2oWcoexRImmx555+NvYuUT0hJO4jmxgBn/Pyj1M5623ZbT2fy7M6YNbVvakB4mOy snwyRGG0Y1pGBfocdfJZRQLYdFAL2mE= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-0CVFcSHxPymRtV4syVzi3Q-1; Tue, 24 Jun 2025 10:11:25 -0400 X-MC-Unique: 0CVFcSHxPymRtV4syVzi3Q-1 X-Mimecast-MFC-AGG-ID: 0CVFcSHxPymRtV4syVzi3Q_1750774278 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9A05C19560A7; Tue, 24 Jun 2025 14:11:18 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.45.224.193]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B4A24195608F; Tue, 24 Jun 2025 14:11:13 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: Willem de Bruijn , Jason Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Michael S. Tsirkin" , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Yuri Benditovich , Akihiko Odaki , Jonathan Corbet , 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 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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 Signed-off-by: Paolo Abeni --- 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