Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Mon, 23 Nov 2026 20:39
Re: [PATCH net v2 3/3] selftests: net: add TLS offload over bond tests
Author: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 20:39
Date: Mon, 23 Nov 2026 20:39
197 lines
15371 bytes
15371 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads