From fa1b6ee45fb3ba2b5a8c0696f3f9c1645fb95586 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Wed, 11 Apr 2012 17:57:43 +0800 Subject: [PATCH] tcp: Increase IW to 2 segments, if RFC3390 is not enabled. First of all, RFC2581 allows this. Additionally, it is intended to fix sender and receiver deadlock before delayed ACK timer expires. Add comment about these. --- sys/netinet/tcp_subr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 706b82a6ae..c3d2452bca 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1962,10 +1962,17 @@ tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq) u_long tcp_initial_window(const struct tcpcb *tp) { - if (tcp_do_rfc3390) + if (tcp_do_rfc3390) { return min(4 * tp->t_maxseg, max(2 * tp->t_maxseg, 4380)); - else - return tp->t_maxseg; + } else { + /* + * Even RFC2581 (back to 1999) allows 2*SMSS IW. + * + * Mainly to avoid sender and receiver deadlock + * until delayed ACK timer expires. + */ + return (2 * tp->t_maxseg); + } } #ifdef TCP_SIGNATURE -- 2.41.0