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

tcp: fix RTO calculated from cached RTT

Commit 1b7fdd2a ("tcp: do not use cached RTT for RTT estimation")
did not correctly account for the fact that crtt is the RTT shifted
left 3 bits. Fix the calculation to consistently reflect this fact.
Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Acked-By: default avatarYuchung Cheng <ycheng@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4bdf2597
...@@ -502,7 +502,9 @@ void tcp_init_metrics(struct sock *sk) ...@@ -502,7 +502,9 @@ void tcp_init_metrics(struct sock *sk)
* ACKs, wait for troubles. * ACKs, wait for troubles.
*/ */
if (crtt > tp->srtt) { if (crtt > tp->srtt) {
inet_csk(sk)->icsk_rto = crtt + max(crtt >> 2, tcp_rto_min(sk)); /* Set RTO like tcp_rtt_estimator(), but from cached RTT. */
crtt >>= 3;
inet_csk(sk)->icsk_rto = crtt + max(2 * crtt, tcp_rto_min(sk));
} else if (tp->srtt == 0) { } else if (tp->srtt == 0) {
/* RFC6298: 5.7 We've failed to get a valid RTT sample from /* RFC6298: 5.7 We've failed to get a valid RTT sample from
* 3WHS. This is most likely due to retransmission, * 3WHS. This is most likely due to retransmission,
......
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