🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19651

Re: [PATCH net-next v3 2/2] selftests: drv-net: run tls_hw_offload on netdevsim

#19651
From: netdev-bot+sashiko
Date: Fri, 20 Nov 2026 06:51
123 lines
12914 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()
  (tools/testing/selftests/drivers/net/hw/tls_hw_offload.py:128-131),…
- [Low] Several comments still describe a real-hardware-only setup, but
  after this patch the default run (no NETIF) uses a netdevsim pair that…

--

selftests: drv-net: run tls_hw_offload on netdevsim

This drops nsim_test=False from tls_hw_offload.py, so the test runs on the
default netdevsim pair when NETIF is not set. It also makes
read_nic_stats() skip the ethtool -S snapshot when a local netdevsim
device was created by the environment.

> 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 check the right thing? The comment is about the driver,
but get_local_nsim_dev() only returns self._ns. That is set only by
create_local() when NETIF is not in the environment:

tools/testing/selftests/drivers/net/lib/py/env.py:NetDrvEpEnv.__init__() {
    ...
        self._ns = None
    ...
        if "NETIF" in self.env:
            if nsim_test is True:
                raise KsftXfailEx("Test only works on netdevsim")
            self._check_env()
    ...
}

If NETIF names a netdevsim port, self._ns stays None. The test then falls
through to cmd("ethtool -S ...") with the default fail=True. netdevsim
has no get_sset_count, get_strings or get_ethtool_stats, so ethtool exits
non-zero and cmd() raises CmdExitFailure. run_tls_test() does not catch
it, so all 8 variants fail at the first snapshot. Any other TLS-offload
netdev without ethtool stats would fail the same way.

The test header already says these counters are optional:

    # counters. Each counter is checked only when present.
    ...
    # Missing NIC crypto counters remain optional.

The get_local_nsim_dev() docstring also discourages this kind of use:

    Using this method is discouraged, as it makes tests nsim-specific.
    Standard interfaces available on all HW should ideally be used.

Would a driver-agnostic check be simpler? For example, run ethtool -S
with fail=False and return the empty stats dict on a non-zero exit. That
would cover the default nsim pair, NETIF=netdevsim and any stats-less
driver, with about the same amount of code. The commit message mentions
the NETIF case but doesn't say why the environment check was chosen
over a capability check.

[ ... ]

> @@ -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]
This isn't a bug, but with netdevsim now the default environment, a few
comments still describe a real-hardware-only setup. Should they be
updated?

The comment in read_tls_stats() says:

    # sock_net(sk)). The test runs on a real NIC in the host namespace, so

The header of tls_hw_offload.c says:

    * Tests kTLS hardware offload between two physical nodes using

The run_tls_test() docstring says the remote:

    source/sink and may run any kernel without HW offload. Both sides run

