[PATCH net] tcp: roccet: do not restart from idle on RTO retransmission
From: Zhiqi Zhang
Date: Sat Nov 14 2026 - 09:13:34 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 packets_out stays non-zero, and the RTO timer expires at least
icsk_rto after the last send. The idle restart then overwrites the
snd_ssthresh that roccet_state(TCP_CA_Loss) just set:
tcp_enter_loss()
roccet_recalc_ssthresh() ssthresh = 0.7 * cwnd
roccet_state(TCP_CA_Loss) cwnd = TCP_INIT_CWND,
ssthresh = max(ssthresh, cwnd)
tcp_retransmit_skb()
tcp_event_data_sent() CA_EVENT_TX_START
roccet_cwnd_event_tx_start() ssthresh = cwnd = TCP_INIT_CWND,
state = LAUNCH
The flow loses the reduced ssthresh and cannot slow start back to the
pre-loss window; CUBIC growth restarts from TCP_INIT_CWND with
last_max_cwnd reset. Skip the idle restart while packets are
outstanding, matching tcp_slow_start_after_idle_check().
Measured with a loopback sender and 100% netem loss after cwnd reached
about 126, reading TCP_INFO on the sender:
before fix: ssthresh during RTO = 10 (TCP_INIT_CWND)
after fix: ssthresh during RTO = 88 (0.7 * cwnd preserved)
The same issue was raised in the Sashiko review of the initial series.
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>
---
AI assistance:
- DeepSeek (deepseek-flash) generated the code change.
- I wrote the tests and reviewed the code.
- I wrote the documentation and the changelog, and used DeepSeek to
polish the wording.
net/ipv4/tcp_roccet.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_roccet.c b/net/ipv4/tcp_roccet.c
index 04b9e5246..4b4621a79 100644
--- a/net/ipv4/tcp_roccet.c
+++ b/net/ipv4/tcp_roccet.c
@@ -1144,8 +1144,15 @@ 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) &&
+ /*
+ * Skip the idle restart when packets are outstanding. An RTO
+ * retransmission also raises CA_EVENT_TX_START: loss marking drains
+ * the in-flight count while packets_out stays non-zero. Restarting
+ * there overwrites the snd_ssthresh preserved by roccet_state().
+ * Cf. 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)