All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf.kernel@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, andrew+netdev@lunn.ch, edumazet@kernel.org,
	shuah@kernel.org, sdf@fomichev.me, bjorn@kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test
Date: Mon, 30 Nov 2026 09:46:07 -0800	[thread overview]
Message-ID: <20261130174609.314114-3-sdf.kernel@gmail.com> (raw)
In-Reply-To: <20261130174609.314114-1-sdf.kernel@gmail.com>

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


  parent reply	other threads:[~2026-11-30 17:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Stanislav Fomichev [this message]
2026-12-01 18:10   ` [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test 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

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=20261130174609.314114-3-sdf.kernel@gmail.com \
    --to=sdf.kernel@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjorn@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.