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

sctp: Allow to disable SCTP checksums via module parameter

This is a new version of my patch, now using a module parameter instead
of a sysctl, so that the option is harder to find. Please note that,
once the module is loaded, it is still possible to change the value of
the parameter in /sys/module/sctp/parameters/, which is useful if you
want to do performance comparisons without rebooting.

Computation of SCTP checksums significantly affects the performance of
SCTP. For example, using two dual-Opteron 246 connected using a Gbe
network, it was not possible to achieve more than ~730 Mbps, compared to
941 Mbps after disabling SCTP checksums.
Unfortunately, SCTP checksum offloading in NICs is not commonly
available (yet).

By default, checksums are still enabled, of course.

Signed-off-by: Lucas Nussbaum <lucas.nussbaum@ens-lyon.fr>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Lucas Nussbaum and committed by
David S. Miller
06e86806 85e8d004

+10 -2
+5
include/net/sctp/structs.h
··· 218 218 219 219 /* Flag to idicate if SCTP-AUTH is enabled */ 220 220 int auth_enable; 221 + 222 + /* Flag to indicate whether computing and verifying checksum 223 + * is disabled. */ 224 + int checksum_disable; 221 225 } sctp_globals; 222 226 223 227 #define sctp_rto_initial (sctp_globals.rto_initial) ··· 256 252 #define sctp_addip_noauth (sctp_globals.addip_noauth_enable) 257 253 #define sctp_prsctp_enable (sctp_globals.prsctp_enable) 258 254 #define sctp_auth_enable (sctp_globals.auth_enable) 255 + #define sctp_checksum_disable (sctp_globals.checksum_disable) 259 256 260 257 /* SCTP Socket type: UDP or TCP style. */ 261 258 typedef enum {
+2 -1
net/sctp/input.c
··· 142 142 __skb_pull(skb, skb_transport_offset(skb)); 143 143 if (skb->len < sizeof(struct sctphdr)) 144 144 goto discard_it; 145 - if (!skb_csum_unnecessary(skb) && sctp_rcv_checksum(skb) < 0) 145 + if (!sctp_checksum_disable && !skb_csum_unnecessary(skb) && 146 + sctp_rcv_checksum(skb) < 0) 146 147 goto discard_it; 147 148 148 149 skb_pull(skb, sizeof(struct sctphdr));
+1 -1
net/sctp/output.c
··· 531 531 * Note: Adler-32 is no longer applicable, as has been replaced 532 532 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. 533 533 */ 534 - if (!(dst->dev->features & NETIF_F_NO_CSUM)) { 534 + if (!sctp_checksum_disable && !(dst->dev->features & NETIF_F_NO_CSUM)) { 535 535 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); 536 536 crc32 = sctp_end_cksum(crc32); 537 537 } else
+2
net/sctp/protocol.c
··· 1411 1411 MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132"); 1412 1412 MODULE_AUTHOR("Linux Kernel SCTP developers <lksctp-developers@lists.sourceforge.net>"); 1413 1413 MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)"); 1414 + module_param_named(no_checksums, sctp_checksum_disable, bool, 0644); 1415 + MODULE_PARM_DESC(no_checksums, "Disable checksums computing and verification"); 1414 1416 MODULE_LICENSE("GPL");