Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR
@ 2026-11-30 17:46 Stanislav Fomichev
  2026-11-30 17:46 ` [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests Stanislav Fomichev
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Stanislav Fomichev @ 2026-11-30 17:46 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, edumazet, shuah,
	sdf, bjorn, linux-kernel, linux-kselftest

From: Stanislav Fomichev <sdf@fomichev.me>

Recently added iperf throughput runs (918696-924166) have not been stable:

  ktap-metric-json: {"goal":"higher","name":"throughput","value":99.60508305201279}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":90.65816851430006}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":92.02795621872379}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":98.78863365714747}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":103.38157195808748}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":93.64137239021106}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":101.73578035463773}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":78.15304223077422}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":103.79536587818043}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":91.48843017237692}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":75.27885187718259}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":103.5323033205535}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":92.04284599832805}

Compared to kperf devmem:

  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.588}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.63}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.606}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.594}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.54}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.594}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.552}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.561}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.616}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.63}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.532}
  ktap-metric-json: {"goal":"higher","name":"throughput","value":185.62}

This is most likely due to --pin-off we are doing with kperf. So replace
iperf with kperf (add regular and zerocopy variants).

At the same time, add closed loop RR stats to estimate the amount PPS
we can take (so I can follow up with open loop RR).

v2:
- fix the ruff UP045 warnings (Willem)
- (trying to) send with matching From and Signed-off-by addresses (Willem)
- say that the first value kperf reports for each metric is kept, rather
  than the values of the first flow (Sashiko)

Stanislav Fomichev (4):
  selftests: drv-net: kperf: support request-response tests
  selftests: drv-net: add a closed-loop request-response test
  selftests: drv-net: add a kperf stream test
  selftests: drv-net: remove the iperf performance test

 .../selftests/drivers/net/lib/py/kperf.py     | 33 ++++++++++++-
 .../selftests/drivers/net/perf/Makefile       |  3 +-
 .../selftests/drivers/net/perf/iperf.py       | 23 ---------
 .../testing/selftests/drivers/net/perf/rr.py  | 47 +++++++++++++++++++
 .../selftests/drivers/net/perf/stream.py      | 40 ++++++++++++++++
 5 files changed, 120 insertions(+), 26 deletions(-)
 delete mode 100755 tools/testing/selftests/drivers/net/perf/iperf.py
 create mode 100755 tools/testing/selftests/drivers/net/perf/rr.py
 create mode 100755 tools/testing/selftests/drivers/net/perf/stream.py

-- 
2.53.1-Meta


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

* [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests
  2026-11-30 17:46 [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Stanislav Fomichev
@ 2026-11-30 17:46 ` Stanislav Fomichev
  2026-12-01 18:10   ` netdev-bot+sashiko
  2026-11-30 17:46 ` [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test Stanislav Fomichev
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Stanislav Fomichev @ 2026-11-30 17:46 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, edumazet, shuah,
	sdf, bjorn, linux-kernel, linux-kselftest

From: Stanislav Fomichev <sdf@fomichev.me>

Let KperfResult tell the rate of the transactions of request-response
tests and, when the client is asked for them with --time-stats 2, their
latency percentiles and maximum, as seen by the source, which sends the
requests. Request-response tests should run one connection; of more,
the first value kperf reports for each metric is kept.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
v1: https://lore.kernel.org/netdev/20261123174120.505808-1-sdf@fomichev.me/
---
 .../selftests/drivers/net/lib/py/kperf.py     | 33 +++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/lib/py/kperf.py b/tools/testing/selftests/drivers/net/lib/py/kperf.py
index 8ee8c5ba2ff7..3092d3c56b7f 100644
--- a/tools/testing/selftests/drivers/net/lib/py/kperf.py
+++ b/tools/testing/selftests/drivers/net/lib/py/kperf.py
@@ -2,6 +2,8 @@
 
 """Run and parse kperf network performance measurements."""
 
+from __future__ import annotations
+
 import re
 import shlex
 import subprocess
@@ -13,14 +15,29 @@ from lib.py import cmd, ksft_pr, rand_port, wait_port_listen
 
 _SECTION_RE = re.compile(r"==\s+(Source|Target)\b")
 _RATE_RE = re.compile(r"\b(Tx|Rx)\s*([0-9]+(?:\.[0-9]+)?)\s+Gbps\b")
+_RPS_RE = re.compile(r"\b([0-9]+(?:\.[0-9]+)?) RPS\b")
+_LAT_RE = re.compile(
+    r"\b(p25|p50|p90|p99|p999|p9999|max):([0-9]+(?:\.[0-9]+)?)us\b")
 
 
 @dataclass
 class KperfResult:
-    """Aggregate throughput (Gbps) of both endpoints."""
+    """Aggregate throughput (Gbps) of both endpoints. Request-response tests
+    also tell the rate (per second) of the source, which sends the requests,
+    and with --time-stats 2 its latencies (usec). They should run one
+    connection: of more, the first value kperf reports for each is kept.
+    """
 
     source_throughput: float
     target_throughput: float
+    rate: float | None = None
+    p25: float | None = None
+    p50: float | None = None
+    p90: float | None = None
+    p99: float | None = None
+    p999: float | None = None
+    p9999: float | None = None
+    lat_max: float | None = None
 
 
 class KperfRunner:
@@ -133,6 +150,7 @@ _RATE_RE = re.compile(r"\b(Tx|Rx)\s*([0-9]+(?:\.[0-9]+)?)\s+Gbps\b")
     def parse(output):
         """Parse human-readable kperf client output."""
         throughput = {"Source": [], "Target": []}
+        rr = {}
         section = None
 
         for line in output.splitlines():
@@ -149,9 +167,20 @@ _RATE_RE = re.compile(r"\b(Tx|Rx)\s*([0-9]+(?:\.[0-9]+)?)\s+Gbps\b")
                 if (section, direction) in (("Source", "Tx"),
                                              ("Target", "Rx")):
                     throughput[section].append(float(value))
+            if section != "Source":
+                continue
+
+            # Request-response tests run one connection, keep the first
+            # value kperf reports for each metric
+            match = _RPS_RE.search(line)
+            if match:
+                rr.setdefault("rate", float(match.group(1)))
+            for name, value in _LAT_RE.findall(line):
+                key = "lat_max" if name == "max" else name
+                rr.setdefault(key, float(value))
 
         if not all(throughput.values()):
             raise ValueError("incomplete kperf result")
 
         return KperfResult(sum(throughput["Source"]),
-                           sum(throughput["Target"]))
+                           sum(throughput["Target"]), **rr)
-- 
2.53.1-Meta


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

