From: Wesley Atwell <atwellwea@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, edumazet@google.com, ncardwell@google.com,
kuniyu@google.com, dsahern@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
gmbnomis@gmail.com, Wesley Atwell <atwellwea@gmail.com>
Subject: [PATCH net-next v2 3/3] selftests: packetdrill: cover scaled rwnd quantization slack
Date: Tue, 24 Mar 2026 00:04:10 -0600 [thread overview]
Message-ID: <20260324060410.1137199-4-atwellwea@gmail.com> (raw)
In-Reply-To: <20260324060410.1137199-1-atwellwea@gmail.com>
Add a packetdrill reproducer for the free_space-limited scaled
no-shrink quantization case.
Grow rcv_ssthresh with in-order data, then queue tiny OOO skbs so
receive memory drives raw free_space just below rcv_ssthresh without
advancing rcv_nxt. The final ACK reaches the case where raw free_space
sits just above 84 scaled units while rcv_ssthresh stays slightly
larger.
Old code rounds that final free_space value up and advertises 85. With
the fix, the ACK stays at 84.
This gives fail-before/pass-after coverage for the actual raw
free_space bug rather than the separate rcv_ssthresh-limited ALIGN-up
behavior.
Signed-off-by: Wesley Atwell <atwellwea@gmail.com>
---
v2:
- replace the old rcv_ssthresh-limited sequence with an OOO-memory
reproducer for the raw free_space case
- drop the follow-on ACK transition and keep the final free_space
failure case that proves the bug
- drop the IPv4-only restriction after verifying the test passes for
ipv4, ipv6, and ipv4-mapped-ipv6
- reword the in-file comments to describe the observed behavior without
referring to a removed path as "buggy"
.../packetdrill/tcp_rcv_quantization_credit.pkt | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_credit.pkt
diff --git a/tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_credit.pkt b/tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_credit.pkt
new file mode 100644
index 000000000000..bb4f63772326
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_credit.pkt
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0
+
+--mss=1000
+
+`./defaults.sh
+sysctl -q net.ipv4.tcp_moderate_rcvbuf=0
+sysctl -q net.ipv4.tcp_shrink_window=0
+sysctl -q net.ipv4.tcp_rmem="4096 131072 $((32*1024*1024))"`
+
+// Exercise the scaled no-shrink path when raw backed free_space, not
+// rcv_ssthresh, limits the post-ACK window in __tcp_select_window().
+//
+// Grow rcv_ssthresh with in-order data, then queue tiny OOO skbs so receive
+// memory drops raw free_space to just over 84 scaled units while the current
+// rcv_ssthresh stays slightly larger. The final OOO ACK should keep the
+// sender-visible window at 84 rather than reopening it to 85.
+ +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+ +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+ +0 bind(3, ..., ...) = 0
+ +0 listen(3, 1) = 0
+
+ +0 < S 0:0(0) win 32792 <mss 1000,nop,wscale 7>
+ +0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 10>
+ +0 < . 1:1(0) ack 1 win 257
+
+ +0 accept(3, ..., ...) = 4
+
+ +0 < P. 1:10001(10000) ack 1 win 257
+ * > . 1:1(0) ack 10001
+
+ +0 < P. 10001:11024(1023) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 12024:12025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 13024:13025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 14024:14025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 15024:15025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 16024:16025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 17024:17025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 18024:18025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+ +0 < P. 19024:19025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024
+
+// The last tiny OOO skb pushes raw free_space just below rcv_ssthresh
+// without crossing the next lower scaled unit.
+ +0 < P. 20024:20025(1) ack 1 win 257
+ * > . 1:1(0) ack 11024 win 84
+ +0 %{ assert (tcpi_rcv_wnd >> 10) == 84, tcpi_rcv_wnd }%
--
2.43.0
prev parent reply other threads:[~2026-03-24 6:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 6:04 [PATCH net-next v2 0/3] tcp: fix scaled no-shrink rwnd quantization slack Wesley Atwell
2026-03-24 6:04 ` [PATCH net-next v2 1/3] selftests: packetdrill: stop pinning rwnd in tcp_ooo_rcv_mss Wesley Atwell
2026-03-24 14:28 ` Eric Dumazet
2026-03-24 6:04 ` [PATCH net-next v2 2/3] tcp: keep scaled no-shrink window representable Wesley Atwell
2026-03-24 7:18 ` Eric Dumazet
2026-03-24 6:04 ` Wesley Atwell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260324060410.1137199-4-atwellwea@gmail.com \
--to=atwellwea@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gmbnomis@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.