Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: rjethwani@purestorage.com
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, tariqt@nvidia.com, alice.kernel@fastmail.im
Subject: Re: [PATCH net v2 3/3] selftests: net: add TLS offload over bond tests
Date: Mon, 23 Nov 2026 20:39:30 +0000	[thread overview]
Message-ID: <179546637039.3135.9772671834943336374@kernel.org> (raw)
In-Reply-To: <20261119191341.4089157-3-rjethwani@purestorage.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 2

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 tools/testing/selftests/drivers/net/hw/tls_hw_offload.py,
  bounce_idle() (lines 458-462) runs `ip link set dev <slave> down`,…
- [Medium] test_tls_offload_bond_bounce takes the slave NIC
  administratively down and up (bounce_idle()/bounce_inflight() at…
- [Low] The -T help line in print_usage()
  (tools/testing/selftests/drivers/net/hw/tls_hw_offload.c:769) reads…
- [Low] selftests: net: setup_bond() runs before IPv4 check in bond
  offload tests

--

selftests: net: add TLS offload over bond tests

This adds kTLS HW offload tests that run the echo test over a single-slave
balance-xor bond. It also adds tests that bounce the slave under an open
offloaded socket, in idle and inflight variants. The C helper gains -P to
pause the client halfway and -T to widen its I/O timeouts and SIGALRM
lifetime.

> diff --git a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
> index 5b3887f32b689..0be321866a978 100644
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c

[ ... ]

> @@ -751,6 +765,9 @@ static void print_usage(const char *prog)
>  	printf("  -c <cipher>   Cipher: 128 or 256 (default: 128)\n");
>  	printf("  -n <N>        Send/echo iterations (default: 100)\n");
>  	printf("  -t <type>     Record type test: 21=alert, 22=handshake\n");
> +	printf("  -P            Pause halfway (client): ksft_ready(), ksft_wait()\n");
> +	printf("  -T <sec>      Send/recv timeout and lifetime bound (default: %d)\n",
> +	       IO_TIMEOUT_S);

[Severity: Low]
This isn't a bug, but does this help text match what -T does?

Without -T, the SIGALRM lifetime is HELPER_TIMEOUT_S (15), not 8. With
-T N, main() sets:

	helper_timeout_s = 2 * io_timeout_s + 15;

and passes that to alarm(). So <sec> sets the send/recv timeout, and the
lifetime bound is derived from it rather than equal to it.

[ ... ]

> 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..345d5fd9a5e95 100755
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py

[ ... ]

> @@ -305,6 +358,145 @@ def test_tls_offload_record_type(cfg, record_type):

[ ... ]

> +    ip(f"link add {BOND_IFNAME} address {mac} mtu {mtu} type bond "
> +       "mode balance-xor xmit_hash_policy layer3+4 miimon 100")

[ ... ]

> +    wait_carrier(cfg.ifname)
> +    wait_carrier(BOND_IFNAME)
> +
> +    for peer in filter(None, cfg.remote_addr_v.values()):
> +        wait_reachable(BOND_IFNAME, peer)

[ ... ]

> +def bounce_idle(cfg):
> +    """Bounce the slave while the socket is idle, then resume the echo."""
> +    ip(f"link set dev {cfg.ifname} down")
> +    ip(f"link set dev {cfg.ifname} up")
> +    wait_carrier(BOND_IFNAME)

[Severity: Medium]
Can wait_carrier(BOND_IFNAME) return here before the slave is actually
back?

For a slave going down or up, bond_slave_netdev_event() only refreshes the
slave array. It does not change the master's carrier:

drivers/net/bonding/bond_main.c:bond_slave_netdev_event() {
    ...
	case NETDEV_DOWN:
		...
		if (bond_mode_can_use_xmit_hash(bond))
			bond_update_slave_arr(bond, NULL);
		break;
    ...
}

For a running balance-xor bond, bond_set_carrier() is only reached through
bond_mii_monitor()->bond_miimon_commit(). That runs every 100ms here
(miimon 100), and it is deferred again whenever rtnl_trylock() fails while
the ip commands hold RTNL.

So /sys/class/net/tlsbond0/carrier can still read the 1 from before the
bounce. In that case the wait returns at once, while the NIC is still
retraining.

The resumed records would then reach a slave with no carrier and go out
on retransmit. That is the inflight scenario, so the idle variant may not
reliably cover the "slave back before the client resumes" case.

setup_bond() waits on wait_carrier(cfg.ifname), then on the bond carrier,
then on wait_reachable() for each peer. Should bounce_idle() use the same
sequence?

[ ... ]

> +@ksft_variants([
> +    KsftNamedVariant("idle", bounce_idle),
> +    KsftNamedVariant("inflight", bounce_inflight),
> +])
> +@ksft_disruptive
> +def test_tls_offload_bond_bounce(cfg, bounce):

[ ... ]

> +    require_tls_setup(cfg)
> +    setup_bond(cfg)
> +    run_tls_test(cfg, pause=bounce)

[Severity: Low]
Does setup_bond() run too early for an IPv6-only environment?

run_tls_test() is called here with the default ipver="4", and it only
checks cfg.require_ipver(ipver) after setup_bond() has returned.

On a NetDrvEpEnv with only IPv6 addresses, setup_bond() still does all
of its work first. It moves the global addresses to tlsbond0, takes
cfg.ifname down, enslaves it, and waits for carrier and for ping
reachability of the IPv6 peer.

Only then does run_tls_test() raise KsftSkipEx. The deferred cleanup
then deletes the bond, and restore_nic() brings the NIC up again,
which flaps the link a second time.

test_tls_offload_bond_bounce() has the same ordering. So each of the
four bond variants retrains the NIC twice only to report a skip.

Would it make sense to call cfg.require_ipver("4") before setup_bond()
in both tests? Alternatively, setup_bond() could take the ipver the
case is going to run with.

[Severity: Medium]
Could the NIC packet count check fail in both bounce variants on drivers
that keep their TLS stats in per-queue state?

The slave is taken down and up between the nic_before and nic_after
snapshots in run_tls_test(), which runs the driver's ndo_stop/ndo_open.
check_hw_crypto() then requires:

            got = stat_diff(nic_before, nic_after, key)
            ksft_ge(got, 1,
                    comment=f"DUT {direction}: NIC reported no TLS "
                            f"offload packets ({key}={got})")

On funeth, which the HW_NIC_COUNTERS comment lists, fun_get_ethtool_stats()
builds tx_tls_encrypted_packets by summing the live fp->txqs[i]->stats.

funeth_close()->fun_down() with FUN_QSTATE_DESTROYED frees the TX queues in
fun_free_rings(). funeth_open() then allocates new zeroed queues through
kzalloc_node() in fun_txq_create_sw(). The counter therefore restarts at 0
after the bounce.

NETDEV_DOWN also moves the socket to the TX SW fallback through
tls_device_down(), so nothing goes through the HW path after resume.
nic_before is also around 0, because setup_bond() has just recreated the
queues.

As a result, got ends up 0, and the case reports "NIC reported no TLS
offload packets" even with a correct kernel fix.

tx_tls_ctx (fp->tx_tls_add) survives close/open, so only the packet count
check seems to be affected. The bounce cases were only tested on mlx5,
which keeps its counters across close/open.

Should the bounce cases relax or skip the packet count check?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119191341.4089157-1-rjethwani%40purestorage.com

  reply	other threads:[~2026-11-23 20:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 19:13 [PATCH net v2 1/3] tls: device: keep tls_sw_fallback() from encrypting its own output Rishikesh Jethwani
2026-11-19 19:13 ` [PATCH net v2 2/3] selftests: net: py: add a bkg() timeout and kill the child when it expires Rishikesh Jethwani
2026-11-23 20:39   ` netdev-bot+sashiko
2026-11-19 19:13 ` [PATCH net v2 3/3] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
2026-11-23 20:39   ` netdev-bot+sashiko [this message]
2026-11-19 19:18 ` [PATCH net v2 1/3] tls: device: keep tls_sw_fallback() from encrypting its own output netdev-bot+sinfo
2026-11-23 20:39 ` netdev-bot+sashiko

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=179546637039.3135.9772671834943336374@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alice.kernel@fastmail.im \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rjethwani@purestorage.com \
    --cc=sd@queasysnail.net \
    --cc=stable@vger.kernel.org \
    --cc=tariqt@nvidia.com \
    /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