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,
willemb@google.com, horms@kernel.org, alice.kernel@fastmail.im,
tariqt@nvidia.com
Subject: Re: [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests
Date: Sun, 06 Dec 2026 00:23:10 +0000 [thread overview]
Message-ID: <179651659076.3148.8947258780575987752@kernel.org> (raw)
In-Reply-To: <20261204235642.36653-8-rjethwani@purestorage.com>
Thank you for your contribution! Sashiko AI review found 7 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 4
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] The commit message says the test will "Skip configurations the
test cannot safely restore", but the restorability checks only look at…
- [Medium] The comment on PAUSE_IO_TIMEOUT_S (tls_hw_offload.py:41) says
45s is "long enough for a bounced NIC to retrain".
- [Medium] selftests/net: run_tls_test() stalls teardown by resuming
paused client
- [Low] The comment above HELPER_TIMEOUT_S (tls_hw_offload.c:94) says "-T
raises both, keeping the lifetime above the I/O timeout".
- [Low] The INFLIGHT_LINK_UP script wraps its `ip link set dev <slave>
up` in try/finally under the comment "Bring the slave back however…
- [Low] bounce_inflight() starts its link-up helper with
bkg([sys.executable, '-c', INFLIGHT_LINK_UP, ...], exit_wait=True)…
- [Low] selftests/net: tls_hw_offload -T uses atoi() instead of
parse_int_arg()
--
selftests: net: add TLS offload over bond tests
This adds kselftest cases that run the kTLS echo test over a single-slave
balance-xor bond with layer3+4 hashing. They also bounce the slave midway
through an echo to exercise the TX software fallback. The C helper gains
a -P option to pause the client halfway and a -T option to change the I/O
timeout and the helper 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..9c1c546d36cf6 100644
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
[ ... ]
> @@ -797,6 +815,17 @@ int main(int argc, char *argv[])
> case 'V':
> verbose = 1;
> break;
> + case 'P':
> + pause_mid = 1;
> + break;
> + case 'T':
> + io_timeout_s = atoi(optarg);
> + if (io_timeout_s < 1 || io_timeout_s > 120) {
> + printf("ERROR: -T out of range 1..120\n");
> + return 1;
> + }
> + helper_timeout_s = 2 * io_timeout_s + 15;
> + break;
[Severity: Low]
Is there a reason -T uses atoi() here rather than parse_int_arg()?
Every other numeric option in main() (-p, -b, -r, -t and -n) goes
through parse_int_arg(). That helper uses strtol(), rejects empty
strings and trailing characters, and checks the range itself.
atoi() takes "-T 10abc" as 10. Its behaviour on an out-of-range string
is undefined, so the 1..120 check that follows does not reliably catch
bad input either.
The harness always passes a plain integer, so this only matters for
manual runs. Something like
parse_int_arg(optarg, 1, 120, "timeout", &io_timeout_s)
would drop the ad-hoc check and keep the error messages consistent
with the other options.
[Severity: Low]
This isn't a bug, but the comment above HELPER_TIMEOUT_S says:
-T raises both, keeping the lifetime above the I/O timeout.
This case accepts any value from 1 to 120. Wouldn't -T 1 through -T 7
lower the I/O timeout below IO_TIMEOUT_S rather than raise it?
The help text in print_usage() also puts the formula next to defaults
that the formula does not produce:
-T <sec> Send/recv timeout (default: 8); lifetime bound
becomes 2 * <sec> + 15 (default: 15)
Passing -T 8 explicitly gives a 31s lifetime, not the default 15s.
Could the comment and the help text be updated to match the code?
[ ... ]
> 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..7d90f1c2024a1 100755
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
[ ... ]
> @@ -19,9 +31,18 @@ from lib.py import (
[ ... ]
> +BOND_IFNAME = "tlsbond0"
> +
> +# -T for -P cases, long enough for a bounced NIC to retrain.
> +PAUSE_IO_TIMEOUT_S = 45
[Severity: Medium]
Is 45s really long enough, given the other deadlines in this file?
run_tls_test() passes -T 45 to both helpers, so set_io_timeouts() sets
SO_RCVTIMEO to 45s on the server socket. The server then waits in recv()
for the whole pause.
In the idle variant, the pause covers wait_hw_stats_settle(), the link
down/up and wait_bond_ready(). wait_bond_ready() allows:
wait_carrier(cfg.ifname) up to 30s
wait_carrier(BOND_IFNAME) up to 30s
wait_reachable(BOND_IFNAME, peer) up to 30s per peer
Take a NIC that gets carrier at 20s and first answers ping at 47s, for
example behind a switch port with an STP forwarding delay. It passes each
of these deadlines, but the server's recv() has already timed out by
then. Wouldn't that end in the bare helper recv timeout that
wait_reachable()'s docstring says it is meant to avoid?
In the inflight variant, nothing waits for carrier after the background
"ip link set up". The resumed segment only gets through on a later RTO
retransmission. With exponential backoff (roughly 0.2, 0.6, 1.4, 3.0,
6.2, 12.6, 25.4, 51s), a NIC that needs more than about 23s to retrain
after the roughly 2s outage misses the 25.4s retransmission. The next
retransmission comes after both helpers' 45s timeout, even though
wait_carrier() itself would accept up to 30s.
Should PAUSE_IO_TIMEOUT_S be derived from these deadlines? Or should the
deadlines be tightened to fit inside it?
[ ... ]
> @@ -305,6 +357,439 @@ def test_tls_offload_record_type(cfg, record_type):
[ ... ]
> +def setup_bond(cfg):
> + """Enslave the DUT NIC to a single-slave bond for the rest of the case.
[ ... ]
> + # Deleting a primary IPv4 address can take its secondaries with it.
> + ip(f"addr flush dev {cfg.ifname} scope global")
> + ip(f"link set dev {cfg.ifname} down")
[Severity: Medium]
The commit message says:
Skip configurations the test cannot safely restore.
What happens if the NIC has 802.1Q VLAN uppers?
setup_bond() and require_restorable() check for:
- an existing master
- nexthop objects
- multipath and prefsrc routes
- the NIC's IPv6 addresses and IPv6 local table
- permanent or proxy neighbours
None of these checks looks at devices stacked on top of the NIC.
Taking the NIC down here, and again in bounce_idle() and
bounce_inflight(), makes vlan_device_event() schedule
VLAN_WORK_LINK_STATE. vlan_dev_work() then closes every VLAN that does
not use loose binding:
net/8021q/vlan_dev.c:vlan_dev_work() {
...
} else if ((flgs & IFF_UP) && !loose) {
netif_change_flags(vlandev, flgs & ~IFF_UP, NULL);
...
}
The VLANs come back up with the NIC, but closing them has already:
- removed their IPv6 addresses (keep_addr_on_down defaults to 0)
- deleted routes through them
- flushed their permanent neighbours
save_nic(), route_keys() and check_routes() only cover dev {ifname}, so
none of this is saved, restored or checked.
ksft_disruptive cases run by default. On a DUT like this, wouldn't the
test silently drop the VLAN configuration instead of skipping? Should
require_restorable() also skip when the NIC has upper devices?
[ ... ]
> +found = []
> +# Bring the slave back however polling ends.
> +try:
> + end = time.monotonic() + float(wait_s)
> + while time.monotonic() < end:
> + found = client_retransmits()
> + if len(found) == 1 and found[0] > int(base):
> + time.sleep(float(outage_s))
> + break
> + time.sleep(0.1)
> +finally:
> + up = subprocess.run(["ip", "link", "set", "dev", ifname, "up"])
[Severity: Low]
Does this finally block run on run_tls_test()'s exception path?
tls_hw_offload.py:run_tls_test() {
...
except BaseException:
if pending:
pending.process(terminate=True, fail=False,
timeout=reap_timeout)
...
}
bounce_inflight() starts this script without ksft_ready/ksft_wait, so it
does not lead its own process group. cmd._process_terminate() therefore
falls back to self.proc.terminate() and sends SIGTERM to the
interpreter.
The script installs no SIGTERM handler, so CPython exits without
unwinding and this "ip link set up" never runs. The deferred
restore_nic() brings the NIC up later, but the guarantee in the comment
does not hold on that path.
> +def bounce_inflight(cfg, port):
[ ... ]
> + base = client_retransmits(cfg, port)
> + ip(f"link set dev {cfg.ifname} down")
> + return bkg([sys.executable, "-c", INFLIGHT_LINK_UP,
> + client_proc_rem(cfg, port), str(base), cfg.ifname,
> + str(INFLIGHT_SEND_WAIT_S), str(INFLIGHT_OUTAGE_S)],
> + exit_wait=True)
[Severity: Low]
What happens to this helper if pending.process() in run_tls_test() times
out?
The handle is never used as a context manager, and it does not own a
process group. It is only reaped through
pending.process(..., timeout=reap_timeout). On TimeoutExpired, Popen does
not kill the child, and cmd._kill_leftovers() returns early:
if not self._own_pgrp:
return
So the helper keeps running unreaped. After the SIGTERM above, so can an
"ip link set up" grandchild that still holds the inherited stdout/stderr
pipes. The TimeoutExpired also replaces the original test exception.
Could that leftover process still change the slave's link state while
the defers delete tlsbond0 and run restore_nic(), or during the next
case?
[ ... ]
> @@ -244,26 +274,48 @@ def run_tls_test(cfg, cipher="128", tls_version="1.2",
> client_parts.append(f"-b {buffer_size}")
> if record_type:
> client_parts.append(f"-t {record_type}")
> + if pause:
> + client_parts += ["-P", io_opt]
> client_cmd = " ".join(client_parts)
>
> stats_before_local = read_tls_stats()
> stats_before_remote = read_tls_stats(host=cfg.remote)
> nic_before = read_nic_stats(cfg)
> + nic_paused = None
>
> # The remote server runs under bkg(), whose stdout pipe is only drained
> # once it exits, so the helper keeps its per-connection output small
> # (see the note on verbose in tls_hw_offload.c); do not pass -V.
> #
> - # Both helpers exit on their own within HELPER_TIMEOUT_S (see
> + # Both helpers exit on their own within their SIGALRM lifetime (see
> # tls_hw_offload.c), so nothing outlives the variant even on failure.
> - with bkg(server_cmd, host=cfg.remote, exit_wait=True):
> + with bkg(server_cmd, host=cfg.remote, exit_wait=True, **budget):
> wait_port_listen(port, host=cfg.remote)
> - cmd(client_cmd)
> + if pause:
> + # bkg() returns once the client pauses; leaving resumes it.
> + pending = None
> + reap_timeout = INFLIGHT_SEND_WAIT_S + INFLIGHT_OUTAGE_S + 10
> + try:
> + with bkg(client_cmd, ksft_wait=30, **budget):
> + # pause() may take the socket off the NIC.
> + cfg.wait_hw_stats_settle()
> + nic_paused = read_nic_stats(cfg)
> + pending = pause(cfg, port)
> + except BaseException:
> + if pending:
> + pending.process(terminate=True, fail=False,
> + timeout=reap_timeout)
> + raise
> + if pending:
> + pending.process(terminate=False, fail=True,
> + timeout=reap_timeout)
> + else:
> + cmd(client_cmd)
>
> cfg.wait_hw_stats_settle()
> stats_after_local = read_tls_stats()
> stats_after_remote = read_tls_stats(host=cfg.remote)
> - nic_after = read_nic_stats(cfg)
> + nic_after = nic_paused if pause else read_nic_stats(cfg)
>
> verify_tls_counters(stats_before_local, stats_after_local, is_dut=True,
> hw_directions=hw_directions)
[Severity: Medium]
What happens to the paused client if pause() raises?
The client bkg() gets ksft_wait=30 but not exit_wait=True, so its
_exit_wait stays False. Suppose bounce_idle() fails in wait_carrier()
or wait_reachable(), bounce_inflight() fails in client_retransmits(),
read_nic_stats() fails, or KsftTerminate arrives inside the block.
bkg.__exit__() then leaves terminate False and calls _reap_cancelled()
with the 120s budget timeout. _reap_cancelled() writes to
ksft_term_fd, which releases the client from ksft_wait(). It then
waits for the client without sending SIGTERM.
do_client() does not exit after ksft_wait(). It carries on with the
second half of the iterations, with 45s socket timeouts from -T 45 and
a 105s alarm(). If the slave is still down or the peer is unreachable,
the error from pause() is held up until the client times out or its
alarm fires.
That also delays the defers that delete tlsbond0 and run
restore_nic(). If the runner kills the test in that window, the DUT NIC
stays enslaved to tlsbond0 without its addresses and routes.
Would adding exit_wait=True next to ksft_wait=30 be enough here? The
normal exit path should not change. A cancelled block would then send
SIGTERM to the client's process group instead of resuming it.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
next prev parent reply other threads:[~2026-12-06 0:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 2/9] tls: device: keep tls_sw_fallback() from encrypting its own output Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko [this message]
2026-12-04 23:53 ` [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani
2026-12-06 0:23 ` 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=179651659076.3148.8947258780575987752@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 \
--cc=willemb@google.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