From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.5 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== 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== 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 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 ; Mon, 30 Nov 2026 17:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 89482606A338 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-f5.google.com with SMTP id 5a478bee46e88-36f936424f2so2032462eec.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=Y7FguGdJSN1wMS91Um0kDM9idZuYMlmE7cVhA96zdciqj8a37p1oAwm/6mtBdcVAgb pr8QD+QrTFnfVPmAZLI+CoHhHLgbttW0iQGwyzTmcWwoXcAoDe3UQS0u6W3QnVyrw4cP 0n/EmdtcJKwYxf5FXLNKKTJVOcuxlxh6Tk3oc7xExLKJC7Rf3TguEBHzhGIeQkquqPTX MRQLPKC9tdv4vf3AOY3RDYqIDfw8PURIAZoOHx835vwBirNhwZqfXN0hdLa9wNXqVf5s RRrl+ZU9GE6N4vjqLmvTfsJQAOesWdWN089E9pccMwWOuOKgy6Omndn7KtxpyneLMBZx E5BA== X-Gm-Message-State: APuU4Z+afyIXVaenKrxXFLS29uhelTHdg77dKMaoT35CCkFi6NLtcSqZ asU6w06bn0ofRrNdcyC1uPypWPOy49EYc13eypyqGZdYhuLLryM32wmCcPSP6bDD7qY= X-Gm-Gg: AZFdTZc2DDRZ54rQhHAMCJm+mpjNM4Ft2JHwQU/nGYUSJ/Jb2tgOFjd/GTQzvwIbbHq 8fYPPpa/wq46YtPphUD9mj20XBNnhS+OaP95kIPMl3E8pkQ9VHxjJGo1BJI8N/plE2ZU70XQdA9 /8nMBSJrRT1CdWKdazbrcj2P41SG6Mx4HUPX2hzzcApZtOJWWjH11LkZTJsoogpwu2WSHjYK9mQ Ll/pLQ1fWKU30m0HGg8CjBZAb7QiqGTgX9Hi7ks6ahSKIcYlGr9PMtal32+94UPbBssipogLgUp IKnoSJsYXuR+TLj2ZOnS1qPgP5Qn4vqNnkVyVWUx23j6ovmKTrYD+TBYXnTmGrCFtffEUfIu0ih aQzfYkfS8JsVzU03MK35/tE4VA/PeNZ1qNo6ekZPbOq7cMkfK0m+Onx9PuTGk35w05Cu2X/jSUn rvPKaNL5jsDwMIpPEgp/547STsuTVdtyd4MC+ZvmP1Lde8GxN9zzTr7JLrdjuwY7IWUKAh5vF1i 3tt4NgoRfIam7J/HSGmpE8IIgrKxTdizpY+Qmrc0r8gUS5oxGsFPLGcdYRGfVenp8ftVuiOiaCR 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) 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: netdev@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