diff options
author | Neal Cardwell <ncardwell@google.com> | 2012-04-10 03:59:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-10 14:47:09 -0400 |
commit | 18a223e0b9ec8979320ba364b47c9772391d6d05 (patch) | |
tree | 0028fe1163490ced0dcf3d72384fba0e37cf085e /net | |
parent | 5fb84b1428b271f8767e0eb3fcd7231896edfaa4 (diff) |
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: Neal Cardwell <ncardwell@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/tcp_input.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e886e2f7fa8d..e7b54d29690e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -474,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) | |||
474 | if (!win_dep) { | 474 | if (!win_dep) { |
475 | m -= (new_sample >> 3); | 475 | m -= (new_sample >> 3); |
476 | new_sample += m; | 476 | new_sample += m; |
477 | } else if (m < new_sample) | 477 | } else { |
478 | new_sample = m << 3; | 478 | m <<= 3; |
479 | if (m < new_sample) | ||
480 | new_sample = m; | ||
481 | } | ||
479 | } else { | 482 | } else { |
480 | /* No previous measure. */ | 483 | /* No previous measure. */ |
481 | new_sample = m << 3; | 484 | new_sample = m << 3; |