[PATCH net v2 1/2] tcp: roccet: do not restart from idle on RTO retransmission

From: Zhiqi Zhang

Date: Tue Nov 17 2026 - 21:28:35 EST


roccet sets .cong_control, so tcp_slow_start_after_idle_check() returns
early and roccet implements the idle restart in cwnd_event_tx_start().

An RTO retransmission also raises CA_EVENT_TX_START: tcp_enter_loss()
marks the outstanding packets lost, which drains the in-flight count
while tp->packets_out stays non-zero. If delta >= icsk_rto,
roccet_cwnd_event_tx_start() then takes the idle restart and overwrites
tp->snd_ssthresh with tcp_snd_cwnd() == TCP_INIT_CWND.

When a TLP probe was sent, the RTO timer is rearmed for a full icsk_rto
at that point and the probe is the last transmit, so the first RTO is
affected. Without TLP, the first RTO can escape: the timer is armed
when the first packet of the flight is sent, and pacing spreads the
following ones, so now - tp->lsndtime < icsk_rto. The second RTO is
always affected, since it fires one backed-off icsk_rto after the first
RTO retransmit.

roccet_state(TCP_CA_Loss) calls roccet_reset(), which clears the private
state; ca->state is already LAUNCH and last_max_cwnd is already 0 when
roccet_cwnd_event_tx_start() runs, with or without this fix. The only
field the idle restart breaks is tp->snd_ssthresh: it overwrites the
value preserved by roccet_state() with TCP_INIT_CWND.

Skip the idle restart while packets are outstanding. The packetdrill
test in the next patch fails at the first RTO without this fix
(snd_ssthresh == 10) and passes with it.

Fixes: 819d59638796 ("tcp: Add TCP ROCCET congestion control module.")
Link: https://lore.kernel.org/all/179179785248.434549.16829837649351382748@xxxxxxxxxx/
Signed-off-by: Zhiqi Zhang <zhiqizhangg@xxxxxxxxx>
---
net/ipv4/tcp_roccet.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_roccet.c b/net/ipv4/tcp_roccet.c
index 04b9e52466..1769e4bbe3 100644
--- a/net/ipv4/tcp_roccet.c
+++ b/net/ipv4/tcp_roccet.c
@@ -1144,8 +1144,12 @@ static void roccet_cwnd_event_tx_start(struct sock *sk)
ca->epoch_start = now;
}

- /* After idle periods, go into LAUNCH with slow start */
- if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle) &&
+ /* After idle periods, go into LAUNCH with slow start.
+ * We are not idle if packets are outstanding (e.g. RTO retransmit),
+ * see tcp_slow_start_after_idle_check().
+ */
+ if (!tp->packets_out &&
+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle) &&
delta >= inet_csk(sk)->icsk_rto) {
tp->snd_ssthresh = tcp_snd_cwnd(tp);
tcp_snd_cwnd_set(tp, min(TCP_INIT_CWND, tp->snd_cwnd_clamp));
--
2.54.0 (Apple Git-157)