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=1796060774; b=ExOaNJh4YsQJdRKPSkf5Q9v4FYUGKKeK4flIo4TUOG45qtmR/muYiBsQm2lDUi/+HdmZ LsjHQLpQIoqS/SNYrw4PsQ1OkYxMY85+t+YSO1+ScJ5RD0IYvg2v3rIvMcoafqNpF0Pi1 1jaxzbhrC5ldoK3wuJtFyhMxfGkKzBPdRPggU5WKB4ki8WMq+xODnbFlUzVOl7BlqaVbC J6XUBIG1lJ5JV9gPaC+fLkOHgDNpyu3UKaKCGHQA3SGMN+cJIr+jp8hUkIErL7LIrSgjM Pq2TpHX63uOQJkE5pAMozPnfNh43EhnyHEm8APO3teUFTyAl80wqnR/oHTEU3ucufQw== 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=CRYuQCIPTflqvakcoQWOQGzvDRwGQdW4pEtnVmcROArZLPapJZ6L9zsuIayA4a98Z9zE LP7hUWrmqUyC5pat9B84Cl6jCOjNgAaZz84FxDOUb1v3aeaiA6jzpJ3dTwnQoES4CDNB3 fkXBIKR5M5+nrafLZoA6DWZ4rKlLtoQ+i48H7tyjxD6wRE2MkWyN68TZJDkLDZo2dpX6t miIzaiwTBdkvp2udGhnMGq0eFUy05zduQMvV2CuJHt4snHTUQfLNwvuKlXuNLQ61LYKWU K0UTW5qI8rntt1602R3tBbTRh23IYPqKWIGtgO+uJT2F7ETUlpMbqShMHs+o+oBdApQ== 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.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 842D1606A690 for ; Mon, 30 Nov 2026 17:46:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 842D1606A690 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-f7.google.com with SMTP id 5a478bee46e88-3869c1f4d19so2817648eec.0 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=sWGykHTX26WIRbp76We2KuGcsb1fPFwbvLnmtO7jYtMMTDkQaQKPYumDFeyoPMLJ+g XLLUrQcB/zTat0+Qt+qTNWAwHYtooHKvwKEafKrgL9kwGWL6E1h90W/4NZ3Krt8tFMih oiLKPTk4Vpp4+7uzwYDNlvvZkuyKm6Gh45D7vVCaayPqdBoYH+fMIb6pH49sYvbSxbJK pRwLm2fuUmEfGMC00OSl67IgweOOzPFBgWiYj1aSjdH0hFOEbW9ocxRxs3fJtxAzfPSr ixMIBR+lm6siQrQD5nzbQLMNIMfH8JDeQNiRyS5uIKvDkcRioFsvBmWyxVxhPRUy5ZJ3 s1jg== X-Forwarded-Encrypted: i=1; AL+hErEIeCs3JkK+wmnIfmTdgUing/s5T56oGaa1ZQdvOvDYJItuLeRt+ECT+dBzpTAbn4X5xNXdNx8/vcVBgysiBpQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+zeQXcTb4RGj7uigcvVc7vOxJ0KzO64C7xHOY5PHxpdVfW7fEb JEAFTIGKvcwJh4UMPOotfSl628r5FvGayfZ6G/wJvl8nwTf5vURAlMdI X-Gm-Gg: AZFdTZez94E9JJ3tGFbRpWsxzVLaBiS9PZWncdydxS3f1DzW+ounjN7cQN2AUbBk34G Xc3qBdjgBH/zm4fAjvWsIU3N8nSV6a2B/6/7pUhrV71u3pEXPaEVc/lRLxRroT5flxUMj3YqFNH CynQuwWpN9zmy8hLZ+aBTyC1NP8n3kEzLl2+LtzWJG4R5mFM0ng5h50WhJrFeg0gIBItQ0b0aJR dphzd3BRKD3sAdBoYJS9NdRoMTt6XEVjSDEmn7ZfWmPseP1XHm/8Sbl9zLrmChnPcLWZOk4lbCJ hua/y4LOPisEDwqETtIdswlQQ0Z2dc2Tknvoe6OtGw/lOShp6o3gdKHZSls+8se7CQ6c6oiLV1x tsOxxvoD1p7ifAXseYek27uQ9/JVE7Q+YYToP8OWMtgECpHsXLpct2yvcHo7VQOGvxTR8mXC7Is diSx7n7f3uD8XJtvWklt2Ltb9xcNdixqJ5VtZ7LtiYwjBcK/du8eQVbWptNw8B1osPJm9iV4xBh /lBqIOwFoL8lZwv5QHm/KxgV/qERLlQJE8T0AU+2cyDV0UloA+24YSSc1YZlWiPhIPmR/X3a3jU Ass1oXN05frFCDtPuw== 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-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 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