tcp: fix RTO calculated from cached RTT

Commit 1b7fdd2ab5 ("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: Neal Cardwell <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Yuchung Cheng <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Acked-By: Yuchung Cheng <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Neal Cardwell 2013-09-16 21:44:20 -04:00 • committed by David S. Miller
commit 269aa759b4

View file

@ -502,7 +502,9 @@ reset:
* ACKs, wait for troubles.
*/
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) {
/* RFC6298: 5.7 We've failed to get a valid RTT sample from
* 3WHS. This is most likely due to retransmission,