From nobody Thu Sep 18 08:34:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52375C352A1 for ; Wed, 7 Dec 2022 11:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230174AbiLGLvx (ORCPT ); Wed, 7 Dec 2022 06:51:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbiLGLve (ORCPT ); Wed, 7 Dec 2022 06:51:34 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7B1F51315 for ; Wed, 7 Dec 2022 03:51:33 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id d14so19582441edj.11 for ; Wed, 07 Dec 2022 03:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b50DMxxzpcvqZuaYvZ+NeDB+ivxCzALRsRPpNk8vSuo=; b=ah+7qtSPQPfP7JCSCAvryAWT9SaG5pcJwqrq8YnhlRflNzMbRupaadUDIHbI+2nJzU TMrmD0Xuy2WF5G5MQUev9P92s685Ze1SJ4Z+/MRt4ew43KoMCku4hGDnPxnQhBdxhYUW bcYduHfJena87oqsnUpOuNyRtQOTaKd4dZeBByE9r2fpmjcmpuvnPBf0njAzI6TCdRn3 7JXRYMSiWd5cYeD19na2UwaItZHATd6+rHx3/s39/WmVj7P2YS3KBEkfEYFfI1fo+WLd oDInrXxfA8aZO8kSxq4xZU+pKMSp6KBqdn6d/frwiivwnRoi5Z3QXbPpxup4u3cPVYEs Sg3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b50DMxxzpcvqZuaYvZ+NeDB+ivxCzALRsRPpNk8vSuo=; b=ibaIqn3tuNrRM8gEbPVfAFl49eep1ym3dWArAURDJVSHJdveyMh8kPHLz9s3MjBdvP 1PripHfCpJo7B7Z161Rj+UsJfu+2irp0RP0HgzYmACOrl8QoJSlbQbi9s0fytG70PhsZ Q/RSbZwzE30HQuJ8juG6Ee3avNgUDpXyBMDNEl8D23/SwcQ0TV38r2F+aMd2Yd2QtOKc yd7SpPyXSWY4E9/zXNSuE3VvwLUHumBqjjA9hqGkrb/5ZbwDxYwgtJgoF4HP3lHs0fhj +UkrjhAdlQMt9Qoncto/6WOwz2cnJMbUXiWI7khPQsC/iOC+1BM7eAh5UYxSCXnxiY/V dGuQ== X-Gm-Message-State: ANoB5pl3yzWHt2GVc271USgwQ8qrS0iATmuNclEQ5O2PkMFzKhFo/KBW W5iPp0hew2xldhQ7wlVCXaTaPg== X-Google-Smtp-Source: AA0mqf5Jgn1LUauRgbHQj9w8QV4AUcZH5sRBPp3Nm6PB9JKg3E7uiSJV4t3LjuIeCcrLPSexUTR2iQ== X-Received: by 2002:a05:6402:5289:b0:462:70ee:fdb8 with SMTP id en9-20020a056402528900b0046270eefdb8mr47279793edb.66.1670413886071; Wed, 07 Dec 2022 03:51:26 -0800 (PST) Received: from localhost.localdomain ([193.33.38.48]) by smtp.gmail.com with ESMTPSA id g26-20020a056402181a00b004618a89d273sm2132816edy.36.2022.12.07.03.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 03:51:25 -0800 (PST) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [PATCH v5 1/6] udp: allow header check for dodgy GSO_UDP_L4 packets. Date: Wed, 7 Dec 2022 13:35:53 +0200 Message-Id: <20221207113558.19003-2-andrew@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207113558.19003-1-andrew@daynix.com> References: <20221207113558.19003-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Allow UDP_L4 for robust packets. Signed-off-by: Jason Wang Signed-off-by: Andrew Melnychenko --- net/ipv4/udp_offload.c | 3 ++- net/ipv6/udp_offload.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 6d1a4bec2614..f65b1a7a0c26 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -387,7 +387,8 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff= *skb, if (!pskb_may_pull(skb, sizeof(struct udphdr))) goto out; =20 - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && + !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) return __udp_gso_segment(skb, features, false); =20 mss =3D skb_shinfo(skb)->gso_size; diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index 7720d04ed396..057293293e30 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -42,7 +42,8 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *= skb, if (!pskb_may_pull(skb, sizeof(struct udphdr))) goto out; =20 - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && + !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) return __udp_gso_segment(skb, features, true); =20 mss =3D skb_shinfo(skb)->gso_size; --=20 2.38.1 From nobody Thu Sep 18 08:34:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A61C63707 for ; Wed, 7 Dec 2022 11:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbiLGLvn (ORCPT ); Wed, 7 Dec 2022 06:51:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbiLGLvj (ORCPT ); Wed, 7 Dec 2022 06:51:39 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED8951324 for ; Wed, 7 Dec 2022 03:51:33 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id e13so24501321edj.7 for ; Wed, 07 Dec 2022 03:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1xi/1JoZF74FcvKn/bwOZmu6e38qXh11OS7Ij6MGyCE=; b=vvi8mLQ8FWGj1DPzR9o/wPIx9cj4psWvbIjzttwi0YJs8sN1dzhKa9aU6H5Pg7qTHy bsGtCZWl5YpQj/2x1qsouY2KCqhqRrWmTdYt6WqOtdGLDd19BWhQsBJosPC5Kjh+WztE igsPew/lrUSoQt5Ucf+U/+CDRsycLjxVoXrhQTuliGZVp3MWREKbZkFjzw4Dwu3GTdIi exYK+RzQ2FlMjAf6eqQaoXrJBg+zQUUrqQVDGSKI+qPsxXhQhOkS1taS2nmKW/ynkz4l SjwmFv0KSwkzUwTSl/iYWckExZiNhtRPu9zfD471HNPjdM9F8zb1GnVFejWc87H6ZFkl uRgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1xi/1JoZF74FcvKn/bwOZmu6e38qXh11OS7Ij6MGyCE=; b=qJNx3zE8Mrd6SJMkxZDZgQDtlmdBocigdXEjdI2FoW8HH9wBAH865z+NngelW/wJyh akeK2kOM1yOYy64d5hwKLRfFyVmvRtJnIcf4X1ylSRFW3HTLeog0bF9kEOsLk2ZDEfQs ZlYrVTGc+psFEAvq8veJkhJ9+U3VCW0nQukCOObRfDyTFDhR7p72dLTNXqyNPlmQvDV+ ad9mGqyEoOdOJGYBexK4FD68MYXLIJEz5gDSjyVYpLwuyAdLavY7yXa/ua/jpSt0DLb0 jYLW9T2c0MgQwl789hDgUAA15+dylMBNxnOvQRpARLnMtswpwiyiA1bPpuUh+gDtpJgP Mqyw== X-Gm-Message-State: ANoB5pkrU2so8LtSAZeUDDV66Nwvrix48Wgsoj4Y/ikJp7xrwK4w1MbX Otmzh8CvTsY5MqMvL5551vhqjg== X-Google-Smtp-Source: AA0mqf7hiBXQQAn0Y+l2ZkZr03wQTds9xREx1n21mzMwdfGo0jv5B6/ORm3N7D8kGcyItmXCulkrHw== X-Received: by 2002:aa7:cdd2:0:b0:46c:7119:47ad with SMTP id h18-20020aa7cdd2000000b0046c711947admr15635310edw.387.1670413887674; Wed, 07 Dec 2022 03:51:27 -0800 (PST) Received: from localhost.localdomain ([193.33.38.48]) by smtp.gmail.com with ESMTPSA id g26-20020a056402181a00b004618a89d273sm2132816edy.36.2022.12.07.03.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 03:51:27 -0800 (PST) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [PATCH v5 2/6] uapi/linux/if_tun.h: Added new offload types for USO4/6. Date: Wed, 7 Dec 2022 13:35:54 +0200 Message-Id: <20221207113558.19003-3-andrew@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207113558.19003-1-andrew@daynix.com> References: <20221207113558.19003-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Added 2 additional offlloads for USO(IPv4 & IPv6). Separate offloads are required for Windows VM guests, g.e. Windows may set USO rx only for IPv4. Signed-off-by: Andrew Melnychenko --- include/uapi/linux/if_tun.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h index b6d7b868f290..287cdc81c939 100644 --- a/include/uapi/linux/if_tun.h +++ b/include/uapi/linux/if_tun.h @@ -90,6 +90,8 @@ #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ #define TUN_F_UFO 0x10 /* I can handle UFO packets */ +#define TUN_F_USO4 0x20 /* I can handle USO for IPv4 packets */ +#define TUN_F_USO6 0x40 /* I can handle USO for IPv6 packets */ =20 /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ #define TUN_PKT_STRIP 0x0001 --=20 2.38.1 From nobody Thu Sep 18 08:34:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E560FC352A1 for ; Wed, 7 Dec 2022 11:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbiLGLwA (ORCPT ); Wed, 7 Dec 2022 06:52:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbiLGLvk (ORCPT ); Wed, 7 Dec 2022 06:51:40 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3EBA51337 for ; Wed, 7 Dec 2022 03:51:33 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id d14so19582621edj.11 for ; Wed, 07 Dec 2022 03:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H6KVLYAPLygGoe4sQi/p1SsV3HWl1bxrtOXgL4oTXqs=; b=J30v1DLLJRwACySk/YtVqRU3GkFmVzKkIrrQw06qLOBQuaoFmpU2vx3paOASsJIQra O8Pk7NYj1MNmzQgSw0wnoem3+mYToznn6NbAlshUNv9CleRAr8xSGdbILoBj0WedlJc3 wPZewCgsR7X6/cz5xGOr6agtr5Y34w3W0xaYFgGRN6LD/oUR46jm7RwSz9nAMxtE3QQz Viz+suMJwJqQ0sKOwVVFN+W5JSnwc6/eLeLRvqFtCp/cRgJ6HWuV3PIMASbXyBi/d+5O 60OhqraU9TU6PyEsc1p4ZrQcn4okEJbHI5Eidlhp8cJb+981mRM/4l+Vw7f/YKwRf0vE fJ8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H6KVLYAPLygGoe4sQi/p1SsV3HWl1bxrtOXgL4oTXqs=; b=XLvlHwaxgkWx7lttWUZ6Llky+zDT+x5RH+QOsrtKQX16ilVAW57qcZONkYGfK3Q3By MwS50HNOKLS5zgFpeUuDGhse3oCDOYKxhLrdsz1im3AV54CV8bpzdDdT3HM+lxW/gBXr gpdybocTLRHMK61hRuL6Ys+Kgi4zwswhACZQz7RLF3dCE08kpqZh34zx3mD5kTYVSX+7 Gdg9b6KkjPFJu9ItE89YXv+WJHh760xKbxprq8qTix7PoDkw4gJxVCL5SkUAgM0qDNSh ryQWD3B4/6TdKA2ynAJ+GtTFCZbZQNPibUGu8v1fifZr0IBdFE0R6HQ/AY8KlpGCTega b2jA== X-Gm-Message-State: ANoB5pngWAUvlmpGlOVR6ioOerDX+3dxUqMi+08oynQgprAmqamwxYyU fA+cIpPjnbuBhFmb7bVrsZ9lLQ== X-Google-Smtp-Source: AA0mqf5nuG78G3ParQRGYGQx9/qgTYYpjKlI4g1n6r6f8suS7gW7VmK8EXRf7oBTGYdKcv14pR5JCA== X-Received: by 2002:a05:6402:3886:b0:463:ab08:2bc6 with SMTP id fd6-20020a056402388600b00463ab082bc6mr63763991edb.143.1670413889261; Wed, 07 Dec 2022 03:51:29 -0800 (PST) Received: from localhost.localdomain ([193.33.38.48]) by smtp.gmail.com with ESMTPSA id g26-20020a056402181a00b004618a89d273sm2132816edy.36.2022.12.07.03.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 03:51:28 -0800 (PST) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [PATCH v5 3/6] driver/net/tun: Added features for USO. Date: Wed, 7 Dec 2022 13:35:55 +0200 Message-Id: <20221207113558.19003-4-andrew@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207113558.19003-1-andrew@daynix.com> References: <20221207113558.19003-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Added support for USO4 and USO6. For now, to "enable" USO, it's required to set both USO4 and USO6 simultane= ously. USO enables NETIF_F_GSO_UDP_L4. Signed-off-by: Andrew Melnychenko --- drivers/net/tap.c | 10 ++++++++-- drivers/net/tun.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 9e75ed3f08ce..a2be1994b389 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -957,6 +957,10 @@ static int set_offload(struct tap_queue *q, unsigned l= ong arg) if (arg & TUN_F_TSO6) feature_mask |=3D NETIF_F_TSO6; } + + /* TODO: for now USO4 and USO6 should work simultaneously */ + if ((arg & (TUN_F_USO4 | TUN_F_USO6)) =3D=3D (TUN_F_USO4 | TUN_F_USO6)) + features |=3D NETIF_F_GSO_UDP_L4; } =20 /* tun/tap driver inverts the usage for TSO offloads, where @@ -967,7 +971,8 @@ static int set_offload(struct tap_queue *q, unsigned lo= ng arg) * When user space turns off TSO, we turn off GSO/LRO so that * user-space will not receive TSO frames. */ - if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6)) + if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6) || + (feature_mask & (TUN_F_USO4 | TUN_F_USO6)) =3D=3D (TUN_F_USO4 | TUN_F= _USO6)) features |=3D RX_OFFLOADS; else features &=3D ~RX_OFFLOADS; @@ -1091,7 +1096,8 @@ static long tap_ioctl(struct file *file, unsigned int= cmd, case TUNSETOFFLOAD: /* let the user check for future flags */ if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | - TUN_F_TSO_ECN | TUN_F_UFO)) + TUN_F_TSO_ECN | TUN_F_UFO | + TUN_F_USO4 | TUN_F_USO6)) return -EINVAL; =20 rtnl_lock(); diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 24001112c323..a7b9808368d0 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -185,7 +185,7 @@ struct tun_struct { struct net_device *dev; netdev_features_t set_features; #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ - NETIF_F_TSO6) + NETIF_F_TSO6 | NETIF_F_GSO_UDP_L4) =20 int align; int vnet_hdr_sz; @@ -2885,6 +2885,12 @@ static int set_offload(struct tun_struct *tun, unsig= ned long arg) } =20 arg &=3D ~TUN_F_UFO; + + /* TODO: for now USO4 and USO6 should work simultaneously */ + if (arg & TUN_F_USO4 && arg & TUN_F_USO6) { + features |=3D NETIF_F_GSO_UDP_L4; + arg &=3D ~(TUN_F_USO4 | TUN_F_USO6); + } } =20 /* This gives the user a way to test for new features in future by --=20 2.38.1 From nobody Thu Sep 18 08:34:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 478BAC352A1 for ; Wed, 7 Dec 2022 11:52:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbiLGLwN (ORCPT ); Wed, 7 Dec 2022 06:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbiLGLvk (ORCPT ); Wed, 7 Dec 2022 06:51:40 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40795133C for ; Wed, 7 Dec 2022 03:51:33 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id v8so24559168edi.3 for ; Wed, 07 Dec 2022 03:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jBijGHO2AiN4F548fLyvLB60bsMpsKu4cHIqRi1tL5k=; b=H9X+AFPnQ/jrcVc/TZh4p6OCCB9QnS40L1PNff3KnTL3jCQL/9YUSluFGfIWNf3gKH Gj5X2MslAuL+bwkvot+yLkNRpx8VbxU01EEsTtDoNqwWtxIKptrYkCBN/XI9T2+zwe74 eAUoicIW8NJphlWRYGQw2g27aHrS9bae1rFemv1LMfPt3ufU/rnFiG5tPle8inwnkPT2 0nf03huOy7XhdnabUxaYiNjW14wavAn5/OUDv+5szb+Pz3olGMLKwG2srJddxiKQ7/w/ Gugi/uX4FrkP6kLI3ZyM3Nj0erZmocZCHO21aSKmBHfughvhmmd3V8DmhRyTf21tDBfA JKTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jBijGHO2AiN4F548fLyvLB60bsMpsKu4cHIqRi1tL5k=; b=6MjUNfxN2nX/1l3K8hq/+4LLuOqwRS4IUE/Np56d2TLPw0H4tanLRBEgN4cU48nEM2 8EmHoo2iEDincsy6Qc4/77h9hs9fIKP4+ggkzqPbdR0mXAJ/VPLx/VDTVvV9U/30xhU6 8LAT2OHJKt8Ss3mSZHlP0895/4V5ECsZrXkKsKpVix4vpomEErKdfBjJDD1Am8BGw4wD VNWB3f66oRanm9XctPAH4GzuTYpBvXAQ+mQSwxGRwmzQVguFi6ixIkftIY8kRYDPxBlg 7wKMAjQTP2QLB19AOLzP9mK7VsNfy9uFGSUMkEjcBB1z4ObM9h8mVR7dS5gciBFrIiq3 7F/w== X-Gm-Message-State: ANoB5pkOMK/LZyM4OMB+IZWHG/qXne1sbqI/KOvxuGkMcm8NojdkSoAW P7ec9FRb+/AhO5KKXoOINYVWjw== X-Google-Smtp-Source: AA0mqf7faeznv+cpNEiJunIj8ZXLiDNsCAgep7kdqvALdydx8RSBGSjOxHBYVMfpgyqOzpQDAkk/iA== X-Received: by 2002:a05:6402:528d:b0:468:dc9:ec08 with SMTP id en13-20020a056402528d00b004680dc9ec08mr5877921edb.17.1670413890749; Wed, 07 Dec 2022 03:51:30 -0800 (PST) Received: from localhost.localdomain ([193.33.38.48]) by smtp.gmail.com with ESMTPSA id g26-20020a056402181a00b004618a89d273sm2132816edy.36.2022.12.07.03.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 03:51:30 -0800 (PST) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [PATCH v5 4/6] uapi/linux/virtio_net.h: Added USO types. Date: Wed, 7 Dec 2022 13:35:56 +0200 Message-Id: <20221207113558.19003-5-andrew@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207113558.19003-1-andrew@daynix.com> References: <20221207113558.19003-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Added new GSO type for USO: VIRTIO_NET_HDR_GSO_UDP_L4. Feature VIRTIO_NET_F_HOST_USO allows to enable NETIF_F_GSO_UDP_L4. Separated VIRTIO_NET_F_GUEST_USO4 & VIRTIO_NET_F_GUEST_USO6 features required for Windows guests. Signed-off-by: Andrew Melnychenko --- include/uapi/linux/virtio_net.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_ne= t.h index 6cb842ea8979..b4062bed186a 100644 --- a/include/uapi/linux/virtio_net.h +++ b/include/uapi/linux/virtio_net.h @@ -57,6 +57,9 @@ * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ #define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalesc= ing */ +#define VIRTIO_NET_F_GUEST_USO4 54 /* Guest can handle USOv4 in. */ +#define VIRTIO_NET_F_GUEST_USO6 55 /* Guest can handle USOv6 in. */ +#define VIRTIO_NET_F_HOST_USO 56 /* Host can handle USO in. */ #define VIRTIO_NET_F_HASH_REPORT 57 /* Supports hash report */ #define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */ #define VIRTIO_NET_F_RSC_EXT 61 /* extended coalescing info */ @@ -130,6 +133,7 @@ struct virtio_net_hdr_v1 { #define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */ #define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */ #define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */ +#define VIRTIO_NET_HDR_GSO_UDP_L4 5 /* GSO frame, IPv4& IPv6 UDP (USO) */ #define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */ __u8 gso_type; __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ --=20 2.38.1 From nobody Thu Sep 18 08:34:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B2CDC352A1 for ; Wed, 7 Dec 2022 11:52:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbiLGLwH (ORCPT ); Wed, 7 Dec 2022 06:52:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiLGLvk (ORCPT ); Wed, 7 Dec 2022 06:51:40 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 160614B75D for ; Wed, 7 Dec 2022 03:51:33 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id vv4so13418469ejc.2 for ; Wed, 07 Dec 2022 03:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/l0FUf2LxM2s+FDut6wgd6Dg4LANJfMwzdqmeR53eYQ=; b=zGFToKn8FO86Xuv7xvlk8liqDBqCPtY/J6xbVIrbVoCMYk37GfocinB/w4RX6y/pzM 4ZGegPNiPLEVFHdFPF6sRPCUqQ+MQPse11q8bDMIKo9f+StPCIaCT18AKoOOE7/j58ni qHJZjAwf2Diws280GHKdu2muF6bQCiQfRUkOSH6dIbG7qwf5kouiNDBzbs8+JGmuYhPs pjEyAaDqf1+JDh9lwjKS13SEbi4oeHEGWOvPuVVmNu52DF63clWC4lBbmZL9XZ1/8Asi u6/Rz+zYUUj8+1Rvk0lcnWiM1B3nmx+byccKjnjwbApusrzRV8aX9HgnfnoBEbTdzbba 6aVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/l0FUf2LxM2s+FDut6wgd6Dg4LANJfMwzdqmeR53eYQ=; b=1uTHZ520e+aQGD25Dc7hB+/ztIJ9rD9aVR53Sem9+TPDQR8BbnGb/bGCtUaAiERLqY hJGkNKBLfm9f83STS8vIfX16ZDcmQtuSCftAV+XHBt7RLffQYEZfYIjT8kiLJ0pr9ldE YmPC99lUmseLzKw6kBdcZOUwKABJlBjW33tDYA1eSP2qrh9rqfHrZs/WK/yhpxyDERnY b4UYBvKLiUqU+gDEYWX5UDpYE1kg+RwzBOZPhZ/0r4qAg8QmjrbJ4hO5rk/HRy8gyIEk B+imVYjuRRCDRESJS3UUsr4Ta+zsf/13qvKqUwTNh76Fwn1zge6DWdqctWisNzbWZ2X7 W3HA== X-Gm-Message-State: ANoB5plrxkHcpNXsy29H6Cfzzfa8lXWpPcj+T84UF+mzEGayK1Gq+Jtf BuwiAggKQxDowF2m4EvRrDkckA== X-Google-Smtp-Source: AA0mqf7+5NlnP9WcERs7h4Vqci3F/FAmaQylak0BsGYiINaDgtGqamvILPTZQKlrzMLN2sxBgVUllA== X-Received: by 2002:a17:906:fa0d:b0:7c0:e5cb:b73b with SMTP id lo13-20020a170906fa0d00b007c0e5cbb73bmr12860692ejb.624.1670413892372; Wed, 07 Dec 2022 03:51:32 -0800 (PST) Received: from localhost.localdomain ([193.33.38.48]) by smtp.gmail.com with ESMTPSA id g26-20020a056402181a00b004618a89d273sm2132816edy.36.2022.12.07.03.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 03:51:32 -0800 (PST) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [PATCH v5 5/6] linux/virtio_net.h: Support USO offload in vnet header. Date: Wed, 7 Dec 2022 13:35:57 +0200 Message-Id: <20221207113558.19003-6-andrew@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207113558.19003-1-andrew@daynix.com> References: <20221207113558.19003-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now, it's possible to convert USO vnet packets from/to skb. Added support for GSO_UDP_L4 offload. Signed-off-by: Andrew Melnychenko --- include/linux/virtio_net.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index a960de68ac69..bdf8de2cdd93 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -15,6 +15,7 @@ static inline bool virtio_net_hdr_match_proto(__be16 prot= ocol, __u8 gso_type) case VIRTIO_NET_HDR_GSO_TCPV6: return protocol =3D=3D cpu_to_be16(ETH_P_IPV6); case VIRTIO_NET_HDR_GSO_UDP: + case VIRTIO_NET_HDR_GSO_UDP_L4: return protocol =3D=3D cpu_to_be16(ETH_P_IP) || protocol =3D=3D cpu_to_be16(ETH_P_IPV6); default: @@ -31,6 +32,7 @@ static inline int virtio_net_hdr_set_proto(struct sk_buff= *skb, switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { case VIRTIO_NET_HDR_GSO_TCPV4: case VIRTIO_NET_HDR_GSO_UDP: + case VIRTIO_NET_HDR_GSO_UDP_L4: skb->protocol =3D cpu_to_be16(ETH_P_IP); break; case VIRTIO_NET_HDR_GSO_TCPV6: @@ -69,6 +71,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *= skb, ip_proto =3D IPPROTO_UDP; thlen =3D sizeof(struct udphdr); break; + case VIRTIO_NET_HDR_GSO_UDP_L4: + gso_type =3D SKB_GSO_UDP_L4; + ip_proto =3D IPPROTO_UDP; + thlen =3D sizeof(struct udphdr); + break; default: return -EINVAL; } @@ -182,6 +189,8 @@ static inline int virtio_net_hdr_from_skb(const struct = sk_buff *skb, hdr->gso_type =3D VIRTIO_NET_HDR_GSO_TCPV4; else if (sinfo->gso_type & SKB_GSO_TCPV6) hdr->gso_type =3D VIRTIO_NET_HDR_GSO_TCPV6; + else if (sinfo->gso_type & SKB_GSO_UDP_L4) + hdr->gso_type =3D VIRTIO_NET_HDR_GSO_UDP_L4; else return -EINVAL; if (sinfo->gso_type & SKB_GSO_TCP_ECN) --=20 2.38.1 From nobody Thu Sep 18 08:34:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5A61C352A1 for ; Wed, 7 Dec 2022 11:52:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230158AbiLGLwR (ORCPT ); Wed, 7 Dec 2022 06:52:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbiLGLvk (ORCPT ); Wed, 7 Dec 2022 06:51:40 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CCA351C00 for ; Wed, 7 Dec 2022 03:51:35 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id fc4so13306207ejc.12 for ; Wed, 07 Dec 2022 03:51:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XMtP14B7qgPGyencUQ441983HC3jgMwtJjN+dpKWwyo=; b=5PwLz66EoXm/pQQmlpL7Thi8Bik05FDzBuJ6U1efGar6l2qNC50/MOdysQIGWFUqxq 2isSlvgV0SU9y0gA8EYFxLIrrQrsl6Zh2nVUH5vdfWP+5M+GhoWywYn21jq4uiJ9FCvd XM+soq9miOdKIFQFN94Ref9VbFhFtT54JxqXY0bsahsfBy6EIdySJUoyVB5EaNVM+Eki 97n/zCoTPX+PrW+0QqsfghBfhQkXvqfN4fr6A7yDBWYjLQIE/1qgsEWRYJI+Seou1mG/ /YntbZqgdV+uJJX1nqrO4BsFyIsXq24UA+CDKRSkAQZF4oBjIdVdmOj4KdUBsVgEnVkY Iulw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XMtP14B7qgPGyencUQ441983HC3jgMwtJjN+dpKWwyo=; b=5jYighpuPDnm+l5iTgeinclFkPpkLfI/bsiG8aSPOJ0kqJq7BgqSNC7rOYp4xDhQZX yXzQgN1FIBc2n54Ohta2X5jHFPkgqhyDQ/VtLEWgNNr7TGIJUcLiW93i1f4Knvn8ObN9 EmtbM+x4wbg0RH8QRWvX1XG2v+8Yfs2JPNpLMX7G+bWm/yaOtcCEfFQSR6iFs/oTD2TO 1tLq7CTRinMNiEyYPp4SOLp4kf/pWIudqvfWDPURoBWJHVEQ+Nknes6TCFmB+3IXbp9w wdmBIVXFweK4vSQU7MseypLw9e186hT3iHfR5XJxU6+8Nn3uGMTqLnqS4sBiJpsMb8nA uBLg== X-Gm-Message-State: ANoB5plmj6OohbYbdDKnuILhkMmdAmQZFW7zC/iswJ5YFUhETH6L10H3 9zWc7YQ11pkW0XAAI+XEziAeEw== X-Google-Smtp-Source: AA0mqf6dB/YbyuUWSS2DbhXio3PDff2r31R483hX8azPX7si2rj/3NsNmK4wYmoBRtkX+7w8pu+5dg== X-Received: by 2002:a17:906:1713:b0:7a3:fc74:7fb4 with SMTP id c19-20020a170906171300b007a3fc747fb4mr80015173eje.17.1670413893893; Wed, 07 Dec 2022 03:51:33 -0800 (PST) Received: from localhost.localdomain ([193.33.38.48]) by smtp.gmail.com with ESMTPSA id g26-20020a056402181a00b004618a89d273sm2132816edy.36.2022.12.07.03.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 03:51:33 -0800 (PST) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [PATCH v5 6/6] drivers/net/virtio_net.c: Added USO support. Date: Wed, 7 Dec 2022 13:35:58 +0200 Message-Id: <20221207113558.19003-7-andrew@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207113558.19003-1-andrew@daynix.com> References: <20221207113558.19003-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now, it possible to enable GSO_UDP_L4("tx-udp-segmentation") for VirtioNet. Signed-off-by: Andrew Melnychenko --- drivers/net/virtio_net.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 86e52454b5b5..97d63c819c7b 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -60,13 +60,17 @@ static const unsigned long guest_offloads[] =3D { VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, - VIRTIO_NET_F_GUEST_CSUM + VIRTIO_NET_F_GUEST_CSUM, + VIRTIO_NET_F_GUEST_USO4, + VIRTIO_NET_F_GUEST_USO6 }; =20 #define GUEST_OFFLOAD_GRO_HW_MASK ((1ULL << VIRTIO_NET_F_GUEST_TSO4) | \ (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \ (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ - (1ULL << VIRTIO_NET_F_GUEST_UFO)) + (1ULL << VIRTIO_NET_F_GUEST_UFO) | \ + (1ULL << VIRTIO_NET_F_GUEST_USO4) | \ + (1ULL << VIRTIO_NET_F_GUEST_USO6)) =20 struct virtnet_stat_desc { char desc[ETH_GSTRING_LEN]; @@ -3085,7 +3089,9 @@ static int virtnet_xdp_set(struct net_device *dev, st= ruct bpf_prog *prog, virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || - virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))) { + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM) || + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO4) || + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO6))) { NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing GRO= _HW/CSUM, disable GRO_HW/CSUM first"); return -EOPNOTSUPP; } @@ -3690,7 +3696,9 @@ static bool virtnet_check_guest_gso(const struct virt= net_info *vi) return virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || - virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO); + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || + (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO4) && + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_USO6)); } =20 static void virtnet_set_big_packets(struct virtnet_info *vi, const int mtu) @@ -3759,6 +3767,8 @@ static int virtnet_probe(struct virtio_device *vdev) dev->hw_features |=3D NETIF_F_TSO6; if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) dev->hw_features |=3D NETIF_F_TSO_ECN; + if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_USO)) + dev->hw_features |=3D NETIF_F_GSO_UDP_L4; =20 dev->features |=3D NETIF_F_GSO_ROBUST; =20 @@ -4036,6 +4046,7 @@ static struct virtio_device_id id_table[] =3D { VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \ VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \ VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, \ + VIRTIO_NET_F_HOST_USO, VIRTIO_NET_F_GUEST_USO4, VIRTIO_NET_F_GUEST_USO6, \ VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, \ VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \ VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \ --=20 2.38.1