Skip to content

Commit e1a10ef

Browse files
nealcardwelldavem330
authored andcommitted
tcp: introduce tcp_rto_delta_us() helper for xmit timer fix
Pure refactor. This helper will be required in the xmit timer fix later in the patch series. (Because the TLP logic will want to make this calculation.) Fixes: 6ba8a3b ("tcp: Tail loss probe (TLP)") Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Nandita Dukkipati <nanditad@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b91d532 commit e1a10ef

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

include/net/tcp.h

+10
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,16 @@ extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
19161916
u64 xmit_time);
19171917
extern void tcp_rack_reo_timeout(struct sock *sk);
19181918

1919+
/* At how many usecs into the future should the RTO fire? */
1920+
static inline s64 tcp_rto_delta_us(const struct sock *sk)
1921+
{
1922+
const struct sk_buff *skb = tcp_write_queue_head(sk);
1923+
u32 rto = inet_csk(sk)->icsk_rto;
1924+
u64 rto_time_stamp_us = skb->skb_mstamp + jiffies_to_usecs(rto);
1925+
1926+
return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp;
1927+
}
1928+
19191929
/*
19201930
* Save and compile IPv4 options, return a pointer to it
19211931
*/

net/ipv4/tcp_input.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -3004,10 +3004,7 @@ void tcp_rearm_rto(struct sock *sk)
30043004
/* Offset the time elapsed after installing regular RTO */
30053005
if (icsk->icsk_pending == ICSK_TIME_REO_TIMEOUT ||
30063006
icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) {
3007-
struct sk_buff *skb = tcp_write_queue_head(sk);
3008-
u64 rto_time_stamp = skb->skb_mstamp +
3009-
jiffies_to_usecs(rto);
3010-
s64 delta_us = rto_time_stamp - tp->tcp_mstamp;
3007+
s64 delta_us = tcp_rto_delta_us(sk);
30113008
/* delta_us may not be positive if the socket is locked
30123009
* when the retrans timer fires and is rescheduled.
30133010
*/

0 commit comments

Comments
 (0)