Skip to content

Commit b17b8a2

Browse files
edumazetdavem330
authored andcommitted
tcp: fix tcp_rearm_rto()
skbs in (re)transmit queue no longer have a copy of jiffies at the time of the transmit : skb->skb_mstamp is now in usec unit, with no correlation to tcp_jiffies32. We have to convert rto from jiffies to usec, compute a time difference in usec, then convert the delta to HZ units. Fixes: 9a568de ("tcp: switch TCP TS option (RFC 7323) to 1ms clock") Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4454e86 commit b17b8a2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎net/ipv4/tcp_input.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3002,14 +3002,14 @@ void tcp_rearm_rto(struct sock *sk)
30023002
if (icsk->icsk_pending == ICSK_TIME_REO_TIMEOUT ||
30033003
icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) {
30043004
struct sk_buff *skb = tcp_write_queue_head(sk);
3005-
const u32 rto_time_stamp =
3006-
tcp_skb_timestamp(skb) + rto;
3007-
s32 delta = (s32)(rto_time_stamp - tcp_jiffies32);
3008-
/* delta may not be positive if the socket is locked
3005+
u64 rto_time_stamp = skb->skb_mstamp +
3006+
jiffies_to_usecs(rto);
3007+
s64 delta_us = rto_time_stamp - tp->tcp_mstamp;
3008+
/* delta_us may not be positive if the socket is locked
30093009
* when the retrans timer fires and is rescheduled.
30103010
*/
3011-
if (delta > 0)
3012-
rto = delta;
3011+
if (delta_us > 0)
3012+
rto = usecs_to_jiffies(delta_us);
30133013
}
30143014
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, rto,
30153015
TCP_RTO_MAX);

0 commit comments

Comments
 (0)