Commit b344579c authored by Neal Cardwell's avatar Neal Cardwell Committed by David S. Miller

tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT

Mirja Kuehlewind reported a bug in Linux TCP CUBIC Hystart, where
Hystart HYSTART_DELAY mechanism can exit Slow Start spuriously on an
ACK when the minimum rtt of a connection goes down. From inspection it
is clear from the existing code that this could happen in an example
like the following:

o The first 8 RTT samples in a round trip are 150ms, resulting in a
  curr_rtt of 150ms and a delay_min of 150ms.

o The 9th RTT sample is 100ms. The curr_rtt does not change after the
  first 8 samples, so curr_rtt remains 150ms. But delay_min can be
  lowered at any time, so delay_min falls to 100ms. The code executes
  the HYSTART_DELAY comparison between curr_rtt of 150ms and delay_min
  of 100ms, and the curr_rtt is declared far enough above delay_min to
  force a (spurious) exit of Slow start.

The fix here is simple: allow every RTT sample in a round trip to
lower the curr_rtt.

Fixes: ae27e98a ("[TCP] CUBIC v2.3")
Reported-by: default avatarMirja Kuehlewind <mirja.kuehlewind@ericsson.com>
Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 29a30bac
...@@ -432,10 +432,9 @@ static void hystart_update(struct sock *sk, u32 delay) ...@@ -432,10 +432,9 @@ static void hystart_update(struct sock *sk, u32 delay)
if (hystart_detect & HYSTART_DELAY) { if (hystart_detect & HYSTART_DELAY) {
/* obtain the minimum delay of more than sampling packets */ /* obtain the minimum delay of more than sampling packets */
if (ca->curr_rtt > delay)
ca->curr_rtt = delay;
if (ca->sample_cnt < HYSTART_MIN_SAMPLES) { if (ca->sample_cnt < HYSTART_MIN_SAMPLES) {
if (ca->curr_rtt > delay)
ca->curr_rtt = delay;
ca->sample_cnt++; ca->sample_cnt++;
} else { } else {
if (ca->curr_rtt > ca->delay_min + if (ca->curr_rtt > ca->delay_min +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment