Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Dec 2017 22:19:08 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326672 - in head: sys/conf sys/netinet sys/netinet6 usr.bin/systat
Message-ID:  <201712072219.vB7MJ8lT051499@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Thu Dec  7 22:19:08 2017
New Revision: 326672
URL: https://svnweb.freebsd.org/changeset/base/326672

Log:
  Retire SCTP_WITH_NO_CSUM option.
  
  This option was used in the early days to allow performance measurements
  extrapolating the use of SCTP checksum offloading. Since this feature
  is now available, get rid of this option.
  This also un-breaks the LINT kernel. Thanks to markj@ for making me
  aware of the problem.

Modified:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/netinet/sctp_crc32.c
  head/sys/netinet/sctp_crc32.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_input.h
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_uio.h
  head/sys/netinet6/sctp6_usrreq.c
  head/usr.bin/systat/sctp.c

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/conf/NOTES	Thu Dec  7 22:19:08 2017	(r326672)
@@ -675,21 +675,6 @@ options 	SCTP
 # faster.. if you are not debugging don't use.
 options 	SCTP_DEBUG
 #
-# This option turns off the CRC32c checksum. Basically,
-# you will not be able to talk to anyone else who
-# has not done this. Its more for experimentation to
-# see how much CPU the CRC32c really takes. Most new
-# cards for TCP support checksum offload.. so this 
-# option gives you a "view" into what SCTP would be
-# like with such an offload (which only exists in
-# high in iSCSI boards so far). With the new
-# splitting 8's algorithm its not as bad as it used
-# to be.. but it does speed things up try only
-# for in a captured lab environment :-)
-options 	SCTP_WITH_NO_CSUM
-#
-
-#
 # All that options after that turn on specific types of
 # logging. You can monitor CWND growth, flight size
 # and all sorts of things. Go look at the code and

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/conf/options	Thu Dec  7 22:19:08 2017	(r326672)
@@ -458,7 +458,6 @@ XBONEHACK
 #
 SCTP			opt_sctp.h
 SCTP_DEBUG		opt_sctp.h # Enable debug printfs
-SCTP_WITH_NO_CSUM	opt_sctp.h # Use this at your peril
 SCTP_LOCK_LOGGING	opt_sctp.h # Log to KTR lock activity
 SCTP_MBUF_LOGGING	opt_sctp.h # Log to KTR general mbuf aloc/free
 SCTP_MBCNT_LOGGING	opt_sctp.h # Log to KTR mbcnt activity

Modified: head/sys/netinet/sctp_crc32.c
==============================================================================
--- head/sys/netinet/sctp_crc32.c	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet/sctp_crc32.c	Thu Dec  7 22:19:08 2017	(r326672)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include <netinet/sctp_pcb.h>
 
 
-#if !defined(SCTP_WITH_NO_CSUM)
 
 static uint32_t
 sctp_finalize_crc32c(uint32_t crc32c)
@@ -115,17 +114,11 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
 	base = sctp_finalize_crc32c(base);
 	return (base);
 }
-#endif				/* !defined(SCTP_WITH_NO_CSUM) */
 
 
 void
 sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
 {
-#if defined(SCTP_WITH_NO_CSUM)
-#ifdef INVARIANTS
-	panic("sctp_delayed_cksum() called when using no SCTP CRC.");
-#endif
-#else
 	uint32_t checksum;
 
 	checksum = sctp_calculate_cksum(m, offset);
@@ -144,5 +137,4 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
 		return;
 	}
 	*(uint32_t *)(m->m_data + offset) = checksum;
-#endif
 }

Modified: head/sys/netinet/sctp_crc32.h
==============================================================================
--- head/sys/netinet/sctp_crc32.h	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet/sctp_crc32.h	Thu Dec  7 22:19:08 2017	(r326672)
@@ -39,9 +39,7 @@ __FBSDID("$FreeBSD$");
 #define _NETINET_SCTP_CRC32_H_
 
 #if defined(_KERNEL)
-#if !defined(SCTP_WITH_NO_CSUM)
 uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t);
-#endif
 void sctp_delayed_cksum(struct mbuf *, uint32_t offset);
 #endif				/* _KERNEL */
 #endif				/* __crc32c_h__ */

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet/sctp_input.c	Thu Dec  7 22:19:08 2017	(r326672)
@@ -5507,9 +5507,7 @@ void
 sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length,
     struct sockaddr *src, struct sockaddr *dst,
     struct sctphdr *sh, struct sctp_chunkhdr *ch,
-#if !defined(SCTP_WITH_NO_CSUM)
     uint8_t compute_crc,
-#endif
     uint8_t ecn_bits,
     uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum,
     uint32_t vrf_id, uint16_t port)
