From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.7 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060772; b=NfyBwO3kBnnhLQdrMvKcX0s9f2K8UAhoT28jQaFgbiAyitNf3TMoUqd6gPWY+ScqqXq8 pj58KR7cxi+W+lrHJAhT4cB/mgLVHvIrygs0sDHzPfZKX05zuTOTwVxaySJf0t5E9WMSw wQySKv/Kj6f4hBcVau0gCsYJ50H8Oef4LL5KtZLVxC8KyaBQhVCR3aKEUJOH05LUxk0ix Y1EFDzN/BwtiZRhABUdr62JQv2Lxdtltlrq5Q3jLR4qHOLBlBP0uze0hW+ZedlqXeH0oh 5k2e1e1qPHk0lKH5DiJBMphyx8nAxfCk3fSOcHG0qg+HhC5Nk+UjJcG2qa2dHpJYmfg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796060772; 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=ygIEBoKUZeeLyVvIoIofxpkxrofbl9/JSOe1UJFkddCuwhVFJAMrn7zMiQ8R1BONuNMo 0H7KWH/6Cz4NBJSpOKIzOK/+fmBVvMHnHx0IhURE22OjoESgYeA9W5fYRICleAZnxhCgo yK/vtAhCUNyA5nQJhZZQBJJTDDxuY9zalXhJ6yTh1Z55DZ3ThcNVxpxDkQCZ0JuTe2s0L N1iQi5KQv4H+XoXQUcke0CAJCuBkJKj9PRQ+Bo8GuJ0mIuUyT0cQnHvKXHD6YuNzR2RJG 5AQMu8BjKwC7VfGWVe6jh/lViFaaL45cJNitTj2jI3K5Q4kCwftX6nRi1wi+5C2jj6A== 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.7 Received: from mail-dy2-f7.google.com (mail-dy2-f7.google.com [74.125.229.7]) (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 9184B606A33A for ; Mon, 30 Nov 2026 17:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9184B606A33A 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-dy2-f7.google.com with SMTP id 5a478bee46e88-33e5ae86ff2so2441540eec.0 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=fhT4l6fh+Xm9MQS8+4rn7aGaIAVFaL23hdWR2rgt2Dt4CCK7lyZslhJdX0M29PhJn9 hhbx5r4Kyeu8Ifv7qjlJQJTTmaO5048rjkxCpyW0LoTde/LjAuE0N3EmF9hnEaX73VN4 /wjyc8kx5IkSdpIdKlLyQs2bBV7G7KSobid7wFnihv5FDsPrRjlYA3Vma8rDZvqtmfsS 8TQRMBFJuIlmhKX9vVgHcq8+aSiDd6CKy3nrfZpTbSlDvQrgqMwhAHPeAT1bbmmvXgmW hBmh5/5yOTiI7Ok3yYHel63LEvN9wJt7/SQtcIvwtmgEStz7zfOsTMcjD8BK3Wd6ywBb i7PA== X-Forwarded-Encrypted: i=1; AL+hErFhqYY1JuoBZ11wtbhBQBpZH9lh+oHHf2zZXdqG38Lt6EZM8ljroeHgA2+lH9hiTu+o29E99kQztSkZJNQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+dl4L9Gqz+4H9q4uLGhh4STtA0sQXctBsMDC4msP2PitJeDuKN bF3kWtQQHMU7xsZ7JDrtXM8Sg8H0vMYDYsy2GFSgp6Qn8XNbaIElgtlC X-Gm-Gg: AZFdTZcN5xZ2kEZ7gklPDMnvVet0OdKvk1o6CVomvDFR17LbxrybnzeiWaty86dl24s EaOXYqX7ST+8sF48QjMJEk2xq+P18o09DIIZc0958LHc0u8oxUrj3PIHoF5Xig+JCHubmo4euD2 +gEwU9hIpzqGpU2hLbkkU8VGuAUI0GyuXUDU9MOorrZUBnCexXQEAhLC4TmFXcU1eFBHSNmO6O0 LW5GCTDxZfcahAjC38kXopeTUTAnok/tykQZNOmCQM81oYQhyrHunwB3ubbOOG7QpVoMCN1DiCI JeD/dRirOfBD79WxmYB6GqA2yWwykK9Z3wqaIav1KlhCFJofCtG5YBjwGvnpFZftedQkmpyx4HR 0XHhOxBb6GxcWyfUdzrpWjzUnDcBVhQRY3XODXdF7+Sg/UPnqKSNTfE20yT1RSMsu1G22WOsp6B 0AWTnyP+TUDQ/NeQ3nnNcJhexvmNwn0MycxUuG65zl3bi4u3yh/nqZVniZLNYp3ZzhouezMVm3Y R1c+e/EhDz5KKl9n3HyvNOalkDQ6gBr5+0/LnYsmXdQA39/rpbQWfzl6amL5/Sk5+Z/Ww3omhT/ gjXhiY7lx41CCHFcOhvvrHyirSBD2bKU+peTGg== 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-kernel@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