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

tcp: fix tcp_rcv_rtt_update() use of an unscaled RTT sample

Fix a code path in tcp_rcv_rtt_update() that was comparing scaled and
unscaled RTT samples.

The intent in the code was to only use the 'm' measurement if it was a
new minimum.  However, since 'm' had not yet been shifted left 3 bits
but 'new_sample' had, this comparison would nearly always succeed,
leading us to erroneously set our receive-side RTT estimate to the 'm'
sample when that sample could be nearly 8x too high to use.

The overall effect is to often cause the receive-side RTT estimate to
be significantly too large (up to 40% too large for brief periods in
my tests).
Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5fb84b14
...@@ -474,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) ...@@ -474,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep)
if (!win_dep) { if (!win_dep) {
m -= (new_sample >> 3); m -= (new_sample >> 3);
new_sample += m; new_sample += m;
} else if (m < new_sample) } else {
new_sample = m << 3; m <<= 3;
if (m < new_sample)
new_sample = m;
}
} else { } else {
/* No previous measure. */ /* No previous measure. */
new_sample = m << 3; new_sample = m << 3;
......
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