From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060775; b=AG6ns574vhOlGBpO0Pp2KBaZ1jV8B8CzGhG2UpjKvLlr6LYTJF9IzjJrF3uc2Vb7g1vm IJsYYJokxcWhH/ER3lc2Iv5kaEtB7cod9jAeYcI5otY+SqOSSEPgDyKjI6QpYOPE9dIEj i3GsqlKh0DluRsyLCT55x8Kr0LQfcSR+9Rz/y4cNLa2HXf4/Y1lnYyBWyWzt1F+B05SKA PryYG9ap79T8Md+HEeN4dXo4HWJ3PFOXwY+nJzWecdfMkobuptXpIaEQ5fWjlNNLsQtGR LSSb/Qc+3nl/G2w5dTb2R5pL875hg/V2rFeA7dUqmfFIZbRwIZOPJ/qqvKeJbn6Xdfw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796060775; 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=pduhcXWmWHzEWYcqxEdt8RTMH1vbvuCAuv5uxsLpe/c=; b=Hcj4br1qghMx3uWl/ru9KtO+ziN2xBGyDbnt00CdE+4URlaw2DIJJ3eQAycO0rsnqtT6 eUsUfYFdBCkZc8XW44He4O8m4MS+wfr6hdJ82ra7w49QnGIHwuArTTi0NBl3hzidUFsjB m1mbS7qSys8ip+sFOya6nqgiFBMTB+drmiIZ9H5BKhzObJXYkoSsAofiRpTlPa4GwmgfJ wADud7rx6l2fD77EnMYPk0a1dcUSnuc03KxaHyCsSqkIkX9nZoLVU5VhuwFFLmObDEKbm 3THTrvotBrbTNONSKfU10gJ2EFQay2I4l5i83kvv5MdzXCZSaB1gxzm9h/2zpHUa6Vw== 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.131 Received: from mail-dl2-f3.google.com (mail-dl2-f3.google.com [74.125.229.131]) (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 9E874606A695 for ; Mon, 30 Nov 2026 17:46:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9E874606A695 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-dl2-f3.google.com with SMTP id a92af1059eb24-1afb6473195so545975c88.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=K1gymnjbvGT0o47lPtBuW9zSMZ8R4eeraSwiIoGVb+6kfVhHRbQDvmW61b/JzHh3AR TNqkNi+MqMaYCrrKYGSBQv65Yx9EMHnXIMcXQasOXDYRcDviw0oNTToFUfvzmvncM+6l lgwCxQP2iAVM+pWMzalZbMk+iRODM74oDF3HkoGKaivp9KQtl8HU7vC8a6V0ucCv0x0E iiecsJ/ycI7Fwcv/qgvMVGjRWEz7WkqFi7QQP7S+LjitN/OeJKSlbP1IGOMxdjNQBtKW X6fPwSNyPvrzQ6pE04jBoLVVah+Yg/aTG3eZLVDy1R10K5F7p0Y5GH0lMZFNMymITA37 yGnQ== X-Gm-Message-State: APuU4Z/nUzGOBnYVriBZ6eRwooz+kvA7qoXdgJBx4jCTcHAw20pjaasS Oq64Ky0O49Uc4HyBTPKSSMBXR1HITC9W2/iRwdBcNGRtIAPrHWq3s+s/HRb87MD7x7k= X-Gm-Gg: AZFdTZfedX0goBUmULZHL383Yj/jgtZ162H42GcrtM9+L0ZRaw55kx60p2dO1prV8+L cf1jEpe6fmz/otK8kNbJHIlMN542pIBF+1D2IZdxU2AFAjUqjBoDitEBEH2PK4bf0pdrps5+DTK RoIIGkZC1v2XlCvnY5zEooJMVaSW5V95DaJN8uBuVcUA8lbNNR8Pn/l2bWk2rMYjJuJ21aYvcBy C12PNZfqppfYzVZ9dn+JKuMCbQoMxOyEA4mhbUVpxrPevLDYHgY3JYrw1emViyqRrrKQjmDSKOs sUpQ37Eazg/g14boiGEFjx57GvPFdYGMSbuNhoMeGdxMQuPEi/M0Qs6UXtUrpLG90DCIl51HoGd kMLah6eG7QrleoNy3akPimI5Nbdh9bkpaU0nz/sLCPULlBpD5XyXp1yx7YwF2FjxKFligL9IDsq AtcSKtEDhCHbRlFNZCRAYc5Ak9rIoztSXzW144RPeyj1ehz9TUUCjGpusgDWAn6yG5G3BMMKDR4 cWa+b1Gqydzux7OyRe/sANr2lnEs2K/uF9AnhWZlE3E3zTdAath9Um3MEZQJHiU+kSMREnm2DbW TBpC5MsjkN4Qd54MaA== 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: 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 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