aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_cong.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-07-20 01:02:33 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-20 13:59:41 -0400
commit9dc274151a548ffd215caecec5a8872db8799447 (patch)
tree13b7199958243d28c43ea3ecdeca254edc2d7245 /net/ipv4/tcp_cong.c
parent5815d5e7aae3cc9c5e85af83094d4d6498c3f4fc (diff)
tcp: fix ABC in tcp_slow_start()
When/if sysctl_tcp_abc > 1, we expect to increase cwnd by 2 if the received ACK acknowledges more than 2*MSS bytes, in tcp_slow_start() Problem is this RFC 3465 statement is not correctly coded, as the while () loop increases snd_cwnd one by one. Add a new variable to avoid this off-by one error. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Tom Herbert <therbert@google.com> Cc: Yuchung Cheng <ycheng@google.com> Cc: Neal Cardwell <ncardwell@google.com> Cc: Nandita Dukkipati <nanditad@google.com> Cc: John Heffner <johnwheffner@gmail.com> Cc: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Yuchung Cheng <ycheng@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_cong.c')
-rw-r--r--net/ipv4/tcp_cong.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 04dbd7ae7c62..4d4db16e336e 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -307,6 +307,7 @@ EXPORT_SYMBOL_GPL(tcp_is_cwnd_limited);
307void tcp_slow_start(struct tcp_sock *tp) 307void tcp_slow_start(struct tcp_sock *tp)
308{ 308{
309 int cnt; /* increase in packets */ 309 int cnt; /* increase in packets */
310 unsigned int delta = 0;
310 311
311 /* RFC3465: ABC Slow start 312 /* RFC3465: ABC Slow start
312 * Increase only after a full MSS of bytes is acked 313 * Increase only after a full MSS of bytes is acked
@@ -333,9 +334,9 @@ void tcp_slow_start(struct tcp_sock *tp)
333 tp->snd_cwnd_cnt += cnt; 334 tp->snd_cwnd_cnt += cnt;
334 while (tp->snd_cwnd_cnt >= tp->snd_cwnd) { 335 while (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
335 tp->snd_cwnd_cnt -= tp->snd_cwnd; 336 tp->snd_cwnd_cnt -= tp->snd_cwnd;
336 if (tp->snd_cwnd < tp->snd_cwnd_clamp) 337 delta++;
337 tp->snd_cwnd++;
338 } 338 }
339 tp->snd_cwnd = min(tp->snd_cwnd + delta, tp->snd_cwnd_clamp);
339} 340}
340EXPORT_SYMBOL_GPL(tcp_slow_start); 341EXPORT_SYMBOL_GPL(tcp_slow_start);
341 342