Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: netdev@vger.kernel.org, kuba@kernel.org
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Sabrina Dubroca <sd@queasysnail.net>,
	Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH net-next v2 2/2] selftests: drv-net: run tls_hw_offload on netdevsim
Date: Tue, 17 Nov 2026 22:06:31 +0800	[thread overview]
Message-ID: <20261117140642.4008-3-jiayuan.chen@linux.dev> (raw)
In-Reply-To: <20261117140642.4008-1-jiayuan.chen@linux.dev>

Now that netdevsim offers kTLS device offload, let the test run on it
too: drop nsim_test=False so the default netdevsim pair is used when no
NETIF is set.  Everything the test checks on the DUT, device MIB counters,
echo data and record types, works there as is.

The only thing netdevsim can't give is ethtool -S: nsim_ethtool_ops in
drivers/net/netdevsim/ethtool.c has no get_sset_count or get_strings,
so the command fails and every case died taking the NIC counter
snapshot.  That is a gap in netdevsim itself, not in the TLS emulation,
and the NIC counters are optional in this test anyway, so skip the
snapshot on netdevsim instead of adding ethtool stats to the driver.

  # ./tls_hw_offload.py
  # Interface: eth1, driver: netdevsim
  TAP version 13
  1..8
  ok 1 tls_hw_offload.test_tls_offload.tls12_aes128
  ok 2 tls_hw_offload.test_tls_offload.tls12_aes256
  ok 3 tls_hw_offload.test_tls_offload.tls12_aes128_ip6
  ok 4 tls_hw_offload.test_tls_offload_sizes.small_buf
  ok 5 tls_hw_offload.test_tls_offload_sizes.large_buf
  ok 6 tls_hw_offload.test_tls_offload_sizes.random_buf
  ok 7 tls_hw_offload.test_tls_offload_record_type.handshake
  ok 8 tls_hw_offload.test_tls_offload_record_type.alert
  # Totals: pass:8 fail:0 xfail:0 xpass:0 skip:0 error:0

Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
---
 tools/testing/selftests/drivers/net/hw/tls_hw_offload.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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
     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:
         cfg.bin_local = cfg.test_dir / "tls_hw_offload"
         cfg.bin_remote = None
         cfg.tls_skip_reason = None
-- 
2.43.0


      parent reply	other threads:[~2026-11-17 14:07 UTC|newest]

Thread overview: 3+ 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-17 14:06 ` Jiayuan Chen [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=20261117140642.4008-3-jiayuan.chen@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --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