Skip to content

Commit 3720228

Browse files
edumazetdavem330
authored andcommitted
tcp: do not set rtt_min to 1
There are some cases where rtt_us derives from deltas of jiffies, instead of using usec timestamps. Since we want to track minimal rtt, better to assume a delta of 0 jiffie might be in fact be very close to 1 jiffie. It is kind of sad jiffies_to_usecs(1) calls a function instead of simply using a constant. Fixes: f672258 ("tcp: track min RTT using windowed min-filter") Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: Neal Cardwell <[email protected]> Cc: Yuchung Cheng <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6c5d89a commit 3720228

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/ipv4/tcp_input.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2896,7 +2896,10 @@ static void tcp_update_rtt_min(struct sock *sk, u32 rtt_us)
28962896
{
28972897
const u32 now = tcp_time_stamp, wlen = sysctl_tcp_min_rtt_wlen * HZ;
28982898
struct rtt_meas *m = tcp_sk(sk)->rtt_min;
2899-
struct rtt_meas rttm = { .rtt = (rtt_us ? : 1), .ts = now };
2899+
struct rtt_meas rttm = {
2900+
.rtt = likely(rtt_us) ? rtt_us : jiffies_to_usecs(1),
2901+
.ts = now,
2902+
};
29002903
u32 elapsed;
29012904

29022905
/* Check if the new measurement updates the 1st, 2nd, or 3rd choices */

0 commit comments

Comments
 (0)