summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2018-04-07 20:22:04 +0000
committertuexen <tuexen@FreeBSD.org>2018-04-07 20:22:04 +0000
commit80f7afa5b5d86492aee1e5e67fe7cc0e71956649 (patch)
treeef58638bfb895550d8304b07396d73e1ffdde87a
parent95c4ead90d61519b3e0a4cb7b9f5f5b296ae9644 (diff)
downloadFreeBSD-src-80f7afa5b5d86492aee1e5e67fe7cc0e71956649.zip
FreeBSD-src-80f7afa5b5d86492aee1e5e67fe7cc0e71956649.tar.gz
MFC r326672:
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.
-rw-r--r--sys/conf/NOTES15
-rw-r--r--sys/conf/options1
-rw-r--r--sys/netinet/sctp_crc32.c8
-rw-r--r--sys/netinet/sctp_crc32.h2
-rw-r--r--sys/netinet/sctp_input.c12
-rw-r--r--sys/netinet/sctp_input.h2
-rw-r--r--sys/netinet/sctp_output.c32
-rw-r--r--sys/netinet/sctp_sysctl.c2
-rw-r--r--sys/netinet/sctp_uio.h4
-rw-r--r--sys/netinet6/sctp6_usrreq.c8
-rw-r--r--usr.bin/systat/sctp.c2
11 files changed, 2 insertions, 86 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 28e7e2b..9503d31 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -664,21 +664,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
diff --git a/sys/conf/options b/sys/conf/options
index d909f36..b3eb1d6 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -462,7 +462,6 @@ FLOWTABLE_HASH_ALL opt_route.h
#
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
diff --git a/sys/netinet/sctp_crc32.c b/sys/netinet/sctp_crc32.c
index 93d26ea..816d8a4 100644
--- a/sys/netinet/sctp_crc32.c
+++ b/sys/netinet/sctp_crc32.c
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
#include <netinet/sctp_pcb.h>
-#if !defined(SCTP_WITH_NO_CSUM)
static uint32_t
sctp_finalize_crc32c(uint32_t crc32c)
@@ -113,17 +112,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);
@@ -142,5 +135,4 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
return;
}
*(uint32_t *)(m->m_data + offset) = checksum;
-#endif
}
diff --git a/sys/netinet/sctp_crc32.h b/sys/netinet/sctp_crc32.h
index 7fe02f5..04a0d38 100644
--- a/sys/netinet/sctp_crc32.h
+++ b/sys/netinet/sctp_crc32.h
@@ -37,9 +37,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__ */
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index 2c16db9..44bf827 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -5496,9 +5496,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)
@@ -5518,7 +5516,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
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;
@@ -5563,7 +5560,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
goto out;
}
}
-#endif
/* Destination port of 0 is illegal, based on RFC4960. */
if (sh->dest_port == 0) {
SCTP_STAT_INCR(sctps_hdrops);
@@ -5881,9 +5877,7 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
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;
@@ -5953,9 +5947,6 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
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;
@@ -5963,14 +5954,11 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
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);
diff --git a/sys/netinet/sctp_input.h b/sys/netinet/sctp_input.h
index 25df0f3..19ed9fb 100644
--- a/sys/netinet/sctp_input.h
+++ b/sys/netinet/sctp_input.h
@@ -41,9 +41,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);
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 2a667c1..bc9dc57 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -4224,23 +4224,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)
@@ -4564,23 +4556,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)
@@ -11225,23 +11209,15 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
}
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) {
@@ -11255,23 +11231,15 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
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) {
diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c
index f8d9745..f4c58ca 100644
--- a/sys/netinet/sctp_sysctl.c
+++ b/sys/netinet/sctp_sysctl.c
@@ -713,7 +713,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;
@@ -726,7 +725,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;
diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h
index daa6847..823947e 100644
--- a/sys/netinet/sctp_uio.h
+++ b/sys/netinet/sctp_uio.h
@@ -984,7 +984,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;
@@ -1004,7 +1004,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: */
diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index a61eae1..125706a 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -69,9 +69,7 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
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;
@@ -142,9 +140,6 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
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;
@@ -152,14 +147,11 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
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);
diff --git a/usr.bin/systat/sctp.c b/usr.bin/systat/sctp.c
index ea0edd8..1e6a67c 100644
--- a/usr.bin/systat/sctp.c
+++ b/usr.bin/systat/sctp.c
@@ -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);
OpenPOWER on IntegriCloud