Re: [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test
From: netdev-bot+sashiko
Date: Tue Dec 01 2026 - 13:10:48 EST
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