* [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test
  2026-11-30 17:46 [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Stanislav Fomichev
  2026-11-30 17:46 ` [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests Stanislav Fomichev
@ 2026-11-30 17:46 ` Stanislav Fomichev
  2026-12-01 18:10   ` netdev-bot+sashiko
  2026-11-30 17:46 ` [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test Stanislav Fomichev
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Stanislav Fomichev @ 2026-11-30 17:46 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, edumazet, shuah,
	sdf, bjorn, linux-kernel, linux-kselftest

From: Stanislav Fomichev <sdf@fomichev.me>

Add rr.py, which measures back-to-back transactions of a kilobyte each
way, which fits in a 1500 byte MTU, over one connection with kperf, and
reports their rate and the latency percentiles and maximum which kperf
reports.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
 .../selftests/drivers/net/perf/Makefile       |  1 +
 .../testing/selftests/drivers/net/perf/rr.py  | 47 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100755 tools/testing/selftests/drivers/net/perf/rr.py

diff --git a/tools/testing/selftests/drivers/net/perf/Makefile b/tools/testing/selftests/drivers/net/perf/Makefile
index 1a90537d2726..91feb0d62a7b 100644
--- a/tools/testing/selftests/drivers/net/perf/Makefile
+++ b/tools/testing/selftests/drivers/net/perf/Makefile
@@ -3,6 +3,7 @@
 TEST_PROGS := \
 	devmem.py \
 	iperf.py \
+	rr.py \
 # end of TEST_PROGS
 
 TEST_INCLUDES := \
diff --git a/tools/testing/selftests/drivers/net/perf/rr.py b/tools/testing/selftests/drivers/net/perf/rr.py
new file mode 100755
index 000000000000..1dff0c476390
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/perf/rr.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0
+
+"""Measure TCP request-response performance with kperf."""
+
+from lib.py import KperfRunner, NetDrvEpEnv, ksft_exit, ksft_metric, ksft_run
+
+
+# One connection, a kilobyte each way, which fits in a 1500 byte MTU, and
+# latency percentiles
+RR_ARGS = [
+    "--time", "10",
+    "--warmup", "100",
+    "--num-connections", "1",
+    "--req-size", "1024",
+    "--resp-size", "1024",
+    "--time-stats", "2",
+    "--validate", "no",
+]
+
+
+def _report(result) -> None:
+    ksft_metric("rate", result.rate, goal="higher")
+    ksft_metric("latency_p25", result.p25, goal="lower")
+    ksft_metric("latency_p50", result.p50, goal="lower")
+    ksft_metric("latency_p90", result.p90, goal="lower")
+    ksft_metric("latency_p99", result.p99, goal="lower")
+    ksft_metric("latency_p999", result.p999, goal="lower")
+    ksft_metric("latency_p9999", result.p9999, goal="lower")
+    ksft_metric("latency_max", result.lat_max, goal="lower")
+
+
+def closed_loop(cfg) -> None:
+    """Measure back-to-back transactions."""
+    with KperfRunner(cfg) as runner:
+        _report(runner.run(RR_ARGS))
+
+
+def main() -> None:
+    """Run the request-response performance tests."""
+    with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
+        ksft_run([closed_loop], args=(cfg,))
+    ksft_exit()
+
+
+if __name__ == "__main__":
+    main()
-- 
2.53.1-Meta


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

* [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test
  2026-11-30 17:46 [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Stanislav Fomichev
  2026-11-30 17:46 ` [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests Stanislav Fomichev
  2026-11-30 17:46 ` [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test Stanislav Fomichev
@ 2026-11-30 17:46 ` Stanislav Fomichev
  2026-12-01 18:10   ` netdev-bot+sashiko
  2026-11-30 17:46 ` [PATCH net-next v2 4/4] selftests: drv-net: remove the iperf performance test Stanislav Fomichev
  2026-12-01  8:07 ` [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Björn Töpel
  4 siblings, 1 reply; 9+ messages in thread
From: Stanislav Fomichev @ 2026-11-30 17:46 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, edumazet, shuah,
	sdf, bjorn, linux-kernel, linux-kselftest

From: Stanislav Fomichev <sdf@fomichev.me>

Add stream.py, which measures the throughput of one TCP connection with
kperf, with the same settings as devmem.py otherwise: once over copying
sockets, and once with MSG_ZEROCOPY on the sender and
TCP_ZEROCOPY_RECEIVE on the receiver. kperf pins the application a few
CPUs away from the interrupts of the flow, so that the CPUs of a run do
not depend on the scheduler. One connection is bound by the CPU rather
than the line rate, so that the throughput follows changes to the cost
of the stack and the driver.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
 .../selftests/drivers/net/perf/Makefile       |  1 +
 .../selftests/drivers/net/perf/stream.py      | 40 +++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100755 tools/testing/selftests/drivers/net/perf/stream.py

diff --git a/tools/testing/selftests/drivers/net/perf/Makefile b/tools/testing/selftests/drivers/net/perf/Makefile
index 91feb0d62a7b..b3f9dcac700b 100644
--- a/tools/testing/selftests/drivers/net/perf/Makefile
+++ b/tools/testing/selftests/drivers/net/perf/Makefile
@@ -4,6 +4,7 @@ TEST_PROGS := \
 	devmem.py \
 	iperf.py \
 	rr.py \
+	stream.py \
 # end of TEST_PROGS
 
 TEST_INCLUDES := \
diff --git a/tools/testing/selftests/drivers/net/perf/stream.py b/tools/testing/selftests/drivers/net/perf/stream.py
new file mode 100755
index 000000000000..4ed9d64dfa32
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/perf/stream.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0
+
+"""Measure TCP stream throughput with kperf."""
+
+from lib.py import KperfRunner, KsftNamedVariant, NetDrvEpEnv, ksft_exit
+from lib.py import ksft_metric, ksft_run, ksft_variants
+
+
+@ksft_variants([
+    KsftNamedVariant("copy", []),
+    KsftNamedVariant("zerocopy", ["--msg-zerocopy", "--zerocopy-rx"]),
+])
+def tcp(cfg, mode_args) -> None:
+    """Measure the throughput of one TCP connection."""
+    stream_args = [
+        "--time", "15",
+        "--num-connections", "1",
+        "--read-size", str(64 << 20),
+        "--write-size", str(64 << 20),
+        "--pin-off", "4",
+        "--validate", "no",
+        *mode_args,
+    ]
+
+    with KperfRunner(cfg) as runner:
+        result = runner.run(stream_args)
+
+    ksft_metric("throughput", result.target_throughput, goal="higher")
+
+
+def main() -> None:
+    """Run the stream performance test."""
+    with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
+        ksft_run([tcp], args=(cfg,))
+    ksft_exit()
+
+
+if __name__ == "__main__":
+    main()
-- 
2.53.1-Meta


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

* [PATCH net-next v2 4/4] selftests: drv-net: remove the iperf performance test
  2026-11-30 17:46 [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Stanislav Fomichev
                   ` (2 preceding siblings ...)
  2026-11-30 17:46 ` [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test Stanislav Fomichev
@ 2026-11-30 17:46 ` Stanislav Fomichev
  2026-12-01  8:07 ` [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Björn Töpel
  4 siblings, 0 replies; 9+ messages in thread
From: Stanislav Fomichev @ 2026-11-30 17:46 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, edumazet, shuah,
	sdf, bjorn, linux-kernel, linux-kselftest

From: Stanislav Fomichev <sdf@fomichev.me>

The throughput of one iperf3 stream changes by about 10% between
back-to-back runs on the same hosts, e.g. from 90.7 to 99.6 Gbps over
four runs, as much as a regression would. stream.py measures one TCP
connection with kperf instead, remove iperf.py.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
 .../selftests/drivers/net/perf/Makefile       |  1 -
 .../selftests/drivers/net/perf/iperf.py       | 23 -------------------
 2 files changed, 24 deletions(-)
 delete mode 100755 tools/testing/selftests/drivers/net/perf/iperf.py

diff --git a/tools/testing/selftests/drivers/net/perf/Makefile b/tools/testing/selftests/drivers/net/perf/Makefile
index b3f9dcac700b..898236833c42 100644
--- a/tools/testing/selftests/drivers/net/perf/Makefile
+++ b/tools/testing/selftests/drivers/net/perf/Makefile
@@ -2,7 +2,6 @@
 
 TEST_PROGS := \
 	devmem.py \
-	iperf.py \
 	rr.py \
 	stream.py \
 # end of TEST_PROGS
diff --git a/tools/testing/selftests/drivers/net/perf/iperf.py b/tools/testing/selftests/drivers/net/perf/iperf.py
deleted file mode 100755
index 5b6f0bce2a03..000000000000
--- a/tools/testing/selftests/drivers/net/perf/iperf.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python3
-# SPDX-License-Identifier: GPL-2.0
-
-"""Measure TCP throughput with iperf3."""
-
-from lib.py import Iperf3Runner, NetDrvEpEnv, ksft_exit, ksft_metric, ksft_run
-
-
-def tcp(cfg):
-    """Measure TCP throughput."""
-    result = Iperf3Runner(cfg).measure()
-    ksft_metric("throughput", result.throughput, goal="higher")
-
-
-def main():
-    """Run the iperf performance test."""
-    with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
-        ksft_run([tcp], args=(cfg,))
-    ksft_exit()
-
-
-if __name__ == "__main__":
-    main()
-- 
2.53.1-Meta


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

* Re: [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR
  2026-11-30 17:46 [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Stanislav Fomichev
                   ` (3 preceding siblings ...)
  2026-11-30 17:46 ` [PATCH net-next v2 4/4] selftests: drv-net: remove the iperf performance test Stanislav Fomichev
@ 2026-12-01  8:07 ` Björn Töpel
  4 siblings, 0 replies; 9+ messages in thread
From: Björn Töpel @ 2026-12-01  8:07 UTC (permalink / raw)
  To: Stanislav Fomichev, netdev
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, edumazet, shuah,
	sdf, linux-kernel, linux-kselftest

Stanislav Fomichev <sdf.kernel@gmail.com> writes:

> From: Stanislav Fomichev <sdf@fomichev.me>
>
> Recently added iperf throughput runs (918696-924166) have not been stable:
>
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":99.60508305201279}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":90.65816851430006}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":92.02795621872379}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":98.78863365714747}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":103.38157195808748}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":93.64137239021106}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":101.73578035463773}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":78.15304223077422}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":103.79536587818043}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":91.48843017237692}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":75.27885187718259}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":103.5323033205535}
>   ktap-metric-json: {"goal":"higher","name":"throughput","value":92.04284599832805}


Nice getting RR stats in! Curious; the kperf copy runs, are they as
stable as the devmem runs now?

For the series:
Reviewed-by: Björn Töpel <bjorn@kernel.org>

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

* Re: [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests
  2026-11-30 17:46 ` [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests Stanislav Fomichev
@ 2026-12-01 18:10   ` netdev-bot+sashiko
  0 siblings, 0 replies; 9+ messages in thread
From: netdev-bot+sashiko @ 2026-12-01 18:10 UTC (permalink / raw)
  To: sdf.kernel
  Cc: netdev, davem, edumazet, kuba, pabeni, andrew+netdev, edumazet,
	shuah, sdf, bjorn, linux-kernel, linux-kselftest

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The docstring of KperfResult in
  tools/testing/selftests/drivers/net/lib/py/kperf.py reads "They should…

--

selftests: drv-net: kperf: support request-response tests

This commit extends KperfResult with the transaction rate of
request-response tests. With --time-stats 2 it also records the latency
percentiles and maximum, as seen by the source. parse() keeps the first
value kperf reports for each of these metrics.

> Request-response tests should run one connection; of more,
> the first value kperf reports for each metric is kept.

This isn't a bug, but "of more" in the commit message doesn't read
correctly. Was "if more are run" intended?

> diff --git a/tools/testing/selftests/drivers/net/lib/py/kperf.py b/tools/testing/selftests/drivers/net/lib/py/kperf.py
> index 8ee8c5ba2ff7b..3092d3c56b7f7 100644
> --- a/tools/testing/selftests/drivers/net/lib/py/kperf.py
> +++ b/tools/testing/selftests/drivers/net/lib/py/kperf.py

[ ... ]

> @@ -13,14 +15,29 @@ from lib.py import cmd, ksft_pr, rand_port, wait_port_listen
>  
>  _SECTION_RE = re.compile(r"==\s+(Source|Target)\b")
>  _RATE_RE = re.compile(r"\b(Tx|Rx)\s*([0-9]+(?:\.[0-9]+)?)\s+Gbps\b")
> +_RPS_RE = re.compile(r"\b([0-9]+(?:\.[0-9]+)?) RPS\b")
> +_LAT_RE = re.compile(
> +    r"\b(p25|p50|p90|p99|p999|p9999|max):([0-9]+(?:\.[0-9]+)?)us\b")
>  
>  
>  @dataclass
>  class KperfResult:
> -    """Aggregate throughput (Gbps) of both endpoints."""
> +    """Aggregate throughput (Gbps) of both endpoints. Request-response tests
> +    also tell the rate (per second) of the source, which sends the requests,
> +    and with --time-stats 2 its latencies (usec). They should run one
> +    connection: of more, the first value kperf reports for each is kept.

[Severity: Low]
This isn't a bug, but the docstring has the same "of more" wording. This
sentence is the only place in the code that documents the multi-connection
behavior.

In parse(), rr.setdefault() keeps only the first connection's rate and
latency values, while throughput is summed across all connections.

Would something like this be clearer?

    If more connections are run, only the first value kperf reports for
    each metric is kept.

> +    """
>  
>      source_throughput: float
>      target_throughput: float

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130174609.314114-1-sdf.kernel%40gmail.com

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

* Re: [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test
  2026-11-30 17:46 ` [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test Stanislav Fomichev
@ 2026-12-01 18:10   ` netdev-bot+sashiko
  0 siblings, 0 replies; 9+ messages in thread
From: netdev-bot+sashiko @ 2026-12-01 18:10 UTC (permalink / raw)
  To: sdf.kernel
  Cc: netdev, davem, edumazet, kuba, pabeni, andrew+netdev, edumazet,
	shuah, sdf, bjorn, linux-kernel, linux-kselftest

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] `closed_loop()` and `_report()` in
  tools/testing/selftests/drivers/net/perf/rr.py pass the request-…

--

selftests: drv-net: add a closed-loop request-response test

This adds rr.py. It uses kperf to run back-to-back 1 KiB request-response
transactions over a single connection. It then reports the transaction
rate, the latency percentiles and the maximum latency as ksft metrics.

> diff --git a/tools/testing/selftests/drivers/net/perf/rr.py b/tools/testing/selftests/drivers/net/perf/rr.py
> new file mode 100755
> index 0000000000000..1dff0c4763909
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/perf/rr.py

[ ... ]

> +def _report(result) -> None:
> +    ksft_metric("rate", result.rate, goal="higher")
> +    ksft_metric("latency_p25", result.p25, goal="lower")
> +    ksft_metric("latency_p50", result.p50, goal="lower")
> +    ksft_metric("latency_p90", result.p90, goal="lower")
> +    ksft_metric("latency_p99", result.p99, goal="lower")
> +    ksft_metric("latency_p999", result.p999, goal="lower")
> +    ksft_metric("latency_p9999", result.p9999, goal="lower")
> +    ksft_metric("latency_max", result.lat_max, goal="lower")
> +
> +
> +def closed_loop(cfg) -> None:
> +    """Measure back-to-back transactions."""
> +    with KperfRunner(cfg) as runner:
> +        _report(runner.run(RR_ARGS))

[Severity: Medium]
If kperf produces no request-response data, can closed_loop() still
report PASS?

In tools/testing/selftests/drivers/net/lib/py/kperf.py, every
request-response field of KperfResult defaults to None:

    rate: float | None = None
    p25: float | None = None
    ...
    lat_max: float | None = None

KperfRunner.parse() fills these fields only when _RPS_RE or _LAT_RE
matches a line in the Source section. Its only completeness check covers
throughput:

    rr.setdefault("rate", float(match.group(1)))
    ...
    rr.setdefault(key, float(value))
    ...
    if not all(throughput.values()):
        raise ValueError("incomplete kperf result")

ksft_metric() does not validate value either. json.dumps() turns None
into null, and metrics do not affect the test result.

So the test would pass if kperf printed no RPS line or no latency lines
in the Source section. That could happen if a kperf build ignores
--time-stats 2, uses a different output format or unit, or prints the
stats under Target. The output would then be eight ktap-metric-json
records with "value":null.

Would it make sense to check these fields in closed_loop() or _report()?
lib.py already exports ksft_not_none(), or rr.py could raise
KsftFailEx when a field is missing.

Nothing later in the series changes rr.py, kperf.py or ksft.py.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130174609.314114-1-sdf.kernel%40gmail.com

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

* Re: [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test
  2026-11-30 17:46 ` [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test Stanislav Fomichev
@ 2026-12-01 18:10   ` netdev-bot+sashiko
  0 siblings, 0 replies; 9+ messages in thread
From: netdev-bot+sashiko @ 2026-12-01 18:10 UTC (permalink / raw)
  To: sdf.kernel
  Cc: netdev, davem, edumazet, kuba, pabeni, andrew+netdev, edumazet,
	shuah, sdf, bjorn, linux-kernel, linux-kselftest

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The "zerocopy" variant of tcp() in stream.py adds "--msg-
  zerocopy" and "--zerocopy-rx".
- [Low] The commit message for stream.py says it measures one TCP
  connection "with the same settings as devmem.py otherwise".

--

selftests: drv-net: add a kperf stream test

This adds stream.py, a drv-net perf selftest that uses kperf to measure
the throughput of a single TCP connection. It has two variants: plain
copy, and MSG_ZEROCOPY on the sender with TCP_ZEROCOPY_RECEIVE on the
receiver.

> Add stream.py, which measures the throughput of one TCP connection with
> kperf, with the same settings as devmem.py otherwise: once over copying
> sockets, and once with MSG_ZEROCOPY on the sender and
> TCP_ZEROCOPY_RECEIVE on the receiver.

[Severity: Low]
Is "with the same settings as devmem.py otherwise" accurate?

The two tests share the kperf client options: --time 15, the 64 MiB read
and write sizes, --pin-off 4 and --validate no.

devmem.py's kperf() also sets up the device before it measures:

tools/testing/selftests/drivers/net/perf/devmem.py:kperf() {
    ...
    _enable_hw_gro(cfg)
    ...
        "tcp-data-split": "enabled",
    ...
        config["hds-thresh"] = 0
    defer(ethnl.rings_set, restore)
    ethnl.rings_set(config)
    ...
        "--num-rx-queues", "4",
    ...
}

stream.py's tcp() does none of this, so it runs with the driver's
default GRO, HDS and RSS settings. The message only mentions the change
from 4 connections to 1.

Could the message say that the device-level setup also differs? Then the
stream.py and devmem.py numbers wouldn't be read as directly comparable.

> diff --git a/tools/testing/selftests/drivers/net/perf/stream.py b/tools/testing/selftests/drivers/net/perf/stream.py
> new file mode 100755
> index 0000000000000..4ed9d64dfa320
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/perf/stream.py
> @@ -0,0 +1,40 @@

[ ... ]

> +@ksft_variants([
> +    KsftNamedVariant("copy", []),
> +    KsftNamedVariant("zerocopy", ["--msg-zerocopy", "--zerocopy-rx"]),
> +])
> +def tcp(cfg, mode_args) -> None:
> +    """Measure the throughput of one TCP connection."""
> +    stream_args = [

[ ... ]

> +    with KperfRunner(cfg) as runner:
> +        result = runner.run(stream_args)
> +
> +    ksft_metric("throughput", result.target_throughput, goal="higher")

[Severity: Medium]
Does the zerocopy variant actually exercise TCP_ZEROCOPY_RECEIVE on a
device with default settings?

The variant only adds kperf flags. On the kernel side, can_map_frag()
only maps full-page frags at offset 0:

net/ipv4/tcp.c:can_map_frag() {
    ...
	if (skb_frag_size(frag) != PAGE_SIZE || skb_frag_off(frag))
		return false;
    ...
}

NICs normally produce frags like that only with header-data split and an
MTU large enough for page-sized payloads. stream.py sets neither.
devmem.py at least enables tcp-data-split.

With no HDS and a 1500 MTU, every payload frag fails can_map_frag().
tcp_zerocopy_receive() then maps nothing, and the receiver copies the
data instead.

Nothing here checks whether zerocopy happened. KperfRunner.parse() in
drivers/net/lib/py/kperf.py only extracts throughput, rate and latency:

        return KperfResult(sum(throughput["Source"]),
                           sum(throughput["Target"]), **rr)

tcp() then reports only the throughput metric.

Can the "zerocopy" result come from the copy receive path and still be
labelled zerocopy? If so, a loss of TCP_ZEROCOPY_RECEIVE, or a
regression in it, would not show up in this sub-case.

If kperf fails instead of falling back when nothing can be mapped,
wouldn't this variant fail on most default setups?

Would it make sense to enable HDS (and possibly raise the MTU) for this
variant? Another option is to check that pages were actually mapped, or
that SO_EE_CODE_ZEROCOPY_COPIED was not reported.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130174609.314114-1-sdf.kernel%40gmail.com

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

end of thread, other threads:[~2026-12-01 18:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 17:46 [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Stanislav Fomichev
2026-11-30 17:46 ` [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests Stanislav Fomichev
2026-12-01 18:10   ` netdev-bot+sashiko
2026-11-30 17:46 ` [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test Stanislav Fomichev
2026-12-01 18:10   ` netdev-bot+sashiko
2026-11-30 17:46 ` [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test Stanislav Fomichev
2026-12-01 18:10   ` netdev-bot+sashiko
2026-11-30 17:46 ` [PATCH net-next v2 4/4] selftests: drv-net: remove the iperf performance test Stanislav Fomichev
2026-12-01  8:07 ` [PATCH net-next v2 0/4] selftests: replace iperf with kperf and add RR Björn Töpel

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