Netdev List
 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
Subject: [PATCH net-next 1/4] selftests: drv-net: kperf: support request-response tests
Date: Mon, 23 Nov 2026 09:41:17 -0800	[thread overview]
Message-ID: <20261123174120.505808-2-sdf@fomichev.me> (raw)
In-Reply-To: <20261123174120.505808-1-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 run a single flow; of more, the first
one is kept.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
 .../selftests/drivers/net/lib/py/kperf.py     | 31 +++++++++++++++++--
 1 file changed, 29 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..98d27d83dee2 100644
--- a/tools/testing/selftests/drivers/net/lib/py/kperf.py
+++ b/tools/testing/selftests/drivers/net/lib/py/kperf.py
@@ -7,20 +7,35 @@ import shlex
 import subprocess
 import uuid
 from dataclasses import dataclass
+from typing import Optional
 
 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).
+    """
 
     source_throughput: float
     target_throughput: float
+    rate: Optional[float] = None
+    p25: Optional[float] = None
+    p50: Optional[float] = None
+    p90: Optional[float] = None
+    p99: Optional[float] = None
+    p999: Optional[float] = None
+    p9999: Optional[float] = None
+    lat_max: Optional[float] = None
 
 
 class KperfRunner:
@@ -133,6 +148,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 +165,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 a single flow, take the first one
+            # and ignore the rest
+            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


  reply	other threads:[~2026-11-23 17:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:41 [PATCH net-next 0/4] selftests: replace iperf with kperf and add RR Stanislav Fomichev
2026-11-23 17:41 ` Stanislav Fomichev [this message]
2026-11-23 17:41 ` [PATCH net-next 2/4] selftests: drv-net: add a closed-loop request-response test Stanislav Fomichev
2026-11-23 17:41 ` [PATCH net-next 3/4] selftests: drv-net: add a kperf stream test Stanislav Fomichev
2026-11-23 17:41 ` [PATCH net-next 4/4] selftests: drv-net: remove the iperf performance test Stanislav Fomichev

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=20261123174120.505808-2-sdf@fomichev.me \
    --to=sdf.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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