Thread View: linux.kernel.netdev
6 messages
6 total messages
Started by Zhiqi Zhang
Wed, 18 Nov 2026 02:28
[PATCH net v2 0/2] tcp: roccet: fix idle restart on RTO
Author: Zhiqi Zhang
Date: Wed, 18 Nov 2026 02:28
Date: Wed, 18 Nov 2026 02:28
54 lines
12984 bytes
12984 bytes
Patch 1/2 skips the idle restart when packets are outstanding, so an RTO retransmission no longer overwrites the snd_ssthresh preserved by roccet_state(TCP_CA_Loss). Patch 2/2 adds a packetdrill test. v1: https://lore.kernel.org/all/20261114141315.19007-1-zhiqizhangg@gmail.com/ Eric's review: https://lore.kernel.org/all/CAL4WiiohBWs_BteL4o__osD6cPTXrBBPa-P7faV=acTaF_4g3w@mail.gmail.com/ Changes since v1: - Make the changelog precise about when the idle restart is reached: with TLP the first RTO is affected; without TLP the first RTO can escape and the second RTO is always affected. - Limit the claimed effect to tp->snd_ssthresh. roccet_state() calls roccet_reset(), so ca->state is already LAUNCH and last_max_cwnd is already 0 when roccet_cwnd_event_tx_start() runs; the idle restart only overwrites snd_ssthresh. - Shorten the comment to the style used in the file. - Add the packetdrill test from Eric as 2/2, and enable CONFIG_TCP_CONG_ADVANCED plus CONFIG_TCP_CONG_ROCCET in the packetdrill config (ROCCET is only visible with advanced congestion control enabled). Patch 2/2 is based on a test written by Eric Dumazet. A variant with tcp_early_retrans=0 (no TLP) fails at the second RTO only. Testing: Eric ran the packetdrill test in 2/2 (it fails at the first RTO without 1/2 and passes with it). The netem reproducer from v1 still shows snd_ssthresh being preserved during the RTO with this series. AI assistance: - DeepSeek (deepseek-flash) generated the code change in 1/2. - I wrote the netem reproducer and the documentation, and reviewed the code. The packetdrill test in 2/2 was written by Eric Dumazet. - DeepSeek was used to polish the wording. Thanks Eric for the review and the packetdrill test. Zhiqi Zhang (2): tcp: roccet: do not restart from idle on RTO retransmission selftests: net: packetdrill: add ROCCET RTO test net/ipv4/tcp_roccet.c | 8 ++- .../testing/selftests/net/packetdrill/config | 2 + .../net/packetdrill/tcp_roccet_rto.pkt | 63 +++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/net/packetdrill/tcp_roccet_rto.pkt -- 2.54.0 (Apple Git-157)
[PATCH net v2 1/2] tcp: roccet: do not restart from idle on RTO retransmission
Author: Zhiqi Zhang
Date: Wed, 18 Nov 2026 02:28
Date: Wed, 18 Nov 2026 02:28
56 lines
13570 bytes
13570 bytes
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@kernel.org/
Signed-off-by: Zhiqi Zhang <zhiqizhangg@gmail.com>
---
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)
[PATCH net v2 2/2] selftests: net: packetdrill: add ROCCET RTO test
Author: Zhiqi Zhang
Date: Wed, 18 Nov 2026 02:28
Date: Wed, 18 Nov 2026 02:28
108 lines
15108 bytes
15108 bytes
Add a packetdrill test for the ROCCET idle restart on RTO. TLP is
enabled, so the first RTO is affected; the test asserts that
tp->snd_ssthresh stays at the prior cwnd (20) across the first and
second RTOs.
The test fails at the first RTO without the preceding fix
(snd_ssthresh == 10) and passes with it. A variant with
tcp_early_retrans=0 (no TLP) fails at the second RTO only.
CONFIG_TCP_CONG_ADVANCED and CONFIG_TCP_CONG_ROCCET are added to the
packetdrill config; ROCCET is only visible when advanced congestion
control is enabled.
Test written by Eric Dumazet.
Suggested-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Zhiqi Zhang <zhiqizhangg@gmail.com>
---
.../testing/selftests/net/packetdrill/config | 2 +
.../net/packetdrill/tcp_roccet_rto.pkt | 63 +++++++++++++++++++
2 files changed, 65 insertions(+)
create mode 100644 tools/testing/selftests/net/packetdrill/tcp_roccet_rto.pkt
diff --git a/tools/testing/selftests/net/packetdrill/config b/tools/testing/selftests/net/packetdrill/config
index b7df8bf309..6e012141d5 100644
--- a/tools/testing/selftests/net/packetdrill/config
+++ b/tools/testing/selftests/net/packetdrill/config
@@ -6,6 +6,8 @@ CONFIG_NET_SCH_FIFO=y
CONFIG_NET_SCH_FQ=y
CONFIG_SYN_COOKIES=y
CONFIG_SYSCTL=y
+CONFIG_TCP_CONG_ADVANCED=y
CONFIG_TCP_CONG_CUBIC=y
+CONFIG_TCP_CONG_ROCCET=y
CONFIG_TCP_MD5SIG=y
CONFIG_TUN=y
diff --git a/tools/testing/selftests/net/packetdrill/tcp_roccet_rto.pkt b/tools/testing/selftests/net/packetdrill/tcp_roccet_rto.pkt
new file mode 100644
index 0000000000..dabaf07f32
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_roccet_rto.pkt
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0
+// Test that ROCCET does not take its "restart after idle" path on RTO.
+//
+// An RTO retransmit raises CA_EVENT_TX_START, because all outstanding
+// packets were just marked lost (tcp_packets_in_flight() == 0) while
+// tp->packets_out is not zero. If (now - tp->lsndtime) >= icsk_rto,
+// roccet_cwnd_event_tx_start() used to overwrite the snd_ssthresh
+// that tcp_enter_loss() had just set with TCP_INIT_CWND.
+//
+// TLP is enabled here. The RTO timer is rearmed for a full icsk_rto when
+// the loss probe is sent, and the probe is the last transmit, so the
+// very first RTO is affected.
+
+`./defaults.sh
+./set_sysctls.py /proc/sys/net/ipv4/tcp_slow_start_after_idle=1`
+
+ 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+ +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+ +0 setsockopt(3, SOL_TCP, TCP_CONGESTION, "roccet", 6) = 0
+ +0 bind(3, ..., ...) = 0
+ +0 listen(3, 1) = 0
+
+ +0 < S 0:0(0) win 65535 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+ +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+ +.1 < . 1:1(0) ack 1 win 511
+ +0 accept(3, ..., ...) = 4
+
+// ROCCET paces its packets: do not expect precise outgoing packets,
+// rely on TCP_INFO instead.
+ +0 write(4, ..., 10000) = 10000
+ +.1 < . 1:1(0) ack 10001 win 511
+ +0 %{ assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%
+
+// RTT is 100ms, RTO is ~300ms. Nothing is acked from now on.
+ +0 write(4, ..., 20000) = 20000
+
+// TLP fires ~250ms after the write.
+ +.4 %{
+assert tcpi_ca_state == TCP_CA_Open, tcpi_ca_state
+assert tcpi_total_retrans == 1, tcpi_total_retrans
+}%
+
+// First RTO, ~300ms after the TLP probe.
+// ROCCET is still in LAUNCH state: ssthresh is set to the prior cwnd.
+ +.3 %{
+assert tcpi_ca_state == TCP_CA_Loss, tcpi_ca_state
+assert tcpi_backoff == 1, tcpi_backoff
+assert tcpi_total_retrans == 2, tcpi_total_retrans
+assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd
+assert tcpi_snd_ssthresh == 20, tcpi_snd_ssthresh
+}%
+
+// Second RTO, ~600ms after the first one.
+ +.6 %{
+assert tcpi_ca_state == TCP_CA_Loss, tcpi_ca_state
+assert tcpi_backoff == 2, tcpi_backoff
+assert tcpi_total_retrans == 3, tcpi_total_retrans
+assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd
+assert tcpi_snd_ssthresh == 20, tcpi_snd_ssthresh
+}%
+
+// Reset sysctls
+`/tmp/sysctl_restore_${PPID}.sh`
--
2.54.0 (Apple Git-157)
Re: [PATCH net v2 2/2] selftests: net: packetdrill: add ROCCET RTO test
Author: Eric Dumazet
Date: Wed, 18 Nov 2026 10:05
Date: Wed, 18 Nov 2026 10:05
23 lines
9905 bytes
9905 bytes
Le mer. 18 nov. 2026 à 03:28, Zhiqi Zhang <zhiqizhangg@gmail.com> a écrit : > > Add a packetdrill test for the ROCCET idle restart on RTO. TLP is > enabled, so the first RTO is affected; the test asserts that > tp->snd_ssthresh stays at the prior cwnd (20) across the first and > second RTOs. > > The test fails at the first RTO without the preceding fix > (snd_ssthresh == 10) and passes with it. A variant with > tcp_early_retrans=0 (no TLP) fails at the second RTO only. > > CONFIG_TCP_CONG_ADVANCED and CONFIG_TCP_CONG_ROCCET are added to the > packetdrill config; ROCCET is only visible when advanced congestion > control is enabled. > > Test written by Eric Dumazet. > > Suggested-by: Eric Dumazet <edumazet@kernel.org> > Signed-off-by: Zhiqi Zhang <zhiqizhangg@gmail.com> Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Re: [PATCH net v2 1/2] tcp: roccet: do not restart from idle on RTO retransmission
Author: Eric Dumazet
Date: Wed, 18 Nov 2026 10:07
Date: Wed, 18 Nov 2026 10:07
40 lines
10900 bytes
10900 bytes
Le mer. 18 nov. 2026 à 03:28, Zhiqi Zhang <zhiqizhangg@gmail.com> a écrit :
>
> 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@kernel.org/
> Signed-off-by: Zhiqi Zhang <zhiqizhangg@gmail.com>
> ---
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Thanks.
Re: [PATCH net v2 0/2] tcp: roccet: fix idle restart on RTO
Author: patchwork-bot+netdevbpf
Date: Sat, 21 Nov 2026 22:40
Date: Sat, 21 Nov 2026 22:40
26 lines
8795 bytes
8795 bytes
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 18 Nov 2026 10:28:11 +0800 you wrote:
> Patch 1/2 skips the idle restart when packets are outstanding, so an
> RTO retransmission no longer overwrites the snd_ssthresh preserved by
> roccet_state(TCP_CA_Loss). Patch 2/2 adds a packetdrill test.
>
> v1:
> https://lore.kernel.org/all/20261114141315.19007-1-zhiqizhangg@gmail.com/
>
> [...]
Here is the summary with links:
- [net,v2,1/2] tcp: roccet: do not restart from idle on RTO retransmission
https://git.kernel.org/netdev/net-next/c/19764eae5794
- [net,v2,2/2] selftests: net: packetdrill: add ROCCET RTO test
https://git.kernel.org/netdev/net-next/c/295aaa8398ce
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads