Skip to content

Commit 41ea1c4

Browse files
committed
tcp: add a @pace_delay parameter to tcp_reset_xmit_timer()
JIRA: https://issues.redhat.com/browse/RHEL-115393 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 27bee10 commit 41ea1c4

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
@@ -1439,10 +1439,12 @@ static inline unsigned long tcp_pacing_delay(const struct sock *sk)
14391439

14401440
static inline void tcp_reset_xmit_timer(struct sock *sk,
14411441
const int what,
1442-
unsigned long when)
1442+
unsigned long when,
1443+
bool pace_delay)
14431444
{
1444-
inet_csk_reset_xmit_timer(sk, what, when + tcp_pacing_delay(sk),
1445-
TCP_RTO_MAX);
1445+
if (pace_delay)
1446+
when += tcp_pacing_delay(sk);
1447+
inet_csk_reset_xmit_timer(sk, what, when, TCP_RTO_MAX);
14461448
}
14471449

14481450
/* Something is really bad, we could not queue an additional packet,
@@ -1471,7 +1473,7 @@ static inline void tcp_check_probe_timer(struct sock *sk)
14711473
{
14721474
if (!tcp_sk(sk)->packets_out && !inet_csk(sk)->icsk_pending)
14731475
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
1474-
tcp_probe0_base(sk));
1476+
tcp_probe0_base(sk), true);
14751477
}
14761478

14771479
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
@@ -3290,7 +3290,7 @@ void tcp_rearm_rto(struct sock *sk)
32903290
*/
32913291
rto = usecs_to_jiffies(max_t(int, delta_us, 1));
32923292
}
3293-
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS, rto);
3293+
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS, rto, true);
32943294
}
32953295
}
32963296

@@ -3570,7 +3570,7 @@ static void tcp_ack_probe(struct sock *sk)
35703570
unsigned long when = tcp_probe0_when(sk, TCP_RTO_MAX);
35713571

35723572
when = tcp_clamp_probe0_to_user_timeout(sk, when);
3573-
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, when);
3573+
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, when, true);
35743574
}
35753575
}
35763576

net/ipv4/tcp_output.c

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

2916-
tcp_reset_xmit_timer(sk, ICSK_TIME_LOSS_PROBE, timeout);
2916+
tcp_reset_xmit_timer(sk, ICSK_TIME_LOSS_PROBE, timeout, true);
29172917
return true;
29182918
}
29192919

@@ -3549,7 +3549,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
35493549
}
35503550
if (rearm_timer)
35513551
tcp_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
3552-
inet_csk(sk)->icsk_rto);
3552+
inet_csk(sk)->icsk_rto, true);
35533553
}
35543554

35553555
/* We allow to exceed memory limits for FIN packets to expedite
@@ -4401,7 +4401,7 @@ void tcp_send_probe0(struct sock *sk)
44014401
}
44024402

44034403
timeout = tcp_clamp_probe0_to_user_timeout(sk, timeout);
4404-
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, timeout);
4404+
tcp_reset_xmit_timer(sk, ICSK_TIME_PROBE0, timeout, true);
44054405
}
44064406

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

0 commit comments

Comments
 (0)