tcp: fix stretch ACK bugs in Veno
authorPengcheng Yang <yangpc@wangsu.com>
Mon, 16 Mar 2020 06:35:10 +0000 (14:35 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Mar 2020 01:26:55 +0000 (18:26 -0700)
Change Veno to properly handle stretch ACKs in additive
increase mode by passing in the count of ACKed packets
to tcp_cong_avoid_ai().

Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_veno.c

index 857491c..50a9a6e 100644 (file)
@@ -154,8 +154,9 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked)
 
                if (tcp_in_slow_start(tp)) {
                        /* Slow start. */
-                       tcp_slow_start(tp, acked);
-                       goto done;
+                       acked = tcp_slow_start(tp, acked);
+                       if (!acked)
+                               goto done;
                }
 
                /* Congestion avoidance. */
@@ -163,7 +164,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked)
                        /* In the "non-congestive state", increase cwnd
                         * every rtt.
                         */
-                       tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1);
+                       tcp_cong_avoid_ai(tp, tp->snd_cwnd, acked);
                } else {
                        /* In the "congestive state", increase cwnd
                         * every other rtt.
@@ -177,7 +178,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked)
                                        veno->inc = 1;
                                tp->snd_cwnd_cnt = 0;
                        } else
-                               tp->snd_cwnd_cnt++;
+                               tp->snd_cwnd_cnt += acked;
                }
 done:
                if (tp->snd_cwnd < 2)