lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240703224850.1226697-8-tom@herbertland.com>
Date: Wed,  3 Jul 2024 15:48:47 -0700
From: Tom Herbert <tom@...bertland.com>
To: davem@...emloft.net,
	kuba@...nel.org,
	jesse.brandeburg@...el.com,
	anthony.l.nguyen@...el.com,
	cai.huoqing@...ux.dev,
	netdev@...r.kernel.org,
	felipe@...anda.io
Cc: Tom Herbert <tom@...bertland.com>
Subject: [RFC net-next 07/10] hisilicon: Call skb_set_csum_crc32_unnecessary

When a validated offload CRC for SCTP is detected call
skb_set_csum_crc32_unnessary instead of setting
CHECKSUM_UNNECESSARY

Signed-off-by: Tom Herbert <tom@...bertland.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c  |  5 ++++-
 .../net/ethernet/hisilicon/hns3/hns3_enet.c    | 18 +++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index fd32e15cadcb..f3e8b9cb3779 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -556,7 +556,10 @@ static void hns_nic_rx_checksum(struct hns_nic_ring_data *ring_data,
 		return;
 
 	/* now, this has to be a packet with valid RX checksum */
-	skb->ip_summed = CHECKSUM_UNNECESSARY;
+	if (l4id == HNS_RX_FLAG_L4ID_SCTP)
+		skb_set_csum_crc32_unnecessary(skb);
+	else
+		skb->ip_summed = CHECKSUM_UNNECESSARY;
 }
 
 static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index a5fc0209d628..5fd98854f72d 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3908,11 +3908,19 @@ static void hns3_rx_handle_csum(struct sk_buff *skb, u32 l234info,
 					  HNS3_RXD_L4ID_S);
 		/* Can checksum ipv4 or ipv6 + UDP/TCP/SCTP packets */
 		if ((l3_type == HNS3_L3_TYPE_IPV4 ||
-		     l3_type == HNS3_L3_TYPE_IPV6) &&
-		    (l4_type == HNS3_L4_TYPE_UDP ||
-		     l4_type == HNS3_L4_TYPE_TCP ||
-		     l4_type == HNS3_L4_TYPE_SCTP))
-			skb->ip_summed = CHECKSUM_UNNECESSARY;
+		     l3_type == HNS3_L3_TYPE_IPV6)) {
+			switch (l4_type) {
+			case HNS3_L4_TYPE_UDP:
+			case HNS3_L4_TYPE_TCP:
+				skb->ip_summed = CHECKSUM_UNNECESSARY;
+				break;
+			case HNS3_L4_TYPE_SCTP:
+				skb_set_csum_crc32_unnecessary(skb);
+				break;
+			default:
+				break;
+			}
+		}
 		break;
 	default:
 		break;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