On netdevsim this isn't true. drivers/net/netdevsim/tls.c says:

    /* Emulated kTLS offload.  No crypto is performed: TX puts the record on the
     * wire as plaintext, 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 on the default nsim path, the peer has to receive with HW offload.
If its RX offload were turned off, the test would fail, even though the
docstring says that setup is allowed.

>          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/20261119064902.242502-1-jiayuan.chen%40linux.dev
Technical Details
Message-ID: <179515748385.3136.10275675955381531740@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367717-linux-kernel-netdev=dewy.ru
References: <20261119064902.242502-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!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367717-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 2/2] selftests: drv-net: run tls_hw_offload on
 netdevsim
Date: Fri, 20 Nov 2026 06:51:23 +0000
Organization: Usenet Network
Message-ID: <179515748385.3136.10275675955381531740@kernel.org>
References: <20261119064902.242502-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="3086411"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:t50qEdPQXNgL1MdAzFmjuC9CUYg= sha256:wsiYBxDqFA5A+BxqQvjHtjQ4QXu/86uFz4/bvF0jgks=
	sha1:XuWV3CtYAEYD4MUa//sBiTxIpo4= sha256:P61uFF/4I64cVkpf4tFfpjb5vEm/IPixijaeFuD0bGo=
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 267F91158D4; Fri, 20 Nov 2026 09:51:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[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 3CjEAGv4021K;
	Fri, 20 Nov 2026 09:51:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-367717-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 25C5B1158D2; Fri, 20 Nov 2026 09:51:37 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id D8B66624A0F; Fri, 20 Nov 2026 06:51:36 +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=1795157491;
	b=meKmTYsoq3kDDzRidnEKZUuz3Zivunx2mSNYEtL+B14PqNM61hs5XD4Sr4T3CKkOKNu4
	 4zki1/Zg/kGhE7w1ULNT5MIAliE6oAyZHI72z0fdXwlw4xIYlj0Km897qAaAPPEU59Q8B
	 BzhIha0k8JbaxShhufSmIpq1ViWOj+3iDVN4A+xzQ7RBU2EyGmNSGDw/NIOvo6VIfvXWd
	 mjB+FNcoIwz1e515bBCt8yA4MgXwu+4RjAZhPrU1bq7yqe9fUyunCSGuVenmYQXtbd/cE
	 46XshLUU1XYk0Ig2c2aRQtRCaTfdewX9Bvnw93+z8TfgBBOVEwESAJibBZrtiIa0JQw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795157491;
	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=1g1qowK/Vhy/51ATJ4wve21dh0EgoCYYqHxYRokZ4Cs=;
	b=NlHWhaiZdJAJlflMEC+phru7HDWsoho+9nAfoQsxHRShR7CPLvdo4v844c1AnhWFPtFT
	 lwWIwR9o0oDIcDzATLUDnmp6NsyFR8SYenleIslYPt5o48APs7LigRuD4idNH4m5pland
	 ta65BrsGJ0LQSMvLTptC2QkNh7qu8RAHn5v3Ii3IywmaXaexoKYYnseoTnzfq4YxabU2b
	 Q52YM4r22JVluTO5bBHKSkOkZQS8KaqX2yJ0/S8T87Rx2fnBVq1C91CdVbHsrpxva7+LT
	 iijJFAfElDotf0lQE19T8So/Use5z58k8EGvD9W8UOKaFb59lTBAa4yVL/qeU1/hs/g==
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=TyGyL+pv;
	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 2CBA6606A333;
	Fri, 20 Nov 2026 06:51:31 +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=TyGyL+pv
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=1795157485;
	b=y0M6JqSjH2ZSZkre2/aaAftHGkVwgGdN2HSJvLROCwEjzZAOciwexv9kDNd8SDaCkwLn
	 SUHOkci+ve2W/wJwV+iQ3q6/bdWeVq//gZwDrsuhJUGYWb98xVyI9aDWjlNSdW7HKhErH
	 4ghK4Ey1L0Y4JLEwqw02sEJ1D2e1ufhbG+J/meenEQe4qHRXrOHYHpa/f8TXZsBpDW1AE
	 w1EEAhOaCb077So/36t+gckNso6Gl8eOfFTtmofdIIFrb3p1Q/6M9Q70kLoWl16lDiVl3
	 RopmC8zD6rRkCHiDDhODxv94C6CAMt5w2ycmhlXlWQwUwSfSIPLSfVCmz7ymfvqV1qA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795157485;
	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=1g1qowK/Vhy/51ATJ4wve21dh0EgoCYYqHxYRokZ4Cs=;
	b=GuBgUrY5u95keMtz6o9EDvLQGBUR42NgIIVvWnv8BSEZ5+w259fVsW6S8afM0cj0KKeW
	 MVwpp3krF9pClXBD4YRvnqCv6q9NpGYdoTou3O7ugc5sU8PRPHheqLDnxhYJeWdffuifm
	 BKSy7hyQ4cdEcFw7sp9nzWr++mU3ng2+A+/yP7lfJcOVypHSzMtrHSJvV6OoNTQImD++S
	 dcfOlz8ZNe/set8iMg/UBPvUH2IzRTuA1+7UhswGCdbVrKnH4l8rmGsfiJdov27pCudS/
	 FFH1iOHQIzssepbRvitvbIXsu1XTzg3J6n5mhCdVODVyOlJ50R2QER6PsFYuIgHuBRg==
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=TyGyL+pv;
	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 4C36A606A33E;
	Fri, 20 Nov 2026 06:51:25 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44F361F000C4;
	Fri, 20 Nov 2026 06:51:24 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795157484;
	bh=1g1qowK/Vhy/51ATJ4wve21dh0EgoCYYqHxYRokZ4Cs=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=TyGyL+pvUVyjqSzJMtV6EH6roUrKZbb9TejLfSQgNn6/Cg+1TDAJmvomZIhnT7+7E
	 tUSgd3y/cyEkt263xOaPoa9E2ZNvcFsVI28ztYrjNHqxlrIr7HsTg8hgUQgTlrWknv
	 F/O0aqOs1yTlQ/E+hUqX1LiRNxZNWTshEubFMqBXOZSssGfuNaJIPV6N07KuXAzlr0
	 8vpGB1SKBdKwhokLEzPq1botFI2N4m9D05PWC+4smWR3/ympqz/kPcoyR/LOW/N6CR
	 LEvfZR07SblM3XdBCzVjg6Kl+ueNDvtUdPPNPLVMZ5quM5slrC23usEsPVbJD9nWCn
	 KlNYaaag13SYA==
X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@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: <20261119064902.242502-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