From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.135 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060773; b=yw2LCIqIocwPCOooumwFu1BmEc3a3sH2SdrH2msDd+Ow03+B6nYtgzruBiV1KawfYuFq UCEuxmm/33OKVwBBE6aHgWl3P8NleJp7QTIGD8r4hoU3tzA5Pyb/P9WI74g0+Fl5znR6+ HYgtDMH0hAfpecb6Mwq+xO8zqqwb/BUZKxn2bhN7nU7f8NobjZIi4uWVCyK2sO/FKQiF+ QYyoyyWz6WSUoRRtL8HM4RTv56GLK+4EGRB0wV8nWJ45IMY4m8vKhhpzoUqZHbo+hnETl LdaSGKx/wSosB+Vwuf4eKYKurtgI6seVuydHIUXmxbFtFr5QzIbkkuG0fApkGlbinEw== 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-Forwarded-Encrypted: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=AYQziuZfQkmE1KKoFx5yy0I/oS3ptd8kFfsG5Rz2UlZ+MH8sCt38RoU008vTRRsAQ2zL 1QxSBnP/c95ZMEsXD+bU/3hsHp8FoRBCINQ9eD7OCa3EKFl5bnqD/pwZJbwk4QTE1rDvk HUr8Jhly0tSt9B+9uXGqniqxbaOiFADihfi3xnW+t3jFPNEi0psHZdbdJrPpqcVS1BmpG /SrXxha8d6dgtwHVcSnjoWxNn4YOM1wruxnYX0E4DUaxR0P7z3KsakB4CGxfR9bB7L+Ie XgZjy1hp7jIoiyYYbgFlu7SgjQ7jHd3RhmKjk7Y6PIm4H3oIYM9E+g2KnUq5m2utHNw== 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.135 Received: from mail-dl2-f7.google.com (mail-dl2-f7.google.com [74.125.229.135]) (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 A2027606A33C for ; Mon, 30 Nov 2026 17:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A2027606A33C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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 Received: by mail-dl2-f7.google.com with SMTP id a92af1059eb24-139b659a45eso1189104c88.1 for ; Mon, 30 Nov 2026 09:46:12 -0800 (PST) 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=dK6DLCq7xOLTkzjet2nkS7dIg0cgzSGwbNxegQzUY6oa2g9WC8/0woAP1gVpzlaP17 +JDPxM9ffvJSTIoNkBe4X2ZM7Ufb5lxyb6Vm9RhAQ9gYC7secybvPu+BGRwKEfkmDu4V C59BvlDUpgpBfaIolRI4St5tREo414qWFGPu4jGnekrhzOLh41jq89Oe7S1WLsuMXeao Q+SbcsC7GZaNQP8VvYTfakevZf0wrxvc7G8MGZJUO2w6ovXVsqdOB6rJM0v3ne9v6oTq 923PuhASO7p3kKqXaa1JrzGBoJWpSaMs3WZEFgerqu7Bl/C1QIhN0Esj1eOPG6XvFKUy rV6A== X-Forwarded-Encrypted: i=1; AL+hErEFBBTCGfwOvEy5CJpRoP6LQYho6DEnkgX3A/79QS+W3dSA2E43GNBy7MrYiI1VoU+lWVWW6i7ouf/OntZ1bMU=@vger.kernel.org X-Gm-Message-State: APuU4Z9/mr6jDeHhn1/OU9HZCF6Hh00nU86tf0YzQDL3cf6qUoYg170e qMvIJ6SOdI+TPkpvr785kEfq0Uh3SD8mFI1NKDQgNqSexkikcMYl1ZJt X-Gm-Gg: AZFdTZcrKJKVwwuZmWt7bwEnldBUzYUbf35h2lx0GpqQOvslt+PI/vZ6djmv4bMZhDo lARWg1DKeSqHKf2WphwlRXyX52BYIQ7rBTwwy49o7NZyvD9CF6OSTlZV8VLrjwmVx/iPrhUIrEi dLtwFPVtH2o6y8XRYBtEr7BRG6K0TiT5TG3NVRI6Cl41jrCAsJ2YQlo4JdkESBdw7xGPl0WejBq 2iXdcSjj7+vmzoSIjQsC0hDaSBKFExItxFoEmOXksOW6D0Tr5xDyNkbjhi0v/Z7J+Z/3qFsfXbf JUtd0OFLmSDk252uRZydOGffaRoKfvyy7ztN8WzYcGeAys5+L6Fo+oN3DeW6HTEvn9toh5eI2SJ f7z9cp2+TS6L6zD61d1LjJYvrySNekmabvv3PfH8FM6vof8Ew6UbjxUnSd+cxVJOE4EUknP8Uey 6aupQkgCFRysyBMJYHHbsj5a2f5Xa181HstN6bF3ogj2dyUKGzboi/mAZpZ8Ijr1WUclf6mx67o M6OOMKu1nJimDW+yOWSaYgSXJkzFtQQx4LLjNJqUu3LRd4gWO+9wTVKpb2dvT0c2IwUnHUv2WLC SGYkw5Uk3qsJDYonqHn8bc8x7HXGI5NXTIX0Cg== 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) 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) From: Stanislav Fomichev 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 1/4] selftests: drv-net: kperf: support request-response tests Date: Mon, 30 Nov 2026 09:46:06 -0800 Message-ID: <20261130174609.314114-2-sdf.kernel@gmail.com> X-Mailer: git-send-email 2.53.1 In-Reply-To: <20261130174609.314114-1-sdf.kernel@gmail.com> References: <20261130174609.314114-1-sdf.kernel@gmail.com> X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Stanislav Fomichev 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 --- 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