From: Joe Damato <joe@dama.to>
To: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Shuah Khan <shuah@kernel.org>
Cc: edumazet@google.com, horms@kernel.org, narcisav.kernel@gmail.com,
Joe Damato <joe@dama.to>,
linux-kselftest@vger.kernel.org
Subject: [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver
Date: Tue, 24 Nov 2026 17:38:35 -0800 [thread overview]
Message-ID: <20261125013838.3823834-2-joe@dama.to> (raw)
In-Reply-To: <20261125013838.3823834-1-joe@dama.to>
The receiver only checks the total number of bytes received, which is
the same whether the peer gets one datagram per segment or a single
unsegmented datagram.
Run socat with -v, which logs the length of each datagram received,
and check that the peer received one datagram per segment with the
expected sizes.
Signed-off-by: Joe Damato <joe@dama.to>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
---
tools/testing/selftests/drivers/net/hw/uso.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/uso.py b/tools/testing/selftests/drivers/net/hw/uso.py
index 6d61e56cab3c..b0936b6b2161 100755
--- a/tools/testing/selftests/drivers/net/hw/uso.py
+++ b/tools/testing/selftests/drivers/net/hw/uso.py
@@ -4,10 +4,11 @@
"""Test USO
Sends large UDP datagrams with UDP_SEGMENT and verifies that the peer
-receives the expected total payload and that the NIC transmitted at least
-the expected number of segments.
+receives one datagram per segment, with the expected sizes and total payload,
+and that the NIC transmitted at least the expected number of segments.
"""
import random
+import re
import socket
import string
@@ -57,9 +58,12 @@ def _test_uso(cfg, ipver, mss, total_payload):
defer(ethtool, f"-K {cfg.ifname} tx-udp-segmentation off")
expected_segs = (total_payload + mss - 1) // mss
+ expected_sizes = [mss] * (total_payload // mss)
+ if total_payload % mss:
+ expected_sizes.append(total_payload % mss)
port = rand_port(stype=socket.SOCK_DGRAM)
- rx_cmd = f"socat -{ipver} -T 2 -u UDP-LISTEN:{port},reuseport STDOUT"
+ rx_cmd = f"socat -v -{ipver} -T 2 -u UDP-LISTEN:{port},reuseport STDOUT"
tx_before = _get_tx_packets(cfg)
@@ -70,6 +74,11 @@ def _test_uso(cfg, ipver, mss, total_payload):
ksft_eq(len(rx.stdout), total_payload,
comment=f"Received {len(rx.stdout)}B, expected {total_payload}B")
+ rx_sizes = [int(n) for n in re.findall(r"length=(\d+) from=", rx.stderr)]
+ ksft_eq(sorted(rx_sizes), sorted(expected_sizes),
+ comment=f"Received {len(rx_sizes)} datagrams, "
+ f"expected {expected_segs}")
+
cfg.wait_hw_stats_settle()
tx_after = _get_tx_packets(cfg)
--
2.53.1-Meta
next prev parent reply other threads:[~2026-11-25 1:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 1:38 [PATCH net-next 0/2] selftests: drv-net: uso: test small MSS Joe Damato
2026-11-25 1:38 ` Joe Damato [this message]
2026-11-25 7:48 ` [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver Narcisa Vasile
2026-11-25 1:38 ` [PATCH net-next 2/2] selftests: drv-net: uso: add small MSS variants Joe Damato
2026-11-25 7:51 ` Narcisa Vasile
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=20261125013838.3823834-2-joe@dama.to \
--to=joe@dama.to \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=narcisav.kernel@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox