Article View: linux.kernel.netdev
Article #9953Re: [PATCH net v4 2/2] selftests: net: add TLS 1.2 hardware offload tests
From: netdev-bot+sashiko
Date: Mon, 02 Nov 2026 18:02
Date: Mon, 02 Nov 2026 18:02
179 lines
14749 bytes
14749 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The tls12_aes256 variant of test_tls_offload
(tls_hw_offload.py:280) requires HW offload in every DUT direction…
- [Low] Two comments say both helpers' stdout pipes are only drained
after the helper exits: run_tls_test() in tls_hw_offload.py ("Both…
- [Low] When 'Rx' is in tls_hw_directions, check_hw_crypto() asserts that
rx_tls_decrypted_packets grew by at least 1, but nothing makes the…
--
selftests: net: add TLS 1.2 hardware offload tests
This adds a two-node kTLS hardware offload selftest. A C helper installs
fixed AES-GCM keys on both ends; the DUT runs the client and the peer
echoes the data back. The test checks the TLS MIB counters and the NIC's
ethtool -S TLS counters to confirm HW offload was used in each enabled
DUT direction, and it adds handshake and alert record-type regression
cases.
> diff --git a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> new file mode 100755
> index 0000000000000..78fa764a6ef3f
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> @@ -0,0 +1,321 @@
[ ... ]
> +def check_hw_crypto(cfg, nic_before, nic_after, hw_directions):
> + """Check DUT NIC offload-path packet counts and initial key installs."""
> + for direction in hw_directions:
> + names = HW_NIC_COUNTERS[direction]
> +
> + key = names['crypto']
> + if key in nic_after:
> + got = stat_diff(nic_before, nic_after, key)
> + ksft_ge(got, 1,
> + comment=f"DUT {direction}: NIC reported no TLS "
> + f"offload packets ({key}={got})")
[Severity: Low]
When Rx is in hw_directions, can rx_tls_decrypted_packets stay at 0 after
a short run, even with working hardware?
Nothing waits for the device RX context to become active before the
peer's echoes arrive. On mlx5, mlx5e_ktls_add_rx() bumps rx_tls_ctx
synchronously and returns after post_rx_param_wqes(). The steering rule
that sends the flow to the TLS TIR is installed later, from a workqueue:
mlx5e_ktls_handle_ctx_completion()
queue_work(rule->priv->tls->rx_wq, &rule->work)
accel_rule_handle_work()
mlx5e_accel_fs_add_sk()
Until that rule is in place, records are decrypted in SW. TlsRxDevice
still grows, but mlx5e_ktls_handle_rx_skb() only bumps the counter on
the HW-decrypted path:
case CQE_TLS_OFFLOAD_DECRYPTED:
skb->decrypted = 1;
stats->tls_decrypted_packets++;
If the rule lands mid-stream, a resync is also needed before HW
decryption starts.
client_connect_tls() starts sending as soon as TLS_RX is installed, and
cfg.wait_hw_stats_settle() only runs after the traffic has finished.
Could the small_buf variant (100 round trips of 512 bytes) finish
entirely inside that window and report a false failure?
This depends on firmware command and workqueue latency, and the commit
message reports passing runs on ConnectX-6 Dx, so it may only show up as
an occasional flake.
[ ... ]
> + # Both helpers run with their stdout captured in a pipe that is only
> + # drained once they exit, so the helper keeps its per-connection output
> + # small (see the note on verbose in tls_hw_offload.c); do not pass -V.
[Severity: Low]
Is this comment accurate for the local client?
Only the remote server is started with bkg(), so its ssh pipe is not
read until bkg.__exit__() calls process().
The client runs in the foreground via cmd(client_cmd). In the non-background
case cmd.__init__() calls self.process() right away. _process_terminate()
then uses self.proc.communicate(timeout=timeout), which drains stdout and
stderr while it waits for the child to exit.
The comment on verbose in tls_hw_offload.c makes the same claim:
/* Per-iteration progress output (-V). Off by default: the
* harness captures stdout in a pipe that is not drained until the helper
* exits, ...
The -V restriction still makes sense for the server. Should both comments
say that only the background server's pipe goes undrained?
> + #
> + # Both helpers exit on their own within HELPER_TIMEOUT_S (see
> + # tls_hw_offload.c), so nothing outlives the variant even on failure.
> + with bkg(server_cmd, host=cfg.remote, exit_wait=True):
> + wait_port_listen(port, host=cfg.remote)
> + cmd(client_cmd)
[ ... ]
> +@ksft_variants([
> + KsftNamedVariant("tls12_aes128", "128", "1.2", "4"),
> + KsftNamedVariant("tls12_aes256", "256", "1.2", "4"),
[Severity: Medium]
Can the tls12_aes256 variant fail on hardware and a kernel that are both
working correctly?
check_tls_support() only looks for "tls-hw-tx-offload: on" and
"tls-hw-rx-offload: on" in ethtool -k. Those flags don't say which
ciphers the device accepts, and several in-tree drivers only handle
AES-GCM-128:
nfp: nfp_net_cipher_supported() returns false for anything except
TLS_CIPHER_AES_GCM_128, so nfp_net_tls_add() returns -EOPNOTSUPP
chcr: chcr_ktls_save_keys() only handles TLS_CIPHER_AES_GCM_128
funeth: fun_ktls_add() returns -EOPNOTSUPP for anything except 128
mlx5: mlx5e_ktls_type_check() checks a separate firmware capability
for 256:
case TLS_CIPHER_AES_GCM_256:
if (crypto_info->version == TLS_1_2_VERSION)
return MLX5_CAP_TLS(mdev, tls_1_2_aes_gcm_256);
When the driver declines, do_tls_setsockopt_conf() falls back to SW
without reporting an error:
net/tls/tls_main.c:do_tls_setsockopt_conf() {
...
rc = tls_set_device_offload(sk);
conf = TLS_HW;
if (!rc) {
TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSTXDEVICE);
TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSCURRTXDEVICE);
} else {
rc = tls_set_sw_offload(sk, 1,
update ? crypto_info : NULL);
...
TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSTXSW);
...
}
check_path() then requires ksft_ge(dev, 1) for that direction and fails
with "DUT Tx: HW offload not engaged (Device=0, Sw=1)".
Would it make sense to skip this variant when the DUT falls back to SW
for this cipher, rather than reporting a failure?
> + KsftNamedVariant("tls12_aes128_ip6", "128", "1.2", "6"),
> +])
> +def test_tls_offload(cfg, cipher, tls_version, ipver):
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261029172302.2944955-1-rjethwani%40purestorage.com
Technical Details
Message-ID:
<179364254636.3131.4069372250703759332@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354979-linux-kernel-netdev=dewy.ruReferences:
<20261029172302.2944955-2-rjethwani@purestorage.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354979-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4 2/2] selftests: net: add TLS 1.2 hardware offload tests Date: Mon, 02 Nov 2026 18:02:26 +0000 Organization: Usenet Network Message-ID: <179364254636.3131.4069372250703759332@kernel.org> References: <20261029172302.2944955-2-rjethwani@purestorage.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3039813"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Jvz4lYLOId+MFRnHEega7GRbqhs= sha256:KfGC+xuLf+ApkxNJUpd6zPN9n8v6avK/A5jYUS65d7s= sha1:9XbFnzJ+zk5ziLK3k+1Rl+hBzhw= sha256:cfj7YMPlH/a8zgI/VQJlUUAaPsLxD3nec/r8V/cFcII= 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 7725211269D; Tue, 3 Nov 2026 00:54:34 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 xHzmZ2BtRr0N; Tue, 3 Nov 2026 00:54:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-354979-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 84BA111269B; Tue, 3 Nov 2026 00:54:22 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 9489E31CDA; Mon, 2 Nov 2026 18:04:21 +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=1793642549; b=U5LMwQa2q6uHpPn9Cy+EBEsJ7sZSU46Jpoqq57HDUD2i2t3bQlGny0oO7WK9Db0QUYAX sO1uJ0ciyZ1dbbP1eJtrJkzF2zMwBS3yLI8YHTXdpi9ebxZ07BjtUP4QrXRprNINMeGgM xokTVGgYKkuXsa2pzBXexOK9mub8eHzpXFSH6R3VOH5WQIxMNAlMlUIAAg8FOajGoGyjv hX2z1W3yqqs8Gk6WD1REm5V2lnPSkXNvWrrmLZHL4MfOa1HNS98CokOrbwMou+IIoNApg WU6aLNtxBSiIRHiHXAsuvz2KF1X+8WKv1Rdb73wM0C8r+tOX182HCDwpIxjIxzDAq7A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793642549; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Mo9e6zZ7DM0/oaEehTSm0CvIfdfjeAIAz6cCjHE3fzY=; b=KKxo3UQ/QBAVndUsVged+jXzsbSS7SHw7wZ2/5+QMfPW3qTJIqM8iPOzBvXyZO9q7uP9 ZQ1H/kBmpGUvKCamRUqe6Nc5IzDSfWnRbdSZfH8+/QRWbftmZB7KhNTokjM72ftg5JNnn XMWxV5jr8XAztD2I+2pQ4jyyvP3N1XvwnYCtnaSTdQTY+ZlP2gB6CsG8yEMNXbG55acDb Ta95z7iuoZysnyBPVKG0OeCYdxktCkwz/kAyy698IaMlM2/BleMehgz177ExNZd87MQou yi45ruPqM+lTrL3fujjuKuE0Q3sTd6tu4kwLyTVOESVAQrpu2G0TYCQEsuNbJnFoHDA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bQCVDwlk; 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 EEFCD606A33E; Mon, 2 Nov 2026 18:02:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bQCVDwlk X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793642548; b=nk6HOi3Xhxxm1r1ujtxCw8JfgwmTt9DxrZrj5mEm93XXQsVT82ranvy9aIVjZ/f6bWd0 oBgPkV/JAdpCbMAtTwEEiYWfaCvgX/HVjJggHbQ5iTJD7TktAxTXRmrLfeoa2bSzzdJuZ roTLQiRqq9E1iWoSVzw9f+Jtz46OpL6rbTfmEQUsGPbqJDhpFYlbTFzHTj39pA4Ia4wnH +y7J3vLVuoazibCUOv9sKUATksLMxdQNnmFbEof80mzmG9St0nbY2kwu1jZwags9VB2Yt qkQ3MJKKY5/B6ott08h3q58O04rA2gP34UQJJFuNLwdrxD4ClTEYWzfU0bid0Acz7Dg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793642548; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Mo9e6zZ7DM0/oaEehTSm0CvIfdfjeAIAz6cCjHE3fzY=; b=Gi3GRMq4UX5dZ/Ggat8HN/Hj2TwwpPe93XCvhkM/M45urf2y87+ga+kNjkMPJovYIBAq IrpULRXZToI6VkoMbeZrtaMk4YjjaTNlPt2srWJcSf7ody/w3I+KmKQd2L35w6xcxUeN4 cZg78MBjPsi055iwIHxLhVXeYBKuVc4tLVAU8nFFwUvMQGK91MiHMWATc6ebmVbP1k7+b eVpZ3lq8t6cZy3GC7PuEzGA2oxRAtXYx2BBt1+8n9yPsJvsB3kWlNYZndtSsQ1gRzbcfn zYgZyMUgGKeBY3h5IB93fukOUDscTq5WN/LD16QmzV6X//3o/2TnWMo5F1994D7WLzA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bQCVDwlk; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3FCD606A324; Mon, 2 Nov 2026 18:02:27 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D58E41F00A16; Mon, 2 Nov 2026 18:02:26 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793642547; bh=Mo9e6zZ7DM0/oaEehTSm0CvIfdfjeAIAz6cCjHE3fzY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=bQCVDwlk9TKmXmdDLqAtHKQyLbbnjuD4fRKkqkROq9eHHK4+xGX25nw2EkZqiZ/ii OmVdRGpNCeHDtTruH79ewwnzF/3ZYYU6Oei7XXhUY4eRO6tWwLPiohQGhjDT5d5OVU KZC8WaEYhjB0O+OD96hauUxIxdF82EQJ9qhDXQWW2tlsXIeI55XHZ4nqsYsHFx3oNm Qp8lziR+uP/HIMH+PBxDIIzZkDUW53CmCLET8PjrhYyZVG3s1oPkqbDxPP9VqaOkiw DRDkZ4f9gTFhj6T/dqV7gxv/4UJ8QuoIA4XNodV0t7J4AXUWx/ZtETwcLTnkjMigYp TJJrEhDHoTskQ== X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org, ilyal@mellanox.com, borisp@mellanox.com, aviadye@mellanox.com, linux-kernel@vger.kernel.org X-In-Reply-To: <20261029172302.2944955-2-rjethwani@purestorage.com> X-sashiko-severity: Medium 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