Skip to content

Commit 79df165

Browse files
committed
tcp: use tcp_reset_xmit_timer()
JIRA: https://issues.redhat.com/browse/RHEL-115393 Upstream Status: linux.git commit 48b69b4 Author: Eric Dumazet <edumazet@google.com> Date: Fri Feb 7 15:28:28 2025 +0000 tcp: use tcp_reset_xmit_timer() In order to reduce TCP_RTO_MAX occurrences, replace: inet_csk_reset_xmit_timer(sk, what, when, TCP_RTO_MAX) With: tcp_reset_xmit_timer(sk, what, when, false); Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jason Xing <kerneljasonxing@gmail.com> Reviewed-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent 41ea1c4 commit 79df165

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

net/ipv4/tcp_fastopen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,
274274
* because it's been added to the accept queue directly.
275275
*/
276276
req->timeout = tcp_timeout_init(child);
277-
inet_csk_reset_xmit_timer(child, ICSK_TIME_RETRANS,
278-
req->timeout, TCP_RTO_MAX);
277+
tcp_reset_xmit_timer(child, ICSK_TIME_RETRANS,
278+
req->timeout, false);
279279

280280
refcount_set(&req->rsk_refcnt, 2);
281281

net/ipv4/tcp_input.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,8 +2260,7 @@ static bool tcp_check_sack_reneging(struct sock *sk, int *ack_flag)
22602260
unsigned long delay = max(usecs_to_jiffies(tp->srtt_us >> 4),
22612261
msecs_to_jiffies(10));
22622262

2263-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
2264-
delay, TCP_RTO_MAX);
2263+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS, delay, false);
22652264
*ack_flag &= ~FLAG_SET_XMIT_TIMER;
22662265
return true;
22672266
}
@@ -6477,9 +6476,8 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
64776476
after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) {
64786477
/* Previous FIN/ACK or RST/ACK might be ignored. */
64796478
if (icsk->icsk_retransmits == 0)
6480-
inet_csk_reset_xmit_timer(sk,
6481-
ICSK_TIME_RETRANS,
6482-
TCP_TIMEOUT_MIN, TCP_RTO_MAX);
6479+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
6480+
TCP_TIMEOUT_MIN, false);
64836481
SKB_DR_SET(reason, TCP_INVALID_ACK_SEQUENCE);
64846482
goto reset_and_undo;
64856483
}
@@ -6594,8 +6592,8 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
65946592
*/
65956593
inet_csk_schedule_ack(sk);
65966594
tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
6597-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
6598-
TCP_DELACK_MAX, TCP_RTO_MAX);
6595+
tcp_reset_xmit_timer(sk, ICSK_TIME_DACK,
6596+
TCP_DELACK_MAX, false);
65996597
goto consume;
66006598
}
66016599
tcp_send_ack(sk);

net/ipv4/tcp_ipv4.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,7 @@ void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
463463
remaining = icsk->icsk_rto - usecs_to_jiffies(delta_us);
464464

465465
if (remaining > 0) {
466-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
467-
remaining, TCP_RTO_MAX);
466+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS, remaining, false);
468467
} else {
469468
/* RTO revert clocked out retransmission.
470469
* Will retransmit now.

net/ipv4/tcp_output.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4163,8 +4163,8 @@ int tcp_connect(struct sock *sk)
41634163
TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS);
41644164

41654165
/* Timer for repeating the SYN until an answer. */
4166-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
4167-
inet_csk(sk)->icsk_rto, TCP_RTO_MAX);
4166+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
4167+
inet_csk(sk)->icsk_rto, false);
41684168
return 0;
41694169
}
41704170
EXPORT_SYMBOL(tcp_connect);
@@ -4256,7 +4256,7 @@ void __tcp_send_ack(struct sock *sk, u32 rcv_nxt)
42564256
icsk->icsk_ack.retry++;
42574257
inet_csk_schedule_ack(sk);
42584258
icsk->icsk_ack.ato = TCP_ATO_MIN;
4259-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, delay, TCP_RTO_MAX);
4259+
tcp_reset_xmit_timer(sk, ICSK_TIME_DACK, delay, false);
42604260
return;
42614261
}
42624262

net/ipv4/tcp_timer.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req)
472472
tcp_update_rto_stats(sk);
473473
if (!tp->retrans_stamp)
474474
tp->retrans_stamp = tcp_time_stamp_ts(tp);
475-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
476-
req->timeout << req->num_timeout, TCP_RTO_MAX);
475+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
476+
req->timeout << req->num_timeout, false);
477477
}
478478

479479
static bool tcp_rtx_probe0_timed_out(const struct sock *sk,
@@ -617,9 +617,9 @@ void tcp_retransmit_timer(struct sock *sk)
617617
/* Retransmission failed because of local congestion,
618618
* Let senders fight for local resources conservatively.
619619
*/
620-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
621-
TCP_RESOURCE_PROBE_INTERVAL,
622-
TCP_RTO_MAX);
620+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
621+
TCP_RESOURCE_PROBE_INTERVAL,
622+
false);
623623
goto out;
624624
}
625625

@@ -666,8 +666,8 @@ void tcp_retransmit_timer(struct sock *sk)
666666
icsk->icsk_backoff++;
667667
icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX);
668668
}
669-
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
670-
tcp_clamp_rto_to_user_timeout(sk), TCP_RTO_MAX);
669+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
670+
tcp_clamp_rto_to_user_timeout(sk), false);
671671
if (retransmits_timed_out(sk, READ_ONCE(net->ipv4.sysctl_tcp_retries1) + 1, 0))
672672
__sk_dst_reset(sk);
673673

0 commit comments

Comments
 (0)