tcp: fix RTO calculated from cached RTT
Subsystems (3)
Neal Cardwell
maintainerPATCH 1/1 tcp: fix RTO calculated from cached RTT
Commit 1b7fdd2ab5852 ("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.
--- net/ipv4/tcp_metrics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/tcp_metrics.c +3 -1
@@ -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,
Signature · 1 line
1.8.4
Quoted 10 lines · Neal Cardwell
Commit
1b7fdd2ab5852("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]>--- net/ipv4/tcp_metrics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Instead of rto = 3*crtt, we had rto = 10*crtt, which was indeed suboptimal ;)
Quoted 10 lines · Neal Cardwell
Commit
1b7fdd2ab5852("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]>--- net/ipv4/tcp_metrics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Thanks for discovering and fixing it!
Quoted 19 lines
net/ipv4/tcp_metrics.c +3
-2@@ -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, -- 1.8.4
From: Yuchung Cheng <[email protected]>
Date: Tue, 17 Sep 2013 07:32:38 -0700
Quoted 11 lines · Neal Cardwell
Quoted 10 lines
Commit
1b7fdd2ab5852("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]>--- net/ipv4/tcp_metrics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 3 lines
Acked-by Yuchung Cheng <[email protected]>Thanks for discovering and fixing it!
Applied, thanks everyone.