Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sctp: use skb_crc32c() instead of __skb_checksum()

Make sctp_compute_cksum() just use the new function skb_crc32c(),
instead of calling __skb_checksum() with a skb_checksum_ops struct that
does CRC32C. This is faster and simpler.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://patch.msgid.link/20250519175012.36581-6-ebiggers@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Biggers and committed by
Jakub Kicinski
99de9d40 62673b7d

+8 -33
+3 -26
include/net/sctp/checksum.h
··· 15 15 * Dinakaran Joseph 16 16 * Jon Grimm <jgrimm@us.ibm.com> 17 17 * Sridhar Samudrala <sri@us.ibm.com> 18 - * 19 - * Rewritten to use libcrc32c by: 20 18 * Vlad Yasevich <vladislav.yasevich@hp.com> 21 19 */ 22 20 ··· 23 25 24 26 #include <linux/types.h> 25 27 #include <linux/sctp.h> 26 - #include <linux/crc32c.h> 27 - #include <linux/crc32.h> 28 - 29 - static inline __wsum sctp_csum_update(const void *buff, int len, __wsum sum) 30 - { 31 - return (__force __wsum)crc32c((__force __u32)sum, buff, len); 32 - } 33 - 34 - static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2, 35 - int offset, int len) 36 - { 37 - return (__force __wsum)crc32c_combine((__force __u32)csum, 38 - (__force __u32)csum2, len); 39 - } 40 - 41 - static const struct skb_checksum_ops sctp_csum_ops = { 42 - .update = sctp_csum_update, 43 - .combine = sctp_csum_combine, 44 - }; 45 28 46 29 static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, 47 30 unsigned int offset) 48 31 { 49 32 struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); 50 33 __le32 old = sh->checksum; 51 - __wsum new; 34 + u32 new; 52 35 53 36 sh->checksum = 0; 54 - new = ~__skb_checksum(skb, offset, skb->len - offset, ~(__wsum)0, 55 - &sctp_csum_ops); 37 + new = ~skb_crc32c(skb, offset, skb->len - offset, ~0); 56 38 sh->checksum = old; 57 - 58 - return cpu_to_le32((__force __u32)new); 39 + return cpu_to_le32(new); 59 40 } 60 41 61 42 #endif /* __sctp_checksum_h__ */
+2 -2
net/netfilter/Kconfig
··· 212 212 bool 'SCTP protocol connection tracking support' 213 213 depends on NETFILTER_ADVANCED 214 214 default y 215 - select CRC32 215 + select NET_CRC32C 216 216 help 217 217 With this option enabled, the layer 3 independent connection 218 218 tracking code will be able to do state tracking on SCTP connections. ··· 475 475 476 476 config NF_TABLES 477 477 select NETFILTER_NETLINK 478 - select CRC32 478 + select NET_CRC32C 479 479 tristate "Netfilter nf_tables support" 480 480 help 481 481 nftables is the new packet classification framework that intends to
+1 -1
net/netfilter/ipvs/Kconfig
··· 105 105 106 106 config IP_VS_PROTO_SCTP 107 107 bool "SCTP load balancing support" 108 - select CRC32 108 + select NET_CRC32C 109 109 help 110 110 This option enables support for load balancing SCTP transport 111 111 protocol. Say Y if unsure.
+1 -1
net/openvswitch/Kconfig
··· 11 11 (!NF_NAT || NF_NAT) && \ 12 12 (!NETFILTER_CONNCOUNT || NETFILTER_CONNCOUNT))) 13 13 depends on PSAMPLE || !PSAMPLE 14 - select CRC32 15 14 select MPLS 15 + select NET_CRC32C 16 16 select NET_MPLS_GSO 17 17 select DST_CACHE 18 18 select NET_NSH
+1 -1
net/sched/Kconfig
··· 796 796 config NET_ACT_CSUM 797 797 tristate "Checksum Updating" 798 798 depends on NET_CLS_ACT && INET 799 - select CRC32 799 + select NET_CRC32C 800 800 help 801 801 Say Y here to update some common checksum after some direct 802 802 packet alterations.
-1
net/sctp/Kconfig
··· 7 7 tristate "The SCTP Protocol" 8 8 depends on INET 9 9 depends on IPV6 || IPV6=n 10 - select CRC32 11 10 select CRYPTO 12 11 select CRYPTO_HMAC 13 12 select CRYPTO_SHA1
-1
net/sctp/offload.c
··· 111 111 if (ret) 112 112 goto ipv4; 113 113 114 - crc32c_csum_stub = &sctp_csum_ops; 115 114 return ret; 116 115 117 116 ipv4: