mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yongjian Wang via B4 Relay <devnull+echoowall.gmail.com@kernel.org>
To: ncardwell@google.com, horms@kernel.org, edumazet@kernel.org,
	 kuba@kernel.org, kuniyu@google.com, shuah@kernel.org,
	davem@davemloft.net,  pabeni@redhat.com
Cc: netdev@vger.kernel.org, panweiping3@gmail.com,
	 linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Yongjian Wang <echoowall@gmail.com>
Subject: [PATCH net-next 3/4] selftests/net: packetdrill: add TCP black hole detection test
Date: Tue, 03 Nov 2026 15:09:43 +0800	[thread overview]
Message-ID: <20261103-mtu-probing-series-v1-3-a2809e725aaa@gmail.com> (raw)
In-Reply-To: <20261103-mtu-probing-series-v1-0-a2809e725aaa@gmail.com>

From: Yongjian Wang <echoowall@gmail.com>

Black hole detection (net.ipv4.tcp_mtu_probing=1) has no selftest
coverage.

Add a test where a full-sized segment keeps timing out without any ICMP
feedback. Check that the MSS drops to tcp_base_mss once tcp_retries1 is
exceeded, and that the smaller MSS is also used for new data after the
retransmission is acknowledged.

Set tcp_retries1 to 1 to keep the test short, and disable TLP so that
every retransmission comes from the RTO timer, which is what
tcp_write_timeout() counts.

Signed-off-by: Yongjian Wang <echoowall@gmail.com>
---
 .../net/packetdrill/tcp_mtu_probing_blackhole.pkt  | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole.pkt b/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole.pkt
new file mode 100644
index 000000000..f10dbb36d
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole.pkt
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0
+// Test black hole detection with tcp_mtu_probing=1: when full-sized segments
+// keep timing out and no ICMP arrives, TCP falls back to tcp_base_mss.
+
+`./defaults.sh
+sysctl -q net.ipv4.tcp_mtu_probing=1
+sysctl -q net.ipv4.tcp_base_mss=1024
+sysctl -q net.ipv4.tcp_retries1=1
+sysctl -q net.ipv4.tcp_early_retrans=0`
+
+    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 65535 <mss 1460,nop,nop,sackOK>
+   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
+  +.1 < . 1:1(0) ack 1 win 65535
+   +0 accept(3, ..., ...) = 4
+
+   +0 write(4, ..., 1460) = 1460
+   +0 > P. 1:1461(1460) ack 1
+
+// The first retransmission keeps the full size.
+  +.3 > P. 1:1461(1460) ack 1
+
+// Once tcp_retries1 is exceeded the MSS drops to tcp_base_mss.
+  +.6 > . 1:1025(1024) ack 1
+  +.1 < . 1:1(0) ack 1025 win 65535
+   +0 > P. 1025:1461(436) ack 1
+  +.1 < . 1:1(0) ack 1461 win 65535
+
+// New data keeps using the smaller MSS.
+   +0 write(4, ..., 1460) = 1460
+   +0 > . 1461:2485(1024) ack 1
+   +0 > P. 2485:2921(436) ack 1
+  +.1 < . 1:1(0) ack 2921 win 65535

-- 
Git-157)



  parent reply	other threads:[~2026-11-03  7:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  7:09 [PATCH net-next 0/4] tcp: fix tcp_base_mss on passive connections and test MTU probing Yongjian Wang via B4 Relay
2026-11-03  7:09 ` [PATCH net-next 1/4] tcp: sync MSS after enabling MTU probing on passive connections Yongjian Wang via B4 Relay
2026-11-07 17:53   ` Neal Cardwell
2026-11-07 19:15     ` Kuniyuki Iwashima
2026-11-03  7:09 ` [PATCH net-next 2/4] selftests/net: packetdrill: test tcp_base_mss " Yongjian Wang via B4 Relay
2026-11-03  7:09 ` Yongjian Wang via B4 Relay [this message]
2026-11-03  7:09 ` [PATCH net-next 4/4] selftests/net: packetdrill: add TCP MTU probing test Yongjian Wang via B4 Relay

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=20261103-mtu-probing-series-v1-3-a2809e725aaa@gmail.com \
    --to=devnull+echoowall.gmail.com@kernel.org \
    --cc=davem@davemloft.net \
    --cc=echoowall@gmail.com \
    --cc=edumazet@kernel.org \
    --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=panweiping3@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®