Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1837780pxk; Fri, 4 Sep 2020 23:17:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4u+rq9v8IcH0RCL+llTuOp139qFypjUuY2zMsaN408SkXDf89hi3ramV0OEB3C3WOnNZs X-Received: by 2002:a17:906:c0d9:: with SMTP id bn25mr4363627ejb.246.1599286631024; Fri, 04 Sep 2020 23:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599286631; cv=none; d=google.com; s=arc-20160816; b=XHz2+encOh52Se32iSAK9dF30Wo22Ku/+InKtRGZhiM2Ojje+LhrP0spBUZX7KpNel t4pc9b95B1prwVHI/5XK1wy9fG0HI5o4nmTZxpeJVhD3jVcbTirWESBeio5Xu9YfL65/ yu1ngHjIfIOMbVRcANv3WYFcMSUeSRr04+TTywnjc8wOt4EoJosmMBsSbwMhNllQRM7g rYU3KnMd0Q3KIcM0IrjrKWKoIsVDPOYdUCafuTc+0Q99jpXx8UzjZvf5KeWp2De+pYBZ Ovf0dRa7O4fChnhm7HFk9zkJLQ4axySDAjQsy7DF7L5vwFqGfwa1GuIHL3OUJNdLNfW/ n4sg== 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=nj0RlmR0ArYIF4SOhN7xzoVjcrXmpd4VkTuEW+Ndh9/9s/HoXR0+dKVLNpzimBi3bY B1OVvThoPIR1PpNZ7GmnDToip7ISSp1PMoAqGRSiRDAg0ACH6vqa5x5N58E3gH6NgbLH jZ2NPdIoaNg+QhvKuCB/QcoUCjpi1M4sxUahLrgFXIW0+UJcR2XqCZ0Ajmre3e+EE8O0 AICSw16IN9TI60kAc1DZmGKwjo+vK65nmwp6P5nErjDT16/U//OTIrjLykAy6rWg1F/e kC0n/NNnXazzyrjjr+ryWj6O3gJSb2GJXvMijV+MIgJ4Wdb1YckJyUVuSh/erHsEVjAw WmPQ== 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 n2si6571340edi.15.2020.09.04.23.16.47; Fri, 04 Sep 2020 23:17:11 -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 S1726653AbgIEGNu (ORCPT + 99 others); Sat, 5 Sep 2020 02:13:50 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10819 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726065AbgIEGNs (ORCPT ); Sat, 5 Sep 2020 02:13:48 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C381FC90C41BB37DF5CD; Sat, 5 Sep 2020 14:13:44 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Sat, 5 Sep 2020 14:13:38 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan Subject: [PATCH net-next 2/2] net: disable UDP GSO features when CSUM is disable Date: Sat, 5 Sep 2020 14:11:13 +0800 Message-ID: <1599286273-26553-3-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599286273-26553-1-git-send-email-tanhuazhong@huawei.com> References: <1599286273-26553-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