diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2008-09-09 07:35:21 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2008-09-09 07:35:21 +0000 |
commit | c10eb6d10a6d3dc36015d8dd4e9c868873014e61 (patch) | |
tree | 629292fe140ba91d5cbb5b76024a939c734c1214 /sys/netinet/tcp_input.c | |
parent | 275d30b973fb31ae65e11376323c8c5d28d27da3 (diff) |
Work around an integer division resulting in 0 and thus the
congestion window not being incremented, if cwnd > maxseg^2.
As suggested in RFC2581 increment the cwnd by 1 in this case.
See http://caia.swin.edu.au/reports/080829A/CAIA-TR-080829A.pdf
for more details.
Submitted by: Alana Huebner, Lawrence Stewart,
Grenville Armitage (caia.swin.edu.au)
Reviewed by: dwmalone, gnn, rpaulo
MFC After: 3 days
Notes
Notes:
svn path=/head/; revision=182885
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r-- | sys/netinet/tcp_input.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e96ef443a5db..0cb24a7f3fb6 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2086,13 +2086,15 @@ process_ACK: * in flight, open exponentially (maxseg per packet). * Otherwise open linearly: maxseg per window * (maxseg^2 / cwnd per packet). + * If cwnd > maxseg^2, fix the cwnd increment at 1 byte + * to avoid capping cwnd (as suggested in RFC2581). */ if ((!V_tcp_do_newreno && !(tp->t_flags & TF_SACK_PERMIT)) || !IN_FASTRECOVERY(tp)) { u_int cw = tp->snd_cwnd; u_int incr = tp->t_maxseg; if (cw > tp->snd_ssthresh) - incr = incr * incr / cw; + incr = max((incr * incr / cw), 1); tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<<tp->snd_scale); } SOCKBUF_LOCK(&so->so_snd); |