[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.17 / 0069-tcp-fix-tcp_rcv_rtt_update-use-of-an-unscaled-RTT-sa.patch
1 From e371feec366591f88fd4df14f701359bd08d33e7 Mon Sep 17 00:00:00 2001
2 From: Neal Cardwell <ncardwell@google.com>
3 Date: Tue, 10 Apr 2012 07:59:20 +0000
4 Subject: [PATCH 069/165] tcp: fix tcp_rcv_rtt_update() use of an unscaled RTT
5 sample
7 [ Upstream commit 18a223e0b9ec8979320ba364b47c9772391d6d05 ]
9 Fix a code path in tcp_rcv_rtt_update() that was comparing scaled and
10 unscaled RTT samples.
12 The intent in the code was to only use the 'm' measurement if it was a
13 new minimum. However, since 'm' had not yet been shifted left 3 bits
14 but 'new_sample' had, this comparison would nearly always succeed,
15 leading us to erroneously set our receive-side RTT estimate to the 'm'
16 sample when that sample could be nearly 8x too high to use.
18 The overall effect is to often cause the receive-side RTT estimate to
19 be significantly too large (up to 40% too large for brief periods in
20 my tests).
22 Signed-off-by: Neal Cardwell <ncardwell@google.com>
23 Acked-by: Eric Dumazet <edumazet@google.com>
24 Signed-off-by: David S. Miller <davem@davemloft.net>
25 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
26 ---
27 net/ipv4/tcp_input.c | 7 +++++--
28 1 files changed, 5 insertions(+), 2 deletions(-)
30 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
31 index e4d1e4a..4c46fa7 100644
32 --- a/net/ipv4/tcp_input.c
33 +++ b/net/ipv4/tcp_input.c
34 @@ -473,8 +473,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep)
35 if (!win_dep) {
36 m -= (new_sample >> 3);
37 new_sample += m;
38 - } else if (m < new_sample)
39 - new_sample = m << 3;
40 + } else {
41 + m <<= 3;
42 + if (m < new_sample)
43 + new_sample = m;
44 + }
45 } else {
46 /* No previous measure. */
47 new_sample = m << 3;
48 --
49 1.7.7.6