@@ -5529,7 +5527,6 @@ sctp_common_input_processing(struct mbuf **mm, int iph
 	sctp_audit_log(0xE0, 1);
 	sctp_auditing(0, inp, stcb, net);
 #endif
-#if !defined(SCTP_WITH_NO_CSUM)
 	if (compute_crc != 0) {
 		uint32_t check, calc_check;
 
@@ -5574,7 +5571,6 @@ sctp_common_input_processing(struct mbuf **mm, int iph
 			goto out;
 		}
 	}
-#endif
 	/* Destination port of 0 is illegal, based on RFC4960. */
 	if (sh->dest_port == 0) {
 		SCTP_STAT_INCR(sctps_hdrops);
@@ -5892,9 +5888,7 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint
 	struct sctphdr *sh;
 	struct sctp_chunkhdr *ch;
 	int length, offset;
-#if !defined(SCTP_WITH_NO_CSUM)
 	uint8_t compute_crc;
-#endif
 	uint32_t mflowid;
 	uint8_t mflowtype;
 	uint16_t fibnum;
@@ -5964,9 +5958,6 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint
 		goto out;
 	}
 	ecn_bits = ip->ip_tos;
-#if defined(SCTP_WITH_NO_CSUM)
-	SCTP_STAT_INCR(sctps_recvnocrc);
-#else
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
 		SCTP_STAT_INCR(sctps_recvhwcrc);
 		compute_crc = 0;
@@ -5974,14 +5965,11 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint
 		SCTP_STAT_INCR(sctps_recvswcrc);
 		compute_crc = 1;
 	}
-#endif
 	sctp_common_input_processing(&m, iphlen, offset, length,
 	    (struct sockaddr *)&src,
 	    (struct sockaddr *)&dst,
 	    sh, ch,
-#if !defined(SCTP_WITH_NO_CSUM)
 	    compute_crc,
-#endif
 	    ecn_bits,
 	    mflowtype, mflowid, fibnum,
 	    vrf_id, port);

Modified: head/sys/netinet/sctp_input.h
==============================================================================
--- head/sys/netinet/sctp_input.h	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet/sctp_input.h	Thu Dec  7 22:19:08 2017	(r326672)
@@ -43,9 +43,7 @@ void
 sctp_common_input_processing(struct mbuf **, int, int, int,
     struct sockaddr *, struct sockaddr *,
     struct sctphdr *, struct sctp_chunkhdr *,
-#if !defined(SCTP_WITH_NO_CSUM)
     uint8_t,
-#endif
     uint8_t,
     uint8_t, uint32_t, uint16_t,
     uint32_t, uint16_t);

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet/sctp_output.c	Thu Dec  7 22:19:08 2017	(r326672)
@@ -4226,23 +4226,15 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
 			}
 			SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
 			if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
-				SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 				sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr));
 				SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
 				if (V_udp_cksum) {
 					SCTP_ENABLE_UDP_CSUM(o_pak);
 				}
 			} else {
-#if defined(SCTP_WITH_NO_CSUM)
-				SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 				m->m_pkthdr.csum_flags = CSUM_SCTP;
 				m->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
 				SCTP_STAT_INCR(sctps_sendhwcrc);
-#endif
 			}
 #ifdef SCTP_PACKET_LOGGING
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
@@ -4566,23 +4558,15 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
 			}
 			SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
 			if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
-				SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 				sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
 				SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
 				if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) {
 					udp->uh_sum = 0xffff;
 				}
 			} else {
-#if defined(SCTP_WITH_NO_CSUM)
-				SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 				m->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
 				m->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
 				SCTP_STAT_INCR(sctps_sendhwcrc);
-#endif
 			}
 			/* send it out. table id is taken from stcb */
 #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
@@ -11227,23 +11211,15 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockad
 		}
 		ip->ip_len = htons(len);
 		if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
-			SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 			shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip) + sizeof(struct udphdr));
 			SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
 			if (V_udp_cksum) {
 				SCTP_ENABLE_UDP_CSUM(o_pak);
 			}
 		} else {
-#if defined(SCTP_WITH_NO_CSUM)
-			SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 			mout->m_pkthdr.csum_flags = CSUM_SCTP;
 			mout->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
 			SCTP_STAT_INCR(sctps_sendhwcrc);
-#endif
 		}
 #ifdef SCTP_PACKET_LOGGING
 		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
@@ -11257,23 +11233,15 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockad
 	case AF_INET6:
 		ip6->ip6_plen = (uint16_t)(len - sizeof(struct ip6_hdr));
 		if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
-			SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 			shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
 			SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
 			if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) {
 				udp->uh_sum = 0xffff;
 			}
 		} else {
-#if defined(SCTP_WITH_NO_CSUM)
-			SCTP_STAT_INCR(sctps_sendnocrc);
-#else
 			mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
 			mout->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
 			SCTP_STAT_INCR(sctps_sendhwcrc);
-#endif
 		}
 #ifdef SCTP_PACKET_LOGGING
 		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet/sctp_sysctl.c	Thu Dec  7 22:19:08 2017	(r326672)
