Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp592277pxk; Thu, 3 Sep 2020 07:47:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhkzUzuk+pYqtvcVP6JoMngSStWefYH8Q5LMzE2af1w7EHu2HX10r3xfysbHMJ5sFJOe05 X-Received: by 2002:a50:cc9a:: with SMTP id q26mr80649edi.64.1599144429156; Thu, 03 Sep 2020 07:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599144429; cv=none; d=google.com; s=arc-20160816; b=wurqvefA7cPLf1SLVtkoRsnrmhydtMwrpDMYF1Tm1HjtnGGL0UtTybJejCxyqgGDW8 r4+GDTlq38TTx9KXwuu1vErMGHJcWLQcItpMdigpT+LJ38I4DzKoFWNtRRDs64pYpQzj Is/tg7wkHWKI8zLQVH04Y9IPVvkhzgztZS3LrxcDHnnbUIA6Ghh+ljG2dzJVezq3CPep D8ciQpHDbonToAYMQzpBoRNoqo8PZYMGymJ4uBJY/cSN8Ba0qLD8rR66ql2mcROFb7Ou 8n2BroDZN/CdYFnPWqF5SYTdkLwE/n+4K72a5RIwS9r4W3GBi0JNEMur9vZj1HVud7A9 tm3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=A0ktENay/Ve8Sypkhy+s5o2Klgs+YyLhmo4gfIMO8Pk=; b=NfXyprfUR40rtZN4HZwt5hdrfac6+sjJZkg+Z/ziZN5VhDpQYm+2DCtbR7MJcR16fZ FTNQQ+dEueYflyetVtxr7mNcU0ywaJC7bXWHCqFu+pR9HusbTgfm3WtaCXRnZ0EaTVoD LW7kdQqOvKvFe9/k8fhLTFQzR+Ly9hgzGSSjhdYqaFdVcncfFoaWZ2d1aV6uOWvHaFCK fgXIZxJTE3hFGIcgqMxmf0n7gvioBWgwfjg4K4B5EE+p2b5N424vQM8NBKwpbIrS6paT kO4tXmIZ2lS4cFjbHwCMSsZGvsBI5UJHMjDAHkghjRgU4DFLkiPoPMytuxoll6clJnom Hqzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b14si1754878edv.405.2020.09.03.07.46.44; Thu, 03 Sep 2020 07:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729336AbgICOnk (ORCPT + 99 others); Thu, 3 Sep 2020 10:43:40 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:45838 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729355AbgICOgx (ORCPT ); Thu, 3 Sep 2020 10:36:53 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id DE721AFE559109854FAC; Thu, 3 Sep 2020 22:36:44 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Thu, 3 Sep 2020 22:36:38 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan Subject: [RFC V2 net-next 2/2] net: disable UDP GSO features when CSUM is disable Date: Thu, 3 Sep 2020 22:34:19 +0800 Message-ID: <1599143659-62176-3-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599143659-62176-1-git-send-email-tanhuazhong@huawei.com> References: <1599143659-62176-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CSUM is not available, UDP GSO should be disable as well. Signed-off-by: Huazhong Tan --- net/core/dev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/core/dev.c b/net/core/dev.c index d42c9ea..0c78306 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9402,6 +9402,18 @@ static netdev_features_t netdev_fix_features(struct net_device *dev, features &= ~NETIF_F_TSO6; } + if ((features & NETIF_F_GSO_UDP_L4) && !(features & NETIF_F_HW_CSUM) && + !(features & NETIF_F_IP_CSUM)) { + netdev_dbg(dev, "Dropping UDP GSO features since no CSUM feature.\n"); + features &= ~NETIF_F_GSO_UDP_L4; + } + + if ((features & NETIF_F_GSO_UDPV6_L4) && !(features & NETIF_F_HW_CSUM) && + !(features & NETIF_F_IPV6_CSUM)) { + netdev_dbg(dev, "Dropping UDPV6 GSO features since no CSUM feature.\n"); + features &= ~NETIF_F_GSO_UDPV6_L4; + } + /* TSO with IPv4 ID mangling requires IPv4 TSO be enabled */ if ((features & NETIF_F_TSO_MANGLEID) && !(features & NETIF_F_TSO)) features &= ~NETIF_F_TSO_MANGLEID; -- 2.7.4