Skip to content

Commit

Permalink
tcp: fix RTO calculated from cached RTT
Browse files Browse the repository at this point in the history
Commit 1b7fdd2 ("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 <ncardwell@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-By: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Neal Cardwell authored and David S. Miller committed Sep 17, 2013
1 parent 4bdf259 commit 269aa75
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/ipv4/tcp_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,9 @@ void tcp_init_metrics(struct sock *sk)
* 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,
Expand Down

0 comments on commit 269aa75

Please sign in to comment.