@@ -716,7 +716,6 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ARGS)
 		sb.sctps_recvauthfailed += sarry->sctps_recvauthfailed;
 		sb.sctps_recvexpress += sarry->sctps_recvexpress;
 		sb.sctps_recvexpressm += sarry->sctps_recvexpressm;
-		sb.sctps_recvnocrc += sarry->sctps_recvnocrc;
 		sb.sctps_recvswcrc += sarry->sctps_recvswcrc;
 		sb.sctps_recvhwcrc += sarry->sctps_recvhwcrc;
 		sb.sctps_sendpackets += sarry->sctps_sendpackets;
@@ -729,7 +728,6 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ARGS)
 		sb.sctps_sendecne += sarry->sctps_sendecne;
 		sb.sctps_sendauth += sarry->sctps_sendauth;
 		sb.sctps_senderrors += sarry->sctps_senderrors;
-		sb.sctps_sendnocrc += sarry->sctps_sendnocrc;
 		sb.sctps_sendswcrc += sarry->sctps_sendswcrc;
 		sb.sctps_sendhwcrc += sarry->sctps_sendhwcrc;
 		sb.sctps_pdrpfmbox += sarry->sctps_pdrpfmbox;

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet/sctp_uio.h	Thu Dec  7 22:19:08 2017	(r326672)
@@ -986,7 +986,7 @@ struct sctpstat {
 	uint32_t sctps_recvexpress;	/* total fast path receives all one
 					 * chunk */
 	uint32_t sctps_recvexpressm;	/* total fast path multi-part data */
-	uint32_t sctps_recvnocrc;
+	uint32_t sctps_recv_spare;	/* formerly sctps_recvnocrc */
 	uint32_t sctps_recvswcrc;
 	uint32_t sctps_recvhwcrc;
 
@@ -1006,7 +1006,7 @@ struct sctpstat {
 	uint32_t sctps_sendecne;/* total output ECNE chunks    */
 	uint32_t sctps_sendauth;/* total output AUTH chunks FIXME   */
 	uint32_t sctps_senderrors;	/* ip_output error counter */
-	uint32_t sctps_sendnocrc;
+	uint32_t sctps_send_spare;	/* formerly sctps_sendnocrc */
 	uint32_t sctps_sendswcrc;
 	uint32_t sctps_sendhwcrc;
 	/* PCKDROPREP statistics: */

Modified: head/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- head/sys/netinet6/sctp6_usrreq.c	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/sys/netinet6/sctp6_usrreq.c	Thu Dec  7 22:19:08 2017	(r326672)
@@ -71,9 +71,7 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, 
 	struct sctphdr *sh;
 	struct sctp_chunkhdr *ch;
 	int length, offset;
-#if !defined(SCTP_WITH_NO_CSUM)
 	uint8_t compute_crc;
-#endif
 	uint32_t mflowid;
 	uint8_t mflowtype;
 	uint16_t fibnum;
@@ -144,9 +142,6 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, 
 		goto out;
 	}
 	ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff);
-#if defined(SCTP_WITH_NO_CSUM)
-	SCTP_STAT_INCR(sctps_recvnocrc);
-#else
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
 		SCTP_STAT_INCR(sctps_recvhwcrc);
 		compute_crc = 0;
@@ -154,14 +149,11 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, 
 		SCTP_STAT_INCR(sctps_recvswcrc);
 		compute_crc = 1;
 	}
-#endif
 	sctp_common_input_processing(&m, iphlen, offset, length,
 	    (struct sockaddr *)&src,
 	    (struct sockaddr *)&dst,
 	    sh, ch,
-#if !defined(SCTP_WITH_NO_CSUM)
 	    compute_crc,
-#endif
 	    ecn_bits,
 	    mflowtype, mflowid, fibnum,
 	    vrf_id, port);

Modified: head/usr.bin/systat/sctp.c
==============================================================================
--- head/usr.bin/systat/sctp.c	Thu Dec  7 22:11:23 2017	(r326671)
+++ head/usr.bin/systat/sctp.c	Thu Dec  7 22:19:08 2017	(r326672)
@@ -180,7 +180,6 @@ domode(struct sctpstat *ret)
 	DO(sctps_recvauthfailed);
 	DO(sctps_recvexpress);
 	DO(sctps_recvexpressm);
-	DO(sctps_recvnocrc);
 	DO(sctps_recvswcrc);
 	DO(sctps_recvhwcrc);
 
@@ -194,7 +193,6 @@ domode(struct sctpstat *ret)
 	DO(sctps_sendecne);
 	DO(sctps_sendauth);
 	DO(sctps_senderrors);
-	DO(sctps_sendnocrc);
 	DO(sctps_sendswcrc);
 	DO(sctps_sendhwcrc);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712072219.vB7MJ8lT051499>