summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2004-06-23 21:04:37 +0000
committerps <ps@FreeBSD.org>2004-06-23 21:04:37 +0000
commitf5f3e8600b5cd41c8645b3a5d45e20092a8b9ee1 (patch)
tree37eceb1297375660ec2d161a79ee2ec7364248b3 /sys/netinet/tcp_syncache.c
parent933faf5c3e0325440e1ef2edac115dd64ece174c (diff)
downloadFreeBSD-src-f5f3e8600b5cd41c8645b3a5d45e20092a8b9ee1.zip
FreeBSD-src-f5f3e8600b5cd41c8645b3a5d45e20092a8b9ee1.tar.gz
Add support for TCP Selective Acknowledgements. The work for this
originated on RELENG_4 and was ported to -CURRENT. The scoreboarding code was obtained from OpenBSD, and many of the remaining changes were inspired by OpenBSD, but not taken directly from there. You can enable/disable sack using net.inet.tcp.do_sack. You can also limit the number of sack holes that all senders can have in the scoreboard with net.inet.tcp.sackhole_limit. Reviewed by: gnn Obtained from: Yahoo! (Mohan Srinivasan, Jayanth Vijayaraghavan)
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 57d6a93..dbbfbb1 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -39,6 +39,7 @@
#include "opt_ipsec.h"
#include "opt_mac.h"
#include "opt_tcpdebug.h"
+#include "opt_tcp_sack.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -704,7 +705,10 @@ syncache_socket(sc, lso, m)
if (sc->sc_flags & SCF_SIGNATURE)
tp->t_flags |= TF_SIGNATURE;
#endif
-
+ if (sc->sc_flags & SCF_SACK) {
+ tp->sack_enable = 1;
+ tp->t_flags |= TF_SACK_PERMIT;
+ }
/*
* Set up MSS and get cached values from tcp_hostcache.
* This might overwrite some of the defaults we just set.
@@ -991,6 +995,9 @@ syncache_add(inc, to, th, sop, m)
sc->sc_flags = SCF_SIGNATURE;
#endif
+ if (to->to_flags & TOF_SACK)
+ sc->sc_flags |= SCF_SACK;
+
/*
* XXX
* We have the option here of not doing TAO (even if the segment
@@ -1107,6 +1114,7 @@ syncache_respond(sc, m)
optlen += (sc->sc_flags & SCF_SIGNATURE) ?
TCPOLEN_SIGNATURE + 2 : 0;
#endif
+ optlen += ((sc->sc_flags & SCF_SACK) ? 4 : 0);
}
tlen = hlen + sizeof(struct tcphdr) + optlen;
@@ -1244,6 +1252,11 @@ syncache_respond(sc, m)
optp += TCPOLEN_SIGNATURE + 2;
}
#endif /* TCP_SIGNATURE */
+
+ if (sc->sc_flags & SCF_SACK) {
+ *(u_int32_t *)optp = htonl(TCPOPT_SACK_PERMIT_HDR);
+ optp += 4;
+ }
}
#ifdef INET6
OpenPOWER on IntegriCloud