diff options
author | bz <bz@FreeBSD.org> | 2008-09-09 07:35:21 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2008-09-09 07:35:21 +0000 |
commit | c60eddf2cd4550ef2c71e9e9c660b7c03dafea92 (patch) | |
tree | 629292fe140ba91d5cbb5b76024a939c734c1214 /sys/netinet/tcp_input.c | |
parent | ee52a364f71a599f68bf8297608855b6157c4576 (diff) | |
download | FreeBSD-src-c60eddf2cd4550ef2c71e9e9c660b7c03dafea92.zip FreeBSD-src-c60eddf2cd4550ef2c71e9e9c660b7c03dafea92.tar.gz |
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
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 e96ef44..0cb24a7 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); |