Get rid of SCTP specific code to avoid CRC32C computations on loopback.

Just just offloading.
MFC after: 3 days
This commit is contained in:
tuexen 2012-05-26 09:16:33 +00:00
parent 713e6f8d0c
commit 520d26f351
4 changed files with 4 additions and 35 deletions

View File

@ -4116,14 +4116,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
#if defined(SCTP_WITH_NO_CSUM) #if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc); SCTP_STAT_INCR(sctps_sendnocrc);
#else #else
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr));
(stcb) && SCTP_STAT_INCR(sctps_sendswcrc);
(stcb->asoc.loopback_scope))) {
sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#endif #endif
if (V_udp_cksum) { if (V_udp_cksum) {
SCTP_ENABLE_UDP_CSUM(o_pak); SCTP_ENABLE_UDP_CSUM(o_pak);
@ -4474,14 +4468,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
#if defined(SCTP_WITH_NO_CSUM) #if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc); SCTP_STAT_INCR(sctps_sendnocrc);
#else #else
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
(stcb) && SCTP_STAT_INCR(sctps_sendswcrc);
(stcb->asoc.loopback_scope))) {
sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#endif #endif
if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) { 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; udp->uh_sum = 0xffff;

View File

@ -55,9 +55,6 @@ sctp_init_sysctls()
SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT; SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT;
SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT;
SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT; SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT;
#if !defined(SCTP_WITH_NO_CSUM)
SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT;
#endif
SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT; SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT;
SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT; SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT;
SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = SCTPCTL_FRMAXBURST_DEFAULT; SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = SCTPCTL_FRMAXBURST_DEFAULT;
@ -604,9 +601,6 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
#if !defined(SCTP_WITH_NO_CSUM)
RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
#endif
RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX);
@ -870,11 +864,6 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_UINT | CTLFLAG_
&SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU", &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU",
SCTPCTL_STRICT_SACKS_DESC); SCTPCTL_STRICT_SACKS_DESC);
#if !defined(SCTP_WITH_NO_CSUM)
SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_UINT | CTLFLAG_RW,
&SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU",
SCTPCTL_LOOPBACK_NOCSUM_DESC);
#endif
SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_UINT | CTLFLAG_RW, SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_UINT | CTLFLAG_RW,
&SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU", &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU",

View File

@ -47,9 +47,6 @@ struct sctp_sysctl {
uint32_t sctp_ecn_enable; uint32_t sctp_ecn_enable;
uint32_t sctp_fr_max_burst_default; uint32_t sctp_fr_max_burst_default;
uint32_t sctp_strict_sacks; uint32_t sctp_strict_sacks;
#if !defined(SCTP_WITH_NO_CSUM)
uint32_t sctp_no_csum_on_loopback;
#endif
uint32_t sctp_peer_chunk_oh; uint32_t sctp_peer_chunk_oh;
uint32_t sctp_max_burst_default; uint32_t sctp_max_burst_default;
uint32_t sctp_max_chunks_on_queue; uint32_t sctp_max_chunks_on_queue;

View File

@ -150,11 +150,6 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
goto sctp_skip_csum; goto sctp_skip_csum;
} }
check = sh->checksum; /* save incoming checksum */ check = sh->checksum; /* save incoming checksum */
if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) &&
(IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &ip6->ip6_dst))) {
SCTP_STAT_INCR(sctps_recvnocrc);
goto sctp_skip_csum;
}
sh->checksum = 0; /* prepare for calc */ sh->checksum = 0; /* prepare for calc */
calc_check = sctp_calculate_cksum(m, iphlen); calc_check = sctp_calculate_cksum(m, iphlen);
SCTP_STAT_INCR(sctps_recvswcrc); SCTP_STAT_INCR(sctps_recvswcrc);