🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24726

[PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test

#24726
From: Stanislav Fomichev
Date: Mon, 30 Nov 2026 17:46
82 lines
13320 bytes
From: Stanislav Fomichev <sdf@fomichev.me>

Add rr.py, which measures back-to-back transactions of a kilobyte each
way, which fits in a 1500 byte MTU, over one connection with kperf, and
reports their rate and the latency percentiles and maximum which kperf
reports.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
 .../selftests/drivers/net/perf/Makefile       |  1 +
 .../testing/selftests/drivers/net/perf/rr.py  | 47 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100755 tools/testing/selftests/drivers/net/perf/rr.py

diff --git a/tools/testing/selftests/drivers/net/perf/Makefile b/tools/testing/selftests/drivers/net/perf/Makefile
index 1a90537d2726..91feb0d62a7b 100644
--- a/tools/testing/selftests/drivers/net/perf/Makefile
+++ b/tools/testing/selftests/drivers/net/perf/Makefile
@@ -3,6 +3,7 @@
 TEST_PROGS := \
 	devmem.py \
 	iperf.py \
+	rr.py \
 # end of TEST_PROGS
 
 TEST_INCLUDES := \
diff --git a/tools/testing/selftests/drivers/net/perf/rr.py b/tools/testing/selftests/drivers/net/perf/rr.py
new file mode 100755
index 000000000000..1dff0c476390
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/perf/rr.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0
+
+"""Measure TCP request-response performance with kperf."""
+
+from lib.py import KperfRunner, NetDrvEpEnv, ksft_exit, ksft_metric, ksft_run
+
+
+# One connection, a kilobyte each way, which fits in a 1500 byte MTU, and
+# latency percentiles
+RR_ARGS = [
+    "--time", "10",
+    "--warmup", "100",
+    "--num-connections", "1",
+    "--req-size", "1024",
+    "--resp-size", "1024",
+    "--time-stats", "2",
+    "--validate", "no",
+]
+
+
+def _report(result) -> None:
+    ksft_metric("rate", result.rate, goal="higher")
+    ksft_metric("latency_p25", result.p25, goal="lower")
+    ksft_metric("latency_p50", result.p50, goal="lower")
+    ksft_metric("latency_p90", result.p90, goal="lower")
+    ksft_metric("latency_p99", result.p99, goal="lower")
+    ksft_metric("latency_p999", result.p999, goal="lower")
+    ksft_metric("latency_p9999", result.p9999, goal="lower")
+    ksft_metric("latency_max", result.lat_max, goal="lower")
+
+
+def closed_loop(cfg) -> None:
+    """Measure back-to-back transactions."""
+    with KperfRunner(cfg) as runner:
+        _report(runner.run(RR_ARGS))
+
+
+def main() -> None:
+    """Run the request-response performance tests."""
+    with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
+        ksft_run([closed_loop], args=(cfg,))
+    ksft_exit()
+
+
+if __name__ == "__main__":
+    main()
-- 
2.53.1-Meta
Technical Details
Message-ID: <20261130174609.314114-3-sdf.kernel@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374359-linux-kernel-netdev=dewy.ru
References: <20261130174609.314114-1-sdf.kernel@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374359-linux-kernel-netdev=dewy.ru
From: sdf.kernel@gmail.com (Stanislav Fomichev)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 2/4] selftests: drv-net: add a closed-loop request-response test
Date: Mon, 30 Nov 2026 09:46:07 -0800
Organization: Usenet Network
Message-ID: <20261130174609.314114-3-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="1489864"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:MElZht/8JW496O4hL2Sh1/vFxCg= sha256:auxkqUvp9DTeN+RNIKKQNTbLlxrX3RQVHDt5aA4uJ0Q=
	sha1:92NxcANCyczx+Fso3kCCwtc0NBg= sha256:OZ7IILVd7kPqCuw1mX4HKjmJxReSJ626Qa5aUKunG1Q=
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 9B4A0125FFD; Mon, 30 Nov 2026 20:46:31 +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 SpI9khN3ZJTE;
	Mon, 30 Nov 2026 20:46:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374359-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 51431125FFC; Mon, 30 Nov 2026 20:46:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id CCEC9601917; Mon, 30 Nov 2026 17:46:17 +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=1796060775;
	b=u70FYxHoWdd5a1WY/TpEUne2Pm+FBtVsfIrBGRkdjCXIM/hZYdNe+JmSNxfv2/Kl5+ZE
	 Rpb8Zo2KXydM5s9kBnolHBPMSjhu1MOxjUDqKRe6ZeqdaaZMfJi1iNdE7ZU/R3h5bGC4s
	 N5ndBVyH+UfVEA1qOaOQonfHAEMaU+/cCV8Nlqg1SWG773jAOXo+cVJCtaYNSbEWpeO9p
	 9IkkcdPBT0k5kAvWF0muf/vQ2ADLGSM9QxN9dG9WcSsZf8oEUdO+K+izIbGfCzDx4W4Nt
	 3se1dNm8zHJZn2VNZNm02iu31gxUq7+9DU9u2AIKTWXRwv55d6tfFxYAaotKF/pgeLw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796060775;
	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=LMl4Efjgkk5U0v3sBekesqZFR7BWP4VgMXemCls3tD4=;
	b=KjDIy9gLYAeroIVpnCmtOQQRIl92ZSJJrfX0pvY3JT6JGIKVlcB0bpozniwbAKYQqSve
	 eKQ+yr6PGlhlEr4qRO5CrshK2DXgJeezJwT20AFxSg2BnN2xqJLSBU7yzehDqQdNLVk7E
	 g/wL+mCc0b/LfxY6nD9wAKJlmVs8Ix6vLJPawN4zWyyBR+viFRXj2/rajn5ztJ/GB7D8Y
	 O5vj5JWWo+p91y7dl7V47KzFT7UnzoVH115bxw9yYZbRcISvaL9dSAp/ZpJboa18qpBNC
	 71Kg+KTi9ekz93VbIvu+vlVazPyEQvt5A767RastjlMbx12u9YURQeVNn/NzHhAhWqg==
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=Nlk2ktlP;
	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 34C69606A689;
	Mon, 30 Nov 2026 17:46:15 +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=Nlk2ktlP
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.6
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796060774;
	b=FhOnWMqHp2px5CeMFst1l1hPa4SU1btmc++EF0z0GFLk89SYRm5VjTXophwqGxlv4x5+
	 oKLLHdaFjp7doba2wrvx+HmZISLuUH+YGjePXTwdeRHq1t/dMGRFhVjFYlTvbMobgRxe/
	 DD1HsCI41WmttbNbLjYmE0VPRShnc9VCnC4fU/+JfU9ySAeHWc7LGyretCsYuB0FCgu77
	 sw2OwTfGlyMhEUMl6Amqpl9nAsweMea65HDswXY/zTVe0HM9OreurjlV6FBDdhycUhzwB
	 lHzKkifpMGSQ9k7gEyouj3bSDasW/X02alcLtTfRvbddPK59xZRGAJo2sSO/RJVmKiw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796060774;
	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=LMl4Efjgkk5U0v3sBekesqZFR7BWP4VgMXemCls3tD4=;
	b=5TV0mSHC0UaOQfVL8Z8lPoYdhnO1ekOm7rNBdlAWPB3rzBdv8NwBIxFU72AUnFGLbx8w
	 OZi782BggRfuBfGf7CTIQrqDnnKZkTMiVPL9OxQRgG4GpDAYB2brq/CZydgDULrinvrxg
	 tbaGpq4suhCUtYl7hA8L8dtqgUz3UuQSx+ikeu7K5jbgzRSHH4ufuX18YLLTcxzEnlBr/
	 VpNvA9ZdyJJ2O5gfaOFYHidVXkEx6iZlNrAJHjvf8vVB+mbcx9D8LXMHLOQzfA5ffeqQA
	 JUQdHupptduurOygmsDxqty2rK78n6d5ly+Oap2USYp+Xpp5UUpHkhZkYCxMTMFZSvA==
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=Nlk2ktlP;
	arc=none smtp.remote-ip=74.125.229.6
