aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNeal Cardwell <ncardwell@google.com>2012-04-10 03:59:20 -0400
committerLuis Henriques <luis.henriques@canonical.com>2012-05-01 06:00:21 -0400
commit053d64f3addf3ea83bb1806adb0099b7f606639d (patch)
tree632b0184f1ce83e2f9ff448e9867fdc1f035fa8d /net
parentc6dbe37893cb2e7f6a4ce7f83fcb1d38f932a69f (diff)
tcp: fix tcp_rcv_rtt_update() use of an unscaled RTT sample
BugLink: http://bugs.launchpad.net/bugs/990544 [ Upstream commit 18a223e0b9ec8979320ba364b47c9772391d6d05 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_input.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 72b1857723d..104b02e3ee2 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -460,8 +460,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep)
460 if (!win_dep) { 460 if (!win_dep) {
461 m -= (new_sample >> 3); 461 m -= (new_sample >> 3);
462 new_sample += m; 462 new_sample += m;
463 } else if (m < new_sample) 463 } else {
464 new_sample = m << 3; 464 m <<= 3;
465 if (m < new_sample)
466 new_sample = m;
467 }
465 } else { 468 } else {
466 /* No previous measure. */ 469 /* No previous measure. */
467 new_sample = m << 3; 470 new_sample = m << 3;