From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.8 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060774; b=xB7w6anXTnBODAU1FFZyDElD62h/wTBBQ786X51dcprRJ+2Rb+KJM9EBpAsIVcFIx026 ZNoaVkWVkkzwjKdVYncTHsmJ4mIvwgRWuVOyDIJsqj+W2T5LWx6dWssUYvZSyBVMAhw1W 4UVy79fk83iOLjmSFRN4vutLNpNe6V0iHEeg2tALWsMazpBTvPr8cOl3brkkgWRz97ngZ knZwsGF7hm+HJSoidkLBhGNGBucntofMwVPd4TgeAMAP7vJsW9MPui+Xi5I3J04ZFJfRo NFtJeXq2kT1QZ5J/pt8zJKOvkC0X7eT7XQg6ABjZAKSvw+K6K9+Fn0snUCBVxZod0+Q== 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-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=pduhcXWmWHzEWYcqxEdt8RTMH1vbvuCAuv5uxsLpe/c=; b=twxFM4wot9rU3XHBUV0dyQTRVkJ58nvEJdV2sqBCv35ofOsGL6Yu4eKtRUF6/tVtuj9w QZqNGNopL2pxRTn/5B979lu6NgqmMi8nQxGx9/OegHWRLxGvZBcaEDsjl3/T+zYEx6Xap nYUUe246dkSO9SIbAqS0PmkBHM1wWpXHhZsfATegyYjSi6qHM/r3pAh6epzjpFQ98LK7W rqD8LBFQyM9nUZLOplbWWd0kJmwLz4cVt/m1HPtHzE4Rv5qmE7/t29MdfXiWYll1m6hV8 TurDGaXxn1etLojMjHp7Y3My/YVm5+YkkaDEV4u0h2nxjZyqiUvSa5n5OPvvt7pxDww== 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=jp6Y0LwU; arc=none smtp.remote-ip=74.125.229.8 Received: from mail-dy2-f8.google.com (mail-dy2-f8.google.com [74.125.229.8]) (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 920FC606A320 for ; Mon, 30 Nov 2026 17:46:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 920FC606A320 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=jp6Y0LwU Received: by mail-dy2-f8.google.com with SMTP id 5a478bee46e88-3831d564bcfso3745947eec.1 for ; Mon, 30 Nov 2026 09:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796060774; x=1796665574; 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=pduhcXWmWHzEWYcqxEdt8RTMH1vbvuCAuv5uxsLpe/c=; b=jp6Y0LwUVtK4v6T/EJEhQd8z5najSzaUtH4483gM9XZLorAb3Hgg0Kl+MYfVpSAKDj Wa/rs3+/a9AzTU5eL4008Ozsyxvr1c1z7x1QZgaZIc6JFfw5K1ZkRlTorSPlDYus7YKz 3Go9WhZjXW6bWbVS3Y/tAegHOw8GzcQtxFIUgzVErGC6uxpEDTW6c5e/EyiUKdFjd0jx UeT4bKa24JbvhUhAhMXwy83XSv+siykfqB1azltJb9cjpuUmPZBvMILUfS9G3gkkM8ue S8S26c7sFmV4d6r87XWCK5aice+Qdg1YuWz3St3QlEx948BlE9lHLSjSYIssVxc8+VMp x7hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796060774; x=1796665574; 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=pduhcXWmWHzEWYcqxEdt8RTMH1vbvuCAuv5uxsLpe/c=; b=gM2qqBwG6KxB3LHqFgQenNPQOqGk0KJqT1rIj8aZv4BJoMO8PHkyRCnZyrcGojZaRl xl6IQ1n4Skv7hrQv/QnHSk7o0I1Vfmfqcg0uwJ2Z2j3AIHbKQzl73alF3WouB3xxJMJn XieYfw+hn+EecWHc8Yx24O5cSTbGS6V9cmegme3EmBDe9Iu9mSKGHdsz20rN5qJ7pgOB 81xLvo6cQNHYmmfIGRAuaiKzVWUIgrjakO2aEUwGAn0dS4psNcG5N4ACUJLI1wgH+Qbx 2dJEfOErRB8H+aIyBOgIP85Ojj2Zt5mznm5EJ7cjcJx6qWD9/vFjPnKhkNiZV/caeq7I O7mg== X-Forwarded-Encrypted: i=1; AL+hErE2mwPPGZmLEqxrG5DZBSQAlF4rytkxxAzNYiaUbbnStJXs8YMpaF2MUGHccNGWA5FKTw3sUzD0MUyN4oM=@vger.kernel.org X-Gm-Message-State: APuU4Z/S+j1wisBWLhBI+zO8C734qPmAeCq+YjSj31Yl5CmBCY1oCci8 4PKDSOVNlE5upW5U6m2anZbAZDNufFWFE++y7JBDiu7hm69ctW8kIZK9 X-Gm-Gg: AZFdTZfW0BcH1BeCP0wQzr9Fx/G0w+/LtPrPqWRGpl+T5539tPQt0yV4ybaoy4XrAjw 9VrPvJ7a4KdDJkPT/5vsgMo+lYmra+IexN46l1cqgYdUcdNOeALY4OmqjH8xWJZc+tmp7qn5u9f 5Y29xxCFGrwNDAhxzU8dJIGxx4gJ8kKB25Q8fPVBoNGe8p946WgqM05apxoNJPwcSPnCZ8SIYQz divvo6qjeaBn9b3Aw3eY6P3mSQWQUsSLWOwz++FVKX60Dz9QyKliWUOOvkrOmgApTAMhH05S/Gh EkkY0jbpl3NLBCZL6OEbBsmLfJqUWdo5kfoyv1CzZmn0IBVeJrbJqMMhmE6zXSdYCRsQnrpSo7f O7p5t4k11i2VX7OWKXb6l9r5KmMwUhpoQ5vtKsGrynj9HqS3Q5rafZuKH8rPVgUQclfoDmaAySA GH2nf+x817SkFgVi8J9z54uuCJovVgW5at3rqa582OkV3bet4TzITGZFglOF68Aoy5bde6uh0dH IQ+Ixttrszypv9TtGDUvOVqPUaEh1+WqxQfziD4oFrml6VFPk2IozjmwaQvFI7R7+3PoTEpIypO cDDMkxEvwRA6ursM4Q== X-Received: by 2002:a05:7022:130d:b0:136:c443:80e5 with SMTP id a92af1059eb24-1b5568a15b7mr29240247c88.6.1796060773651; Mon, 30 Nov 2026 09:46:13 -0800 (PST) Received: from localhost ([2a03:2880:9ff:66::]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5569bffd2sm74152870c88.0.2026.11.30.09.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 09:46:13 -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 3/4] selftests: drv-net: add a kperf stream test Date: Mon, 30 Nov 2026 09:46:08 -0800 Message-ID: <20261130174609.314114-4-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 Add stream.py, which measures the throughput of one TCP connection with kperf, with the same settings as devmem.py otherwise: once over copying sockets, and once with MSG_ZEROCOPY on the sender and TCP_ZEROCOPY_RECEIVE on the receiver. kperf pins the application a few CPUs away from the interrupts of the flow, so that the CPUs of a run do not depend on the scheduler. One connection is bound by the CPU rather than the line rate, so that the throughput follows changes to the cost of the stack and the driver. Signed-off-by: Stanislav Fomichev --- .../selftests/drivers/net/perf/Makefile | 1 + .../selftests/drivers/net/perf/stream.py | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/perf/stream.py diff --git a/tools/testing/selftests/drivers/net/perf/Makefile b/tools/testing/selftests/drivers/net/perf/Makefile index 91feb0d62a7b..b3f9dcac700b 100644 --- a/tools/testing/selftests/drivers/net/perf/Makefile +++ b/tools/testing/selftests/drivers/net/perf/Makefile @@ -4,6 +4,7 @@ TEST_PROGS := \ devmem.py \ iperf.py \ rr.py \ + stream.py \ # end of TEST_PROGS TEST_INCLUDES := \ diff --git a/tools/testing/selftests/drivers/net/perf/stream.py b/tools/testing/selftests/drivers/net/perf/stream.py new file mode 100755 index 000000000000..4ed9d64dfa32 --- /dev/null +++ b/tools/testing/selftests/drivers/net/perf/stream.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0 + +"""Measure TCP stream throughput with kperf.""" + +from lib.py import KperfRunner, KsftNamedVariant, NetDrvEpEnv, ksft_exit +from lib.py import ksft_metric, ksft_run, ksft_variants + + +@ksft_variants([ + KsftNamedVariant("copy", []), + KsftNamedVariant("zerocopy", ["--msg-zerocopy", "--zerocopy-rx"]), +]) +def tcp(cfg, mode_args) -> None: + """Measure the throughput of one TCP connection.""" + stream_args = [ + "--time", "15", + "--num-connections", "1", + "--read-size", str(64 << 20), + "--write-size", str(64 << 20), + "--pin-off", "4", + "--validate", "no", + *mode_args, + ] + + with KperfRunner(cfg) as runner: + result = runner.run(stream_args) + + ksft_metric("throughput", result.target_throughput, goal="higher") + + +def main() -> None: + """Run the stream performance test.""" + with NetDrvEpEnv(__file__, nsim_test=False) as cfg: + ksft_run([tcp], args=(cfg,)) + ksft_exit() + + +if __name__ == "__main__": + main() -- 2.53.1-Meta