From: netdev-bot+sashiko@kernel.org
To: xiexinet@gmail.com
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, andrew+netdev@lunn.ch, shuah@kernel.org,
kees@kernel.org, petr.wozniak@gmail.com, qingfang.deng@linux.dev,
fmaurer@redhat.com, luka.gejak@linux.dev, bigeasy@linutronix.de,
xiaoliang.yang_1@nxp.com, skhawaja@google.com,
liuhangbin@gmail.com, stable@vger.kernel.org,
sdf.kernel@gmail.com, lukma@denx.de, fmancera@suse.de,
danishanwar@ti.com
Subject: Re: [PATCH net v9 4/4] selftests: net: hsr: verify GRO policy and ordered forwarding
Date: Mon, 16 Nov 2026 16:27:26 +0000 [thread overview]
Message-ID: <179484644688.3136.15525954898173827248@kernel.org> (raw)
In-Reply-To: <20261112153333.20-5-xiexinet@gmail.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
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 tcp_prp(), the check for 'no tag/RCT on local delivery' can
never fail.
- [Low] The commit message overstates what the second refusal group in
port_types() checks…
- [Low] In tcp_prp(), a Skip raised by verify_stream() bypasses the PRP
reply checks.
- [Low] Lab.close() closes every owned socket (lines 367-368) before it
joins the producer threads (lines 369-373).
--
selftests: net: hsr: verify GRO policy and ordered forwarding
This adds two HSR/PRP selftests, hsr_gro_superpacket.sh and
hsr_ordered_forwarding.sh. Both exec one shared Python helper. The gro
mode checks the member GRO policy, the refusal of unsupported port
types, and byte-exact TCP forwarding over an HSR interlink and over PRP
LANs. The ordered mode checks sequence ordering of local, interlink,
supervision and concurrent traffic, including a sequence wrap.
> diff --git a/tools/testing/selftests/net/hsr/hsr_gro_superpacket.py b/tools/testing/selftests/net/hsr/hsr_gro_superpacket.py
> new file mode 100755
> index 0000000000000..3548ee0adfae3
> --- /dev/null
> +++ b/tools/testing/selftests/net/hsr/hsr_gro_superpacket.py
> @@ -0,0 +1,1456 @@
[ ... ]
> + def close(self):
> + """Stop threads, close sockets and delete owned namespaces."""
> + self.stop.set()
> + end, errors = time.monotonic() + 20, []
> + for sock in self.sockets:
> + sock.close()
> + for thread in self.threads:
> + if thread.ident is not None:
> + thread.join(max(0, end - time.monotonic()))
> + if thread.is_alive():
> + errors.append("sender thread did not stop")
[Severity: Low]
This isn't a bug, but the docstring says "Stop threads, close sockets".
Lab.close() closes the sockets before it joins the producer threads
started by ordered_concurrent().
If a producer is still running here, its sendto() on the closed socket
gets EBADF. Its except (OSError, ValueError, RuntimeError) clause
catches that. The 1 second timeout from ordered_socket() and the
lab.stop check limit how long it can run. The main thread opens no new
fds until the join returns, so fd reuse does not look possible.
Would joining the threads before closing the sockets match the docstring
order?
[ ... ]
> + # A refused second port leaves the first port as it was.
> + for dev in ("w", "g"):
> + local_pair(lab, ns, dev)
> + set_gro(lab, ns, "p", "on")
> + set_gro(lab, ns, "g", "on")
> + first, second = link_state(lab, ns, "p"), []
[ ... ]
> + for kind, dev, error in second:
> + label = f"{kind} as slave2"
> + result = lab.ip(ns, "link", "add", "name", "hsr0", "type", "hsr",
> + "slave1", "p", "slave2", dev, "version", "1", check=False)
> + require(result.returncode != 0 and error in result.stderr,
> + f"{label}: missing refusal message: {result.stderr.strip()}")
> + require(lab.ip(ns, "link", "show", "dev", "hsr0", check=False).returncode,
> + label + ": HSR device left behind")
> + after = link_state(lab, ns, "p")
> + require("master" not in after and after["promiscuity"] == first["promiscuity"],
> + f"{label}: first port p changed by the refused attach")
> + gro_state(lab, ns, "p", "on", label + ": first port p")
> + refused.append(label)
[Severity: Low]
Does this second refusal group in port_types() check what the commit
message describes? The message says:
... and of a VRF port without leaving an upper link or a promiscuity
reference on any port ...
and:
... a device refused at attach keeps its request.
Only p is snapshotted here (first = link_state(lab, ns, "p")), and only
p is compared after each refused attach. The refused VRF port w and the
macvlan mvg have no baseline. Their promiscuity is never compared, and
the GRO state of mvg is never read back.
The first refusal group snapshots every candidate device in before and
checks each one again, so the two groups do not match. A leaked
promiscuity reference on w or mvg would still pass this case.
Should w and mvg also go into the before/after comparison?
[ ... ]
> +def tcp_prp(lab, row):
> + """TCP GSO from a SAN on one PRP LAN is delivered locally, segmented."""
[ ... ]
> + lab.cmd(tx, "ethtool", "-K", lower, "tso", "on", "gso", "on")
> + caps = [lab.capture(tx, lower, pkttype=4), lab.capture(dut, "pm", pkttype=0)]
[Severity: Medium]
Can the check for no tag/RCT on local delivery ever fail for this
capture?
The pm capture is opened with the default prp=False. decode() only
recognises a PRP RCT when prp is set:
elif prp and end >= off + 6 and raw[-2:] == b"\x88\xfb":
So every frame captured on pm decodes with tag=False and
encoding="plain". The TCP payload ends at the IPv4 total length, so 6
trailing RCT bytes are silently ignored.
verify_stream(..., local=True) then calls:
wire_rows(captures[1].rows, port, stack, tagged=False)
and this check in wire_rows() is always true here:
require(row["tag"] == tagged, "flow tag/RCT missing or unexpected")
The size limit does not catch it either. A 1514 byte segment plus a 6
byte RCT is exactly 1520, which passes
row["size"] <= 1520 + 4 * len(stack).
Suppose the PRP master delivered frames locally with the RCT still
attached. The IP stack would trim the trailer and TCP would still
complete, so this case would pass. The commit message says "Tags/RCT,
sequence numbers and VLAN stacks are checked".
Would opening the pm capture with prp=True make this check effective?
> + ingress = lab.capture(dut, "d" + side.lower(), prp=True)
> + lanes = [lab.capture(dut, dev, pkttype=4, prp=True) for dev in ("da", "db")]
> + payload, reply = tcp_transfer(lab, tx, dut, sender, "10.68.0.2", "10.68.0.1", 5201)
> + lab.finish(fin_seen(caps + lanes + [ingress], 5201))
> + verify_stream(caps, 5201, payload, stack, local=True, inband=inband, ingress=ingress)
[Severity: Low]
What happens to the PRP reply checks below when verify_stream() raises
Skip? verify_stream() ends with:
if not aggregate:
raise Skip("no sender GSO aggregate observed")
The comment above it says this gap is reported only "after transfer and
all other checks". In tcp_prp(), though, the reply checks run only after
verify_stream() returns: exactly once per LAN, RCT present, LAN id
10 + index, encoding "prp", identical copies. Nothing here catches
Skip, so main() prints "ok N - ... # SKIP".
When the sender capture shows no payload larger than 1500 bytes, a
missing, duplicated or wrongly tagged PRP reply would be reported as
SKIP, not FAIL. This seems to contradict "its reply must appear once on
each LAN" in the commit message.
Could the Skip be held back until the reply checks in tcp_prp() have
run?
> + copies = []
> + for index, cap in enumerate(lanes):
> + cap.validate()
> + rows = [frame for frame in cap.rows if frame["ports"] and
> + frame["ports"][0] == 5201 and frame["payload"]]
> + require(len(rows) == 1 and rows[0]["payload"] == reply,
> + "PRP reply not exactly once per LAN")
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112153333.20-1-xiexinet%40gmail.com
next prev parent reply other threads:[~2026-11-16 16:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 15:33 [PATCH net v9 0/4] net: hsr: fix super-packet forwarding Xin Xie
2026-11-12 15:33 ` [PATCH net v9 1/4] net: hsr: keep GRO disabled on HSR/PRP ports Xin Xie
2026-11-16 16:27 ` netdev-bot+sashiko
2026-11-12 15:33 ` [PATCH net v9 2/4] net: hsr: refuse forwarding devices as " Xin Xie
2026-11-16 16:27 ` netdev-bot+sashiko
2026-11-12 15:33 ` [PATCH net v9 3/4] net: hsr: segment GSO before per-frame forwarding Xin Xie
2026-11-15 21:41 ` Sebastian Andrzej Siewior
2026-11-16 9:06 ` Xin Xie
2026-11-12 15:33 ` [PATCH net v9 4/4] selftests: net: hsr: verify GRO policy and ordered forwarding Xin Xie
2026-11-16 16:27 ` netdev-bot+sashiko [this message]
2026-11-13 16:38 ` [PATCH net v9 0/4] net: hsr: fix super-packet forwarding Sebastian Andrzej Siewior
2026-11-15 21:45 ` Sebastian Andrzej Siewior
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=179484644688.3136.15525954898173827248@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fmancera@suse.de \
--cc=fmaurer@redhat.com \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=luka.gejak@linux.dev \
--cc=lukma@denx.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petr.wozniak@gmail.com \
--cc=qingfang.deng@linux.dev \
--cc=sdf.kernel@gmail.com \
--cc=shuah@kernel.org \
--cc=skhawaja@google.com \
--cc=stable@vger.kernel.org \
--cc=xiaoliang.yang_1@nxp.com \
--cc=xiexinet@gmail.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