[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1599143659-62176-3-git-send-email-tanhuazhong@huawei.com>
Date: Thu, 3 Sep 2020 22:34:19 +0800
From: Huazhong Tan <tanhuazhong@...wei.com>
To: <davem@...emloft.net>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<salil.mehta@...wei.com>, <yisen.zhuang@...wei.com>,
<linuxarm@...wei.com>, <kuba@...nel.org>,
Huazhong Tan <tanhuazhong@...wei.com>
Subject: [RFC V2 net-next 2/2] net: disable UDP GSO features when CSUM is disable
When CSUM is not available, UDP GSO should be disable as well.
Signed-off-by: Huazhong Tan <tanhuazhong@...wei.com>
---
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
Powered by blists - more mailing lists