Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] selftests: drv-net: uso: test small MSS
@ 2026-11-25  1:38 Joe Damato
  2026-11-25  1:38 ` [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver Joe Damato
  2026-11-25  1:38 ` [PATCH net-next 2/2] selftests: drv-net: uso: add small MSS variants Joe Damato
  0 siblings, 2 replies; 5+ messages in thread
From: Joe Damato @ 2026-11-25  1:38 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, horms,
	narcisav.kernel, Joe Damato, Eric Dumazet, linux-kselftest,
	Shuah Khan

Greetings:

Jakub, Narcisa, and Sashiko previously discussed [1] how small MSS might
produce unsegmented skbs on bnxt; Jakub suggested that USO might trigger
this condition.

This series extends uso.py to test small MSS sizes. I ran the updated
uso.py on a bnxt thor1 device (with SW USO) and the test passed, as
expected.

I have not yet run this test on a HW USO bnxt device because I do not
currently have access to one, but I think extending this test to cover
small MSS is a good idea regardless of whether a particular driver has a
bug.

Thanks,
Joe

[1]: https://lore.kernel.org/all/20261120154835.0f56c410@kernel.org/

Joe Damato (2):
  selftests: drv-net: uso: check datagram sizes at the receiver
  selftests: drv-net: uso: add small MSS variants

 tools/testing/selftests/drivers/net/hw/uso.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)


base-commit: bc686737f555b9d406d2fa80fdc69c85be6eca8f
-- 
2.53.1-Meta


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver
  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
  2026-11-25  7:48   ` Narcisa Vasile
  2026-11-25  1:38 ` [PATCH net-next 2/2] selftests: drv-net: uso: add small MSS variants Joe Damato
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Damato @ 2026-11-25  1:38 UTC (permalink / raw)
  To: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan
  Cc: edumazet, horms, narcisav.kernel, Joe Damato, linux-kselftest

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] selftests: drv-net: uso: add small MSS variants
  2026-11-25  1:38 [PATCH net-next 0/2] selftests: drv-net: uso: test small MSS Joe Damato
  2026-11-25  1:38 ` [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver Joe Damato
@ 2026-11-25  1:38 ` Joe Damato
  2026-11-25  7:51   ` Narcisa Vasile
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Damato @ 2026-11-25  1:38 UTC (permalink / raw)
  To: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan
  Cc: edumazet, horms, narcisav.kernel, Joe Damato, linux-kselftest

Add small MSS variations to test paths in drivers where small frames are
sent through different TX paths.

Signed-off-by: Joe Damato <joe@dama.to>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/testing/selftests/drivers/net/hw/uso.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/hw/uso.py b/tools/testing/selftests/drivers/net/hw/uso.py
index b0936b6b2161..be152d36cf3e 100755
--- a/tools/testing/selftests/drivers/net/hw/uso.py
+++ b/tools/testing/selftests/drivers/net/hw/uso.py
@@ -92,6 +92,8 @@ def _uso_variants():
     for ipver in ["4", "6"]:
         yield KsftNamedVariant(f"v{ipver}_partial", ipver, 1400, 1400 * 10 + 500)
         yield KsftNamedVariant(f"v{ipver}_exact", ipver, 1400, 1400 * 5)
+        yield KsftNamedVariant(f"v{ipver}_small_partial", ipver, 8, 8 * 10 + 4)
+        yield KsftNamedVariant(f"v{ipver}_small_exact", ipver, 32, 32 * 3)
 
 
 @ksft_variants(_uso_variants())
-- 
2.53.1-Meta


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver
  2026-11-25  1:38 ` [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver Joe Damato
@ 2026-11-25  7:48   ` Narcisa Vasile
  0 siblings, 0 replies; 5+ messages in thread
From: Narcisa Vasile @ 2026-11-25  7:48 UTC (permalink / raw)
  To: Joe Damato
  Cc: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan, edumazet, horms,
	narcisav.kernel, linux-kselftest

On Tue, Nov 24, 2026 at 05:38:35PM -0800, Joe Damato wrote:
> 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(-)

Reviewed-by: Narcisa Vasile <narcisav.kernel@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 2/2] selftests: drv-net: uso: add small MSS variants
  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
  0 siblings, 0 replies; 5+ messages in thread
From: Narcisa Vasile @ 2026-11-25  7:51 UTC (permalink / raw)
  To: Joe Damato
  Cc: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan, edumazet, horms,
	narcisav.kernel, linux-kselftest

On Tue, Nov 24, 2026 at 05:38:36PM -0800, Joe Damato wrote:
> Add small MSS variations to test paths in drivers where small frames are
> sent through different TX paths.
> 
> Signed-off-by: Joe Damato <joe@dama.to>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  tools/testing/selftests/drivers/net/hw/uso.py | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Narcisa Vasile <narcisav.kernel@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-25  7:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  1:38 [PATCH net-next 0/2] selftests: drv-net: uso: test small MSS Joe Damato
2026-11-25  1:38 ` [PATCH net-next 1/2] selftests: drv-net: uso: check datagram sizes at the receiver Joe Damato
2026-11-25  7:48   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox