Skip to content

Commit 9949afa

Browse files
nealcardwelldavem330
authored andcommitted
tcp: fix tcp_cong_avoid_ai() credit accumulation bug with decreases in w
The recent change to tcp_cong_avoid_ai() to handle stretch ACKs introduced a bug where snd_cwnd_cnt could accumulate a very large value while w was large, and then if w was reduced snd_cwnd could be incremented by a large delta, leading to a large burst and high packet loss. This was tickled when CUBIC's bictcp_update() sets "ca->cnt = 100 * cwnd". This bug crept in while preparing the upstream version of 814d488. Testing: This patch has been tested in datacenter netperf transfers and live youtube.com and google.com servers. Fixes: 814d488 ("tcp: fix the timid additive increase on stretch ACKs") Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 366c1bd commit 9949afa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/ipv4/tcp_cong.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ EXPORT_SYMBOL_GPL(tcp_slow_start);
378378
*/
379379
void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked)
380380
{
381+
/* If credits accumulated at a higher w, apply them gently now. */
382+
if (tp->snd_cwnd_cnt >= w) {
383+
tp->snd_cwnd_cnt = 0;
384+
tp->snd_cwnd++;
385+
}
386+
381387
tp->snd_cwnd_cnt += acked;
382388
if (tp->snd_cwnd_cnt >= w) {
383389
u32 delta = tp->snd_cwnd_cnt / w;

0 commit comments

Comments
 (0)