Skip to content

Commit 45f1d31

Browse files
committed
tcp: add a @pace_delay parameter to tcp_reset_xmit_timer()
JIRA: https://issues.redhat.com/browse/RHEL-115191 Upstream Status: linux.git commit 7baa030 Author: Eric Dumazet <edumazet@google.com> Date: Fri Feb 7 15:28:27 2025 +0000 tcp: add a @pace_delay parameter to tcp_reset_xmit_timer() We want to factorize calls to inet_csk_reset_xmit_timer(), to ease TCP_RTO_MAX change. Current users want to add tcp_pacing_delay(sk) to the timeout. Remaining calls to inet_csk_reset_xmit_timer() do not add the pacing delay. Following patch will convert them, passing false for @pace_delay. 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 dba39f5 commit 45f1d31

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

include/net/tcp.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,10 +1354,12 @@ static inline unsigned long tcp_pacing_delay(const struct sock *sk)
13541354

13551355
static inline void tcp_reset_xmit_timer(struct sock *sk,
13561356
const int what,
1357-
unsigned long when)
1357+
unsigned long when,
1358+
bool pace_delay)
13581359
{
1359-
inet_csk_reset_xmit_timer(sk, what, when + tcp_pacing_delay(sk),
1360-
TCP_RTO_MAX);
1360+
if (pace_delay)
1361+
when += tcp_pacing_delay(sk);
1362+
inet_csk_reset_xmit_timer(sk, what, when, TCP_RTO_MAX);
13611363
}
13621364

13631365
/* Something is really bad, we could not queue an additional packet,
@@ -1386,7 +1388,7 @@ static inline void tcp_check_probe_timer(struct sock *sk)
13861388
{
13871389
if (!tcp_sk(sk)->packets_out && !inet_csk(sk)->icsk_pending)
13881390
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
1389-
tcp_probe0_base(sk));
1391+
tcp_probe0_base(sk), true);
13901392
}
13911393

13921394
static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)

net/ipv4/tcp_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3231,7 +3231,7 @@ void tcp_rearm_rto(struct sock *sk)
32313231
*/
32323232
rto = usecs_to_jiffies(max_t(int, delta_us, 1));
32333233
}
3234-
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS, rto);
3234+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS, rto, true);
32353235
}
32363236
}
32373237

@@ -3512,7 +3512,7 @@ static void tcp_ack_probe(struct sock *sk)
35123512
unsigned long when = tcp_probe0_when(sk, TCP_RTO_MAX);
35133513

35143514
when = tcp_clamp_probe0_to_user_timeout(sk, when);
3515-
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, when);
3515+
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, when, true);
35163516
}
35173517
}
35183518

net/ipv4/tcp_output.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,7 +2787,7 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto)
27872787
if (rto_delta_us > 0)
27882788
timeout = min_t(u32, timeout, usecs_to_jiffies(rto_delta_us));
27892789

2790-
tcp_reset_xmit_timer(sk, ICSK_TIME_LOSS_PROBE, timeout);
2790+
tcp_reset_xmit_timer(sk, ICSK_TIME_LOSS_PROBE, timeout, true);
27912791
return true;
27922792
}
27932793

@@ -3424,7 +3424,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
34243424
}
34253425
if (rearm_timer)
34263426
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
3427-
inet_csk(sk)->icsk_rto);
3427+
inet_csk(sk)->icsk_rto, true);
34283428
}
34293429

34303430
/* We allow to exceed memory limits for FIN packets to expedite
@@ -4176,7 +4176,7 @@ void tcp_send_probe0(struct sock *sk)
41764176
}
41774177

41784178
timeout = tcp_clamp_probe0_to_user_timeout(sk, timeout);
4179-
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, timeout);
4179+
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, timeout, true);
41804180
}
41814181

41824182
int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)

0 commit comments

Comments
 (0)