X-Received: from mail-dy2-f6.google.com (mail-dy2-f6.google.com [74.125.229.6])
	(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 89A00606A333
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 17:46:13 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 89A00606A333
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-f6.google.com with SMTP id 5a478bee46e88-35adc681e1aso9079366eec.0
        for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 09:46:13 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796060773; x=1796665573; 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=LMl4Efjgkk5U0v3sBekesqZFR7BWP4VgMXemCls3tD4=;
        b=Nlk2ktlPS4PaghTKFohi0pgckGNXszKQ/RyZAHjTOEFvkWH5aZWXRiGVUTH7sxw/RU
         FLjDpEWuojMPR0lIV0PLpNI1UCJyW5p+yOKsANvl6c1qEjyOYBwtFeRj+eFDtkGvSJvY
         ecm5bFc4WI2T10pgBYu/VudIsSGxH71OoSELoGoTBll5EBikis+AHDEQdnCNaYmfcZAZ
         Lfk/fz+pt5wKspW318fiN6ozthhrJLvl0+B7fsZ7yh2i15Lu9z4KDkGL1a0zJVSHST3h
         AFtvyPmkCexda6SYKhxQ6y/xA7BHRcE3Zu0E/hglTuAdX0PS3sfL1lGiCH2RbF3wuN3+
         y5dQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796060773; x=1796665573;
        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=LMl4Efjgkk5U0v3sBekesqZFR7BWP4VgMXemCls3tD4=;
        b=BWphBICp4r65sx0F7ko6Kcm1B/NB6z6pSBGEeqony7QrD4w/B4wrY7f62H/e1gBe4v
         /H0ZbjQXal13J7qdAwhwIgTitGCdjeiRc/APFvS3sQbXrBgLA7JqW0od7w14HswKGSqO
         NpC4U/mS5FxUhYh/Lja3JrpooEmxfiQVO2tDUnyIKEQcR4o9GfuAcSO6OaKmL/XcD6Od
         xmSRWw4NJBi8mkrI0NgR/hpquQuSjrk08v/nSI8lHd2EqTsVMVcNdlFYhZcZKv/6kvgM
         PMJSQyZXDpZaLfVsBi065UHyU2Y2doN9nBTPw1fyNN2hZTO/yFesrmp81eNRQSBLT7jF
         LaHQ==
X-Gm-Message-State: APuU4Z8QaL7EM1MIeDUcv3uG+KzUEmOdJxX6Krvk5+hhIucEMIaZsHTt
	Awtt4nCJIicStc/tZf+GsIg07rMYfbcRQhAzt6GwU+h3UHNDFXOAXwpHP6W2/oMc0Js=
X-Gm-Gg: AZFdTZdbDy+BcwOUavfnEZA5GPJVlc84oz7ndwC1CZRcf1ZN2Koko1UHe0tcjZXCucw
	0mNY5WvbTfIljHm1H853QCmvQGoxmlwtco+FvviI4b7mwepO3ZF/KMDZcGQm30r77oRTHES1RB3
	ZbTC3wpdy+YZiQOVUxVJz5RO57UAKNi9UGPsifzf1qkvWX6F8sCLri+HgSx++pCDAIlFKcw4YcR
	aMiSZ7O9oZOM/lZOjp5fVSoleJGcsQtuaKMaIX+siZjZ2UsAfPx4z3laYgY1HQSBcWdHnGB7pUe
	9oK2h9MN+Ba7cUCshX3SkxFGj78cJ9xMU6c0BcoRL+FaGQCD5Ofg4bNsj8dk/hxfw0MhhOJlGU5
	tZv2r53v6NNKZBigtwaV8L/5P02UfdSwjBhI+Xc3LrRXAgGc5BeBnbzwwiGiB0LRxvEepFlUM1i
	VSoMk7L8VF4TrK4QrCsuN1qeC5Y9hAAQ+jQfM8I07yMSuFu0uP941/uCqhTgwy5lbzwi+QQxZAD
	bVl8W1YvlyrGguw2t5Pg9uy992omBGcIhinocEAvojAwHXtHBENRsjlnIL09LL9MBfPeU2hp3v7
	+dUs/sSc18r+nnc2
X-Received: by 2002:a05:7022:1711:b0:1b3:aee5:20c5 with SMTP id a92af1059eb24-1b5568ac791mr29543426c88.22.1796060772539;
        Mon, 30 Nov 2026 09:46:12 -0800 (PST)
X-Received: from localhost ([2a03:2880:9ff:6d::])
        by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b56ef9fd16sm74669460c88.4.2026.11.30.09.46.12
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 30 Nov 2026 09:46:12 -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