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,
	willemb@google.com, horms@kernel.org, alice.kernel@fastmail.im,
	tariqt@nvidia.com
Subject: Re: [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device
Date: Sun, 06 Dec 2026 00:23:12 +0000	[thread overview]
Message-ID: <179651659216.3148.1788886959208565486@kernel.org> (raw)
In-Reply-To: <20261204235642.36653-9-rjethwani@purestorage.com>

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

Critical: 0 · High: 0 · Medium: 1 · 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] The cleanup in setup_macvlan()
  (tools/testing/selftests/drivers/net/hw/tls_hw_offload.py:839-840)…
- [Low] main()
  (tools/testing/selftests/drivers/net/hw/tls_hw_offload.py:883-887)…
- [Low] selftests: net: sysctl_set() duplicates ctl_file_write() and
  breaks on dots

--

selftests: net: test TLS fallback after rerouting to an upper device

This adds a TLS offload selftest case. It moves an established offloaded
connection onto a macvlan upper of the same NIC in the middle of the
echo, then checks that the resumed echo goes through the macvlan and
matches the original data. It also adds CONFIG_MACVLAN to the hw
selftest config.

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

[ ... ]

> +def setup_macvlan(cfg):
> +    """Add a macvlan upper on the DUT NIC for the rest of the case.
> +
> +    The peer may answer on either MAC, so set loose rp_filter on both.
> +    """
> +    ip(f"link add {MACVLAN_IFNAME} link {cfg.ifname} type macvlan "
> +       "mode bridge")
> +    # Runs after the delete: make the peer drop the macvlan's MAC.
> +    defer(ip, f"neigh flush to {cfg.addr_v['4']}", host=cfg.remote)
> +    defer(ip, f"link del {MACVLAN_IFNAME}")

[Severity: Medium]
Can this deferred remote flush stall or time out, given that it needs the
same path it is meant to repair?

reroute_macvlan() adds the /32 route through tlsmv0 with the DUT's source
address, then pings through it:

    ip(f"route add {peer}/32 dev {MACVLAN_IFNAME} src {cfg.addr_v['4']}")
    ...
    wait_reachable(MACVLAN_IFNAME, peer)

The macvlan then broadcasts an ARP request. The sender IP is the DUT's
IPv4 address and the sender MAC is the macvlan's. On the peer,
arp_process() handles it with:

    n = neigh_event_ns(tbl, sha, &sip, dev);

After that, the peer's entry for the DUT address points at the macvlan
MAC. The resumed echo and the SSH traffic keep that entry REACHABLE.

The defers run in reverse order: route del, the two rp_filter restores,
link del tlsmv0, and only then the remote neigh flush. Deleting the
macvlan removes its MAC from the NIC unicast filter. The peer, however,
keeps sending to that MAC.

The README.rst example uses REMOTE_ARGS=root@192.168.1.2 with
REMOTE_V4=192.168.1.2, so the SSH connection runs between the test
addresses. In that setup, the new ssh for the flush gets its SYN-ACKs
sent to the deleted MAC, and they are dropped. This lasts until
neighbour state recovers on its own, which can take tens of seconds.
cmd() has a 20s default timeout.

If this raises TimeoutExpired, ksft_flush_defer() sets
KSFT_RESULT=False. That fails a run in which the test itself passed. If
the ssh does succeed, the peer's entry has already been corrected, so
the flush has no effect.

There is also a second gap. Other hosts on the segment that already had
an entry for the DUT address are updated to the macvlan MAC by the same
broadcast request, through the "Update our ARP tables" path in
arp_process(). Nothing flushes those entries.

> +    sysctl_set(f"net.ipv4.conf.{cfg.ifname}.rp_filter", 2)
> +    sysctl_set(f"net.ipv4.conf.{MACVLAN_IFNAME}.rp_filter", 2)
> +    ip(f"link set dev {MACVLAN_IFNAME} up")
> +    wait_carrier(MACVLAN_IFNAME)

[Severity: Low]
Is there a reason not to use ctl_file_write() here?

tools/testing/selftests/net/lib/py/utils.py already provides it, and
drivers/net/hw/lib/py/__init__.py re-exports it for the hw tests. Its
docstring names sysctls as a target. It reads and writes the /proc/sys
file directly from Python, skips the write when the value is already
set, and defers restoring the old value. That is what sysctl_set()
reimplements.

The hand-rolled version also differs from it in two ways.

First, it runs the sysctl binary through cmd(), but the case never
calls cfg.require_cmd("sysctl"). On a minimal rootfs without procps,
this raises FileNotFoundError from setup_macvlan() instead of skipping.
check_tls_support() in this same file already handles a missing
modprobe, so that kind of environment looks expected here.

Second, setup_macvlan() builds the key with dots:
net.ipv4.conf.{cfg.ifname}.rp_filter. sysctl treats dots as path
separators. If cfg.ifname itself contains a dot, as a VLAN such as
eth0.100 does, the name is split in the wrong place and the lookup
fails with ENOENT. Passing
/proc/sys/net/ipv4/conf/<ifname>/rp_filter to ctl_file_write() avoids
both problems.

Minor: the rp_filter restore deferred for tlsmv0 does nothing useful.
The link del defer deletes the macvlan right after that restore runs.

[ ... ]

> @@ -800,6 +883,7 @@ def main() -> None:
>          # Flap the NIC last, so a slow retrain cannot fail later cases.
>          ksft_run([test_tls_offload, test_tls_offload_sizes,
>                    test_tls_offload_record_type, test_tls_offload_bond,
> +                  test_tls_offload_upper_reroute,
>                    test_tls_offload_bond_bounce], args=(cfg, ))

[Severity: Low]
Doesn't this placement go against the comment just above the list?

    # Flap the NIC last, so a slow retrain cannot fail later cases.

test_tls_offload_bond takes cfg.ifname down in setup_bond(). After that,
restore_nic() waits for carrier only as a best effort:

    # Best effort: the next case waits for carrier itself.

Before this patch, the next case was test_tls_offload_bond_bounce. Its
wait_bond_ready() waits for carrier and calls wait_reachable() for the
peer.

The new case waits for carrier only indirectly, through
wait_carrier(MACVLAN_IFNAME) in setup_macvlan(). It never checks that the
peer is reachable over cfg.ifname before run_tls_test() starts the first
half of the echo.

If reachability lags carrier after the bond case's flap, could the new
case fail for a reason that belongs to the previous case?

Would listing test_tls_offload_upper_reroute before test_tls_offload_bond
follow the documented order? The same placement is still there at the
end of the series, where test_tls_offload_frag is also inserted before
test_tls_offload_bond_bounce.

>      ksft_exit()
>

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

  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
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 [this message]
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=179651659216.3148.1788886959208565486@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