🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10646

Re: [PATCH net v5 2/2] selftests: net: add TLS 1.2 hardware offload tests

#10646
From: netdev-bot+sashiko
Date: Tue, 03 Nov 2026 21:33
107 lines
11516 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

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] On offload NICs that only support AES-GCM-128, the
  tls12_aes256 variant of test_tls_offload reports FAIL when it should…

--

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, and the peer echoes data back to the DUT.
It checks that HW offload is used in each enabled DUT direction, covers
AES-GCM-128/256, IPv4/IPv6 and several payload sizes, and adds handshake
and alert record-type regression cases for the push_pending_record fix.

> 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..e720ce6547610
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> @@ -0,0 +1,321 @@

[ ... ]

> +def check_tls_support(cfg):
> +    """Require kTLS on both hosts and at least one DUT HW direction."""

[ ... ]

> +    try:
> +        features = cmd(f"ethtool -k {cfg.ifname}").stdout
> +    except CmdExitFailure as e:
> +        raise KsftSkipEx(f"Cannot determine TLS HW offload support: {e}") from e
> +    cfg.tls_hw_directions = {
> +        direction for direction in ('Tx', 'Rx')
> +        if f'tls-hw-{direction.lower()}-offload: on' in features
> +    }
> +    if not cfg.tls_hw_directions:
> +        raise KsftSkipEx("Device has no enabled TLS HW offload direction")

[Severity: Medium]
On NICs whose offload only supports AES-GCM-128, will the tls12_aes256
variant of test_tls_offload() report FAIL instead of SKIP?

cfg.tls_hw_directions comes from the tls-hw-tx-offload and
tls-hw-rx-offload feature flags. Those flags don't depend on the cipher.
run_tls_test() then requires HW in those directions for every cipher.

Several in-tree drivers that advertise these features reject AES-GCM-256
in tls_dev_add():

drivers/net/ethernet/netronome/nfp/crypto/tls.c:nfp_net_cipher_supported() {
	switch (cipher_type) {
	case TLS_CIPHER_AES_GCM_128:
		...
		break;
	default:
		return false;
	}
	...
}

The other drivers do the same:

- fun_ktls_add() in funeth returns -EOPNOTSUPP for any cipher other
  than AES-GCM-128.
- chcr_ktls_save_keys() returns -EINVAL for non-128 ciphers.
- mlx5 only supports AES-256 when MLX5_CAP_TLS(tls_1_2_aes_gcm_256)
  is set.

When tls_dev_add() fails, do_tls_setsockopt_conf() falls back to SW
without returning an error:

net/tls/tls_main.c:do_tls_setsockopt_conf() {
	...
		rc = tls_set_device_offload(sk);
		conf = TLS_HW;
		if (!rc) {
			...
		} else {
			rc = tls_set_sw_offload(sk, 1,
						update ? crypto_info : NULL);
	...
}

The helper's setsockopt() calls succeed and the echo passes. Only
TlsTxSw/TlsRxSw go up. check_path() then fails with "HW offload not
engaged (Device=0, Sw=1)".

The HW_NIC_COUNTERS comment lists nfp, cxgb4 and funeth, so this would
hit hardware the test means to cover.

Could the AES-256 variant skip, or accept SW, when the DUT driver doesn't
offload that cipher?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261102213011.4191020-1-rjethwani%40purestorage.com
Technical Details
Message-ID: <179374158513.488856.17891105693447320515@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-355982-linux-kernel-netdev=dewy.ru
References: <20261102213011.4191020-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-355982-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 2/2] selftests: net: add TLS 1.2 hardware offload tests
Date: Tue, 03 Nov 2026 21:33:05 +0000
Organization: Usenet Network
Message-ID: <179374158513.488856.17891105693447320515@kernel.org>
References: <20261102213011.4191020-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="3266529"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:T0IysMK/ClBu9OgysCc25yy/IGo= sha256:HZyo1h6li6X5k6hAu6PRyqfo15T5nbwq5f/1M8kqfoo=
	sha1:VW0qNtuL7TPF2IiPij2TgUENrxU= sha256:NmOEEz5NTDSFcH3VnCand9W/qvs4JgRlIN0QlT72Pf0=
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 9F5B0112032; Wed,  4 Nov 2026 00:38:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 QlJwAPAhIQtT;
	Wed,  4 Nov 2026 00:38:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-355982-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 3F4F6112A1B; Wed,  4 Nov 2026 00:38:14 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id E34A42B9D6; Tue,  3 Nov 2026 21:33:12 +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=1793741592;
	b=R8Ai/3YIr0aC4oigzR4VspoV3+g4PWz/4CXCzecAUn4m6sNVYrTaM58Z8ZBq43JRn5Bc
	 F3KwcmsVDAV5560pEOJIg0G+EAord2Hv2axnVwAKZlVhoUBoJ2DDjLXiC3/BX3CHY0w4+
	 2Wq2qDlD1dJ6qLVSN+OOr7hNo9rC/pXtz64i3qBrGVlUAgSdtuuX/bi0Itbarm871GxWE
	 0J5LjFuFvOvLflWupK10oHzDTyahEWPceDtv1M2Yn903sj+vJ9GU49rNk7Z3mW908ggk+
	 FtmJtP5GHXfbTuXKyzMoRQ/rKuvPTmp4Dh7PLoQTh372X5U6qvbSzq4y4G3gAMlyp7A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793741592;
	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=XoFFjFtBSwpGahigQ08X9jppIpgnB5pZ1iH8tznVkuo=;
	b=HYDAvZDvh0neTHphotruiyU2PgTMs9VRxWkBE9PiTI93oJ7XpazjH4kJZWAdhXY2tVLi
	 bu8JmGyEWQ7kp5Q+rL9ZEO7lnhn1KKbyQmLy0Qvt7LBLjAk3evjg1iTXis3TTBl1JhMaX
	 7PZuY2DO+fS7ol7VppYSidBETkqb2SM9+CbRo8EVdIw9ibovinLeti6U2cfWB+M99chOB
	 /WtZ9GD63wJERGadajJyFgP9VXg0gw9h7+LULaugZw2LPtBfVkJ2IZo1TZPjTdYBbU4Gm
	 iaBRJOG92C/vBaoK5LjRp5zPLl+JrO9p6q+yAAnOnPVhD+LvpUItoxfdnD6SKu/MFxA==
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="a3cy43/P";
	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 BAC2A606A32C;
	Tue,  3 Nov 2026 21:33:12 +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=a3cy43/P
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=1793741586;
	b=BImmJs6eMLMKpsULwTjclYC7Gm3TmX79zp511DGBfNWJza/9DeKOOwAtcWDOXd70RllZ
	 aAgduDqjsppyX6ARcLMxNNP/P/u17in/fBNXvPtEtNAVwbMThpPZjHXUEzCklRuicu0RQ
	 xZhK9G/fMbQKtq69VAv7b/0B6rcgwjkgMMEivYw5+Ei5BqGKY/vpDs8JFReF0PUhg2IqN
	 aZCC6pHcet3sJ+rXQsn10Qkwl5kQdl3TEdGJv9G7scDyZuk08x1jyGgCUYZavuxe3m6o5
	 guOA1f+cArG15dI8i8xBX9IT0FSRVIYxqwDQw/XbYFzq4ZjDkeV3xMk8C8R33vKluDA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793741586;
	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=XoFFjFtBSwpGahigQ08X9jppIpgnB5pZ1iH8tznVkuo=;
	b=lEe/a0P86Tfpmi9UowpGiSGfuc+CS6kIDn57tbSha+Q8HqfjzOEx+6sumekqHRrA3pVY
	 7PJ+awHSiveRPqrCeXL6Pwvrth36w7aqdgniL07v5TSqaYH/mBoP06WNpA5zQDUbF98OO
	 yGcwCdD0te+aEueoN4mp6i7vqY77zLLtVx/H9VqwBkNfFdSw4gQ1Gr7vYQPeqF6GdW8WE
	 9yrFY4C1Bils4v8WG9lwXQqh39kVv7Uk2UbxnsU673p2J8OEQKukoidDjDZJkSGm6H0+I
	 Ctc+c8T1jZYt685NZePG+0H+JNru9Zr4yCd3E+AZrjx8//ughl0j/cSm0KJj0YkWoSQ==
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="a3cy43/P";
	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 7C427606A324;
	Tue,  3 Nov 2026 21:33:06 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97CAA1F00919;
	Tue,  3 Nov 2026 21:33:05 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793741586;
	bh=XoFFjFtBSwpGahigQ08X9jppIpgnB5pZ1iH8tznVkuo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=a3cy43/PwfIXlyyg+ZoxSm+jZrxZhG2XJhHnaStHtL5tzLhnQCzlQnUixqpGPxfxN
	 8haD4x8uaibKug+LuB2Y8Sf4pjAWAVlT2BeRADE4NBZlEynnjSb0574ru25hj15m+f
	 WkUhMCl0+0Yoyx9FfC4qp/ekB9sPm+CfYSNd0Pmz85KqaNKlvClrrr8dFSAi9y4c57
	 ABxaL7ZedSalzm7PQWreRVpdo8Ae/nhVkjhaKagKfKk4XsMaapNQKBPSjPBZ8IIlCd
	 nM6ZA/Oxc07G3pUtsPRuWtrsm6rYwZNgMUydmi/y9A/Va/tOWez8TxcAEjTLfWZcjV
	 ZPYcYSzzvCWxw==
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, aviadye@mellanox.com,
 borisp@mellanox.com, ilyal@mellanox.com, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261102213011.4191020-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