summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2012-05-25 02:23:26 +0000
committerbz <bz@FreeBSD.org>2012-05-25 02:23:26 +0000
commit36fe475aa40328c1d04ccc35a5549fcacdb7dfad (patch)
treefc2422cd5a4f37a0bea52d726520687602518d46 /sys/netinet/tcp_syncache.c
parentbc95289fae2caae23a78aa1ce4349ab438002a1f (diff)
downloadFreeBSD-src-36fe475aa40328c1d04ccc35a5549fcacdb7dfad.zip
FreeBSD-src-36fe475aa40328c1d04ccc35a5549fcacdb7dfad.tar.gz
MFp4 bz_ipv6_fast:
Add code to handle pre-checked TCP checksums as indicated by mbuf flags to save the entire computation for validation if not needed. In the IPv6 TCP output path only compute the pseudo-header checksum, set the checksum offset in the mbuf field along the appropriate flag as done in IPv4. In tcp_respond() just initialize the IPv6 payload length to 0 as ip6_output() will properly set it. Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Reviewed by: gnn (as part of the whole) MFC After: 3 days
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 8df7ce0..fcac95f 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1473,11 +1473,12 @@ syncache_respond(struct syncache *sc)
optlen = 0;
M_SETFIB(m, sc->sc_inc.inc_fibnum);
+ m->m_pkthdr.csum_flags = CSUM_TCP;
+ m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
#ifdef INET6
if (sc->sc_inc.inc_flags & INC_ISIPV6) {
- th->th_sum = 0;
- th->th_sum = in6_cksum(m, IPPROTO_TCP, hlen,
- tlen + optlen - hlen);
+ th->th_sum = in6_cksum_pseudo(ip6, tlen + optlen - hlen,
+ IPPROTO_TCP, 0);
ip6->ip6_hlim = in6_selecthlim(NULL, NULL);
error = ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
}
@@ -1489,8 +1490,6 @@ syncache_respond(struct syncache *sc)
{
th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
htons(tlen + optlen - hlen + IPPROTO_TCP));
- m->m_pkthdr.csum_flags = CSUM_TCP;
- m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
error = ip_output(m, sc->sc_ipopts, NULL, 0, NULL, NULL);
}
#endif
OpenPOWER on IntegriCloud