Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jiayuan.chen@linux.dev
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
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	[thread overview]
Message-ID: <179501234066.3136.14918473890361031397@kernel.org> (raw)
In-Reply-To: <20261117140642.4008-3-jiayuan.chen@linux.dev>

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

      reply	other threads:[~2026-11-18 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 14:06 [PATCH net-next v2 0/2] netdevsim: add TLS device offload emulation and test Jiayuan Chen
2026-11-17 14:06 ` [PATCH net-next v2 1/2] netdevsim: add TLS device offload emulation Jiayuan Chen
2026-11-18  8:15   ` kernel test robot
2026-11-18 14:32   ` netdev-bot+sashiko
2026-11-17 14:06 ` [PATCH net-next v2 2/2] selftests: drv-net: run tls_hw_offload on netdevsim Jiayuan Chen
2026-11-18 14:32   ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179501234066.3136.14918473890361031397@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox