Article View: linux.kernel.netdev
Article #24725[PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests
From: Stanislav Fomichev
Date: Mon, 30 Nov 2026 17:46
Date: Mon, 30 Nov 2026 17:46
92 lines
14300 bytes
14300 bytes
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
Technical Details
Message-ID:
<20261130174609.314114-2-sdf.kernel@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374358-linux-kernel-netdev=dewy.ruReferences:
<20261130174609.314114-1-sdf.kernel@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374358-linux-kernel-netdev=dewy.ru
From: sdf.kernel@gmail.com (Stanislav Fomichev)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 1/4] selftests: drv-net: kperf: support request-response tests
Date: Mon, 30 Nov 2026 09:46:06 -0800
Organization: Usenet Network
Message-ID: <20261130174609.314114-2-sdf.kernel@gmail.com>
References: <20261130174609.314114-1-sdf.kernel@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1489813"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2oKz91H2F4eUxn3GvKAQ1hOiFb0= sha256:HLbBbHJWHqBCIVt73+ERpp6ZSNzqUSjSVmKWN7itW1M=
sha1:Rf8kfHTNvvKbZ09+QzX9BMRmbJ0= sha256:GIYFGtPlR18cb/PTHpeWVVyksgtFCZ6f9BN47gg5GXE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id A800E125FFE; Mon, 30 Nov 2026 20:46:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id J8NYG12XE5MX;
Mon, 30 Nov 2026 20:46:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374358-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id A5164125FFB; Mon, 30 Nov 2026 20:46:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 359062737A; Mon, 30 Nov 2026 17:46:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796060774;
b=MMik/NiFSKFBfpgz6JXYhck0nhJCTN12bfvllhAE3sklr5WBXVdvYCKRFR6Gi2wVlcne
Cv3sjGvUJKP7SXGdmj1aGkHaavHGbF1Jrh8XgCWid7K03tmPUHQiSzjJLuYowJDCz0jxW
lzMIE6P82vM8rJbQc142jjmQ+qfjeZmUtdsUo6L64sZgwA9cKlh7mgp40ty+UGoVBucuu
uHheccmxPc8USy/s3J35fX21Z7GaKOsrWRxH6q69J9P4SXHsLvTMhpYJj++2KnrtixZqo
eJLIqD30nSdh55SPfcJ9y0hO79MHWc0DzcxM/VLoGOOQU6MUqOOF5jcEMctzBY7zn9w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796060774;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=r/2G8Wj8EFaZXrGuG4n9TNRT3MnecL71wtZn4II9PnA=;
b=RYAtE57XepW39HlwP46j10jGtsiRQRPaBZ7G9v6Vg+C9AlqQg9FDgqFXjIcmS7kEiL4u
ik7cj6qIPEXDn597mhkbYysrt8ekS7W9PCafkaxFHmlKrpoPqSxyCggIJ8watZJjhkbLb
+/gX3Jbmi6B2t+Y+IsWWfnZC2d/xQtJF+8jYD7imCU29VVqsjUIw+LHL2XEzAYBZ9CHPX
MMb7hOq27sQjG525i0r5SkpUhYQ92vbKVrZPBBYD1DyZPSLlXxXfCod7dkxuYlbpUb5S+
hWD97nwWE40keamZD6DAUy9RIDcZNhYJ45ukgGKrJkCvAyJecsZo5d9ywaZUrJ3nkEA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PSN3GhrZ;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 14189606A33F;
Mon, 30 Nov 2026 17:46:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PSN3GhrZ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.5
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796060773;
b=yWGFm+dvYRFhFcI1/925sygCM4jG/muSOkucfEmCCRagSEU/xppqXrBOAP9M9/u6KRH0
HjtDmxSLfGpy0nTS5vtJwWV+jFQfLbmppnODPuxmcswpxFNXkMCxiEZLcpBK9KTRsTeJv
DptBYYNzIZ12Ws4aGQx69UWvaCezAdhmgGb8o4/sukFuV8v8gTIsGXxl69qlfU9kS+Bjh
bdoN3PyCSPafECzthKi36sn2dP9yu/fqyayK7Fx3B9PEw8W1nIHHDq5ydSW5IG7GdbUfr
B0Xp7dFVCvd3bOUDUUSWqJrfUZzWiQHDWZvgeLQdQnnsvvM32j8+oSKS7K9yqDj2Qmg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796060773;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=r/2G8Wj8EFaZXrGuG4n9TNRT3MnecL71wtZn4II9PnA=;
b=eI+3FKpxS4amGOKfJXOQoyBLufBnspIHX3LcsTdnZXs/S90idFyY4ACm5c2k6Xm66twp
wGgW3hqQNt56crKHvv3lQK5rTd4Sh8VoHTdeSJbYwiQ1xT/NOHOqYTAXci5GDdutbEsky
UODEmTmd1W+PLb/ENaM89bLYcydp2+fhiienq1DVxWE6qDlnQ/syVZZ/3Tr82YlgXcKaM
DWuqLhj5yMF0nJKCh+TxwqklV2kl0CTh1UieoYN2u0LbxJ64ls9Gfzq44w4rbFTlWVnNB
WahQSnonKvFktZlY423ZHbH90C6SM9eNOC8h3ogGu0sRsIUYEEcMeUHDdaFGR+sr18g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PSN3GhrZ;
arc=none smtp.remote-ip=74.125.229.5
X-Received: from mail-dy2-f5.google.com (mail-dy2-f5.google.com [74.125.229.5])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89482606A338
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 17:46:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 89482606A338
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy2-f5.google.com with SMTP id 5a478bee46e88-36f936424f2so2032462eec.1
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 09:46:12 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796060772; x=1796665572; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=r/2G8Wj8EFaZXrGuG4n9TNRT3MnecL71wtZn4II9PnA=;
b=PSN3GhrZyWW5llTEKvO/2qBTaJLWsqFFGGtMwcY731s8Z+8HlGKNNFQjH5De3Dccyz
Jb9FJIwWDW4gdZKCcrZTYIi7N//CcBC+lqqG57CbwNAUZA8cy7pKLoBS2i2B7AAYwJxW
6pGsIRENVyFtTqHz03NkV0p1cw2TUCbKAP/Uyxg5n+DwRQnpzgdwiGFih7wtADYOskph
5uhR9viUrNpaA0FlD1E4ehmCc388J06b8byHWj1ut3VfY/vANM5Mk2kbnfPxbY4AcWlI
h5lr/gNvbfoEyTHld06/2B05TlgoBSsT7lHVNCLgasYv+JR5d6nTkmruaWAtc/t6lzSt
Vvsg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796060772; x=1796665572;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=r/2G8Wj8EFaZXrGuG4n9TNRT3MnecL71wtZn4II9PnA=;
b=Y7FguGdJSN1wMS91Um0kDM9idZuYM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R
yPyKmawgfnrFg/BJNSWV87ov5Sfm5LcMLF0pGQ==
X-Received: by 2002:a05:7022:b0c8:b0:185:8c9f:de82 with SMTP id a92af1059eb24-1b5568fa1b1mr29999405c88.33.1796060771488;
Mon, 30 Nov 2026 09:46:11 -0800 (PST)
X-Received: from localhost ([2a03:2880:9ff:71::])
by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5568592adsm76900505c88.15.2026.11.30.09.46.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 30 Nov 2026 09:46:11 -0800 (PST)
X-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
X-Mailer: git-send-email 2.53.1
X-In-Reply-To: <20261130174609.314114-1-sdf.kernel@gmail.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list