Article View: linux.kernel.netdev
Article #18559Re: [PATCH net-next v2 2/2] selftests: drv-net: run tls_hw_offload on netdevsim
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 14:32
Date: Wed, 18 Nov 2026 14:32
127 lines
13336 bytes
13336 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
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] In read_nic_stats(), the `ethtool -S` skip is keyed on whether
the env created netdevsim itself (`if cfg.get_local_nsim_dev(): return…
- [Low] In netdevsim mode the comments in tls_hw_offload.py describe
behaviour that no longer applies, and the patch doesn't update them.
--
selftests: drv-net: run tls_hw_offload on netdevsim
This commit lets tls_hw_offload.py run on the default netdevsim pair by
dropping nsim_test=False from the NetDrvEpEnv call. netdevsim does not
implement ethtool -S, so read_nic_stats() now returns an empty stats dict
when the environment created the netdevsim device itself.
> diff --git a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> index e720ce6547610..1197f17caa13c 100755
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> @@ -125,6 +125,9 @@ def read_nic_stats(cfg):
> # before/after-delta caveat as read_tls_stats(): these are device-wide,
> # so concurrent kTLS traffic on this NIC would perturb the deltas.
> stats = defaultdict(int)
> + # netdevsim has no ethtool -S, and the NIC counters below are optional
> + if cfg.get_local_nsim_dev():
> + return stats
> output = cmd(f"ethtool -S {cfg.ifname}").stdout
[Severity: Medium]
Does this guard cover a netdevsim interface that is passed in through
NETIF?
get_local_nsim_dev() returns self._ns. That is only set when NetDrvEpEnv
creates the netdevsim pair itself, i.e. when NETIF is not set. If NETIF
names a netdevsim port (for example a hand-made pair with
REMOTE_TYPE=netns), it returns None and the guard is false.
The cmd() call below then runs with the default fail=True. nsim_ethtool_ops
has no get_sset_count or get_strings, so ethtool -S exits non-zero. The
resulting CmdExitFailure propagates out of run_tls_test(), and every case
fails at the first NIC snapshot. This is the same failure the commit
message says it fixes.
Before the netdevsim TLS emulation existed, check_tls_support() skipped
such a device because it had no tls-hw-*-offload. This failure path is new
in this series.
Would it work to run ethtool -S with fail=False and return the empty stats
on a non-zero exit? That would handle any device without ETH_SS_STATS. It
would also avoid get_local_nsim_dev(), whose docstring discourages its use
because it makes tests nsim-specific. macsec.py does already use it to
skip steps, though.
> for line in output.strip().split('\n'):
> key, sep, val = line.partition(':')
[ ... ]
> @@ -307,7 +310,7 @@ def test_tls_offload_record_type(cfg, record_type):
>
> def main() -> None:
> """Set up the DUT/peer environment and run the offload test suites."""
> - with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
> + with NetDrvEpEnv(__file__) as cfg:
[Severity: Low]
Now that netdevsim mode is enabled here, are some of the existing comments
in tls_hw_offload.py still accurate?
The header comment in drivers/net/netdevsim/tls.c says no crypto is
performed:
/* Emulated kTLS offload. No crypto is performed: TX puts the record on the
* wire as plaintext and RX marks it decrypted, so the RX side has to be
* offloaded on netdevsim as well, otherwise the core runs the software AEAD
* over plaintext and fails the connection with -EBADMSG.
So in nsim mode the peer's RX also has to use the netdevsim offload. The
current run passes because the peer is also a netdevsim port with RX
offload enabled. Several comments in the test say otherwise.
The run_tls_test() docstring says:
The DUT (local) is the kernel under test; the remote is just a traffic
source/sink and may run any kernel without HW offload. Both sides run
kTLS because TLS is pairwise, but verify_tls_counters() requires HW
offload only in enabled DUT directions. The peer and the DUT's other
direction may use SW kTLS.
The comment in read_tls_stats() says:
# sock_net(sk)). The test runs on a real NIC in the host namespace, so
The comment above HW_NIC_COUNTERS says:
# the NIC encrypted anything; a broken HW encrypt shows up instead as a
# peer TlsDecryptError or an echo mismatch.
On netdevsim, a peer TlsDecryptError would mean the peer did not get RX
offload. It would not mean the DUT encrypted badly.
The commit message also says:
Everything the test checks on the DUT, device MIB counters,
echo data and record types, works there as is.
On netdevsim, though, the test only covers the kTLS device control and MIB
paths, not encryption. Could the comments and the commit message be
updated to describe the netdevsim case?
> cfg.bin_local = cfg.test_dir / "tls_hw_offload"
> cfg.bin_remote = None
> cfg.tls_skip_reason = None
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117140642.4008-1-jiayuan.chen%40linux.dev
Technical Details
Message-ID:
<179501234066.3136.14918473890361031397@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366185-linux-kernel-netdev=dewy.ruReferences:
<20261117140642.4008-3-jiayuan.chen@linux.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366185-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 2/2] selftests: drv-net: run tls_hw_offload on netdevsim Date: Wed, 18 Nov 2026 14:32:20 +0000 Organization: Usenet Network Message-ID: <179501234066.3136.14918473890361031397@kernel.org> References: <20261117140642.4008-3-jiayuan.chen@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2617579"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:pex8lKFS3Q/O/biwmt97ML7PVTc= sha256:z4c3K2nPSb0eBMQjBjeDAXMxlW8lw1SWQhZTqjAnGGo= sha1:hJEuPndubTha7BbnotUcbAHW97o= sha256:Qr9UD170jIzJ5L1Q9JG0lBEULNMYTdT/w66nWGnLm4o= 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 44AEF1152D1; Wed, 18 Nov 2026 17:32:57 +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 88QMbECuUMpc; Wed, 18 Nov 2026 17:32:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366185-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 7B9CC1152CE; Wed, 18 Nov 2026 17:32:43 +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 481703AC2C; Wed, 18 Nov 2026 14:32:24 +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=1795012342; b=eGjRibhV78uIQ7DOkJel3tygueYOxAo2WR6UND7L8Q80IXRUOnnqNZQ0C21V+AvFqUAi 4aG4ldm5Z8PTHzE3SqpGpzxvMmDiTrfaCN6KRVA7yyCORXagvGNpb0jGuvquY1W5a2SWT Tx4e2YPbgeHBxmXL5YtjO2vcP8k/n9zJHuI6CNlYc+WtKC/+z1/k0AR2zklDU/KT6d6sH GqNHMo7ij94AHNnc2u4kiWrENgXf/FOWiuMo9yIHpdudYUveoCnt/RfDAgXZZylXR4krU ALnnuUXOwfMIVL6mXnLUweFxcyJFtBOgR80zVCl31y8yO0P5ejMcTSMsQZzC5ZfGKLw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795012342; 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=HhclmHafCvRpxkVZZy1FUjsyN3cMPvpw1MvnobE5Sak=; b=m4kDO/E/aD/2+d+y5w21rt3UPUHiiPQO1lDTqwugEteOhSKRl+RlW6WHdx3B2MEZVx9K JznMFyhF4IixKOhuQKBVu+6rJpHmjhxne3VLxyMm59VhLW4Jgsbby4SqlMCvxdUJcf9OV q9BlO/6avMNVlStaZKDRx891o/h+9RTL+hL7FE3IIq0rtPUnKWa0hm6xAgsRzkd6QQDdg 22uAYAO20IuSqzIKY5p6QCXW/jc9tXF2W1goGc0fvgXYjMRQidhXlEP7PmKkIbCq/BZxf 0KQ2qNe11nnEgrIbw0YOqVHDfNKEiWjFxB1rq0YKLvAdj4p4GhCOoQJ0ky5bY+7WKGA== 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=BI5g5+rN; 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 D8204606A33D; Wed, 18 Nov 2026 14:32:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BI5g5+rN 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=1795012342; b=lOkG8fA4SN7OTUVnbERaW0vzSvj1quz7wPoqRAKt4Ppf9l7bhgpbyDBm2Zmnu1CwrYo5 IcEED2R1pUHMIAjNs8Uss98L72jgGUSZmdM3+XaHYkqIvLJ9YGmvK9XxHehj17s+MivyX uaIiFG6NeBJPvLm+9BDJvknEOrnl1gGF0SxxbwbcRcprvaPgb9do7aSh7m5ToIidgAw7r jaBfS0TRy29YLbrnP8RgRewg7TJ8HVkB66glcehft2q9S087fKrrhuMAFiJLX8XvXaqz/ JbdLTnm2eXdJ2xkDKTc4URR/Q8DNtC4YNahOO9oK3RWqYq/gggYLJVAp5a+Cnr+QWTg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795012342; 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=HhclmHafCvRpxkVZZy1FUjsyN3cMPvpw1MvnobE5Sak=; b=AHLBd5bbD1Q6136dMxDJSiPZogADPUVM9QyWFBVvO3TIzWbljSXq+J9GWrGmMZLaGdF2 dKH+xoJzaExZ87862vBvp0BCEcdy+5Z/SiocwH41n4ghAU0TjHaSr88rqt0im/fntp0Dz ikFkkT6ruiSdhpPnKmJoqYbe/rN8OUaoI+7RFHC2oXMMy2uayanwgSFFcSbPv4oAOjTHO Vuw2KijADCxA8eAvrsnDPSWKZ7LgefQ7iqY7QgTHEIRQjrgvY7ZX/heu3127KnRTeDnLZ qiaWRAfSZcHetavHacjNAVKa0vASxns4pr7BnBW73iuX2Lrcgvgfbg5sRJuio5KrdHQ== 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=BI5g5+rN; 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 05495606A337; Wed, 18 Nov 2026 14:32:21 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 161D81F000CB; Wed, 18 Nov 2026 14:32:21 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795012341; bh=HhclmHafCvRpxkVZZy1FUjsyN3cMPvpw1MvnobE5Sak=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BI5g5+rNvREe9vzS+4y19knK4uGcLOuYNk9n9wj+TnFzBl+dO11XG+J3hUemgw1yw PUWbM49kfT5hOgseEVfCnHXbnY3Idz8deiwSxEeDT3hV9116MgMARm2pk0ozAmADlF mT/27uX4LPjGEJeQNiRCCpNW4Pz/v48/O6Ikv9wgGK/P9XT2TKKxCjsZ3KbLR6mbuh ABLnlxQHeqN0ISPvEWOXq2UKAyvK02kqcNYpEnkanSrVMb9OI2+857umhq/gdkbWnf ydFV9kayykt1RnPBXCqFHvGUd6TslU3G/WnMaAxWeJBGdnBkxiFOqdy/ZAJTLuXC3g tgr2/rswBpBow== X-Cc: netdev@vger.kernel.org, kuba@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, john.fastabend@gmail.com, sd@queasysnail.net, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <20261117140642.4008-3-jiayuan.chen@linux.dev> 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 X-Received-Bytes: 13050