From: netdev-bot+sashiko@kernel.org
To: bigeasy@linutronix.de
Cc: netdev@vger.kernel.org, j-rameshbabu@ti.com,
andrew+netdev@lunn.ch, danishanwar@ti.com, d-qiu@ti.com,
davem@davemloft.net, fmaurer@redhat.com, kuba@kernel.org,
neelima@ti.com, pabeni@redhat.com, praneeth@ti.com,
pratheesh@ti.com, richardcochran@gmail.com, horms@kernel.org,
vigneshr@ti.com, willemdebruijn.kernel@gmail.com,
daniel.machon@microchip.com, edumazet@kernel.org
Subject: Re: [PATCH net-next v13 8/8] selftests: hsr: Add test for the inline PTP header on HSR
Date: Tue, 01 Dec 2026 08:55:33 +0000 [thread overview]
Message-ID: <179611533353.3146.6294208363158546982@kernel.org> (raw)
In-Reply-To: <20261130-hsr_ptp-v13-8-598326208fc5@linutronix.de>
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] hsr_ptp.sh starts `ip netns exec $ns1 ./hsr_ptp_test` (line
90) right after setup_hsr_interfaces() runs its last `ip link set ...…
- [Low] The file header comment of
tools/testing/selftests/net/hsr/hsr_ptp_test.c (lines 5-7) says the…
- [Low] hsr_ptp_test only works on HSRv1 devices, but neither the commit
message ("This test needs a HSR device and the two slave devices…
--
selftests: hsr: Add test for the inline PTP header on HSR
This commit adds a selftest for the inline header that the HSR stack
accepts with ether type ETH_P_1588. The hsr_ptp_test binary sends four PTP
frames through the HSR master, with and without a caller-supplied HSR
header, and checks that each one only appears on the requested slave port.
The hsr_ptp.sh wrapper sets up three HSRv1 nodes and runs the binary in
each namespace.
> diff --git a/tools/testing/selftests/net/hsr/hsr_ptp.sh b/tools/testing/selftests/net/hsr/hsr_ptp.sh
> new file mode 100755
> index 0000000000000..5fd3c5cd7a1cf
> --- /dev/null
> +++ b/tools/testing/selftests/net/hsr/hsr_ptp.sh
> @@ -0,0 +1,110 @@
[ ... ]
> + ip -net "$ns3" link set ns3eth1 up
> + ip -net "$ns3" link set ns3eth2 up
> + ip -net "$ns3" link set hsr3 up
> +}
> +
> +run_ptp_hdr_tests()
> +{
> + echo "INFO: Running PTP-header tests."
> +
> + ip netns exec "$ns1" ./hsr_ptp_test -H hsr1 -A ns1eth1 -B ns1eth2
> + ret=$?
> + stop_if_error "PTP header test failed (ns1)."
[ ... ]
> +check_prerequisites
> +trap cleanup_all_ns EXIT
> +
> +setup_ns ns1 ns2 ns3
> +setup_hsr_interfaces 1
> +run_ptp_hdr_tests
[Severity: Medium]
Can the first hsr_ptp_test run send its frame before the links are fully
active?
run_ptp_hdr_tests() starts right after the last "ip link set ... up" in
setup_hsr_interfaces(), and nothing waits in between. hsr_ping.sh,
hsr_redbox.sh, hsr_prp_redbox.sh and link_faults.sh all sleep or wait after
setup.
When a veth peer comes up, the other side gets carrier through the
asynchronous linkwatch work. Until linkwatch calls dev_activate(), that
device's TX queue is still on noop_qdisc:
net/sched/sch_generic.c:dev_activate() {
...
if (!netif_carrier_ok(dev))
/* Delay activation until next carrier-on event */
return;
...
}
The hsr master's carrier also only follows the slave operstate, which
linkwatch sets.
If pkt_send() runs inside that window, noop_enqueue drops the frame on
either hsrN or the slave. send() still succeeds, because NET_XMIT_CN maps
to 0 and hsr_dev_xmit() returns NETDEV_TX_OK. raw_recv() then times out
after 100ms, and recv_verify() reports "Missing packet on portA" or
"Missing packet on portB".
Would it make sense to wait for carrier/operstate on the hsr and slave
devices before running the test, as the other scripts here do?
> diff --git a/tools/testing/selftests/net/hsr/hsr_ptp_test.c b/tools/testing/selftests/net/hsr/hsr_ptp_test.c
> new file mode 100644
> index 0000000000000..e2c2da56138ae
> --- /dev/null
> +++ b/tools/testing/selftests/net/hsr/hsr_ptp_test.c
> @@ -0,0 +1,496 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Simple test to verify the usage of the inline header used for HSR with
> + * ether type ETH_P_1588.
> + * The inline header has to be stripped, the sent packet must only appear on the
> + * specified port and the interface needs to accept a foreign HSR header and
> + * prepend its own header.
[Severity: Low]
Is "prepend its own header" accurate?
hsr_forward_do() clones a frame that has has_hsr_header set and sends it
out unchanged:
net/hsr/hsr_forward.c:hsr_forward_do() {
...
/* If this TX frame already has a HSR header then forward the
* frame with it and don't add one.
*/
if (frame->has_hsr_header && frame->skb_std) {
skb = skb_clone(frame->skb_std, GFP_ATOMIC);
...
goto inject_into_stack;
}
...
}
This path skips create_tagged_frame(), and hsr_xmit() also skips address
substitution when has_hsr_header is set.
The fwd_hsr checks in raw_recv() agree with the kernel, not with this
comment. They expect the caller's sequence number, the caller's flipped
source MAC and encap_type == ETH_P_1588 to come through unchanged.
Could the comment say that a supplied HSR header is forwarded as-is?
[ ... ]
> + /* Assuming it is *our* network and nobody but the test here sends
> + * packets to p2p_dst_mac. Therefore any received packet needs to be
> + * ours and every mismatch is considered as error.
> + */
> + if (memcmp(hsr_hdr->dst, p2p_dst_mac, MAC_LEN))
> + goto again;
> +
> + if (hsr_hdr->type != htons(ETH_P_HSR)) {
> + printf("Error: Unexpected ether type: 0x%x\n", ntohs(hsr_hdr->type));
> + return -1;
> + }
[Severity: Low]
Would this check fail on an HSRv0 device that is working correctly?
For version 0, hsr_fill_tag() tags frames with ETH_P_PRP:
net/hsr/hsr_forward.c:hsr_fill_tag() {
...
hsr_ethhdr->ethhdr.h_proto = htons(proto_version ?
ETH_P_HSR : ETH_P_PRP);
...
}
On v0, the no-hsr-header subtests would then print "Unexpected ether type:
0x88fb" and fail. hsr_dev_xmit() and hsr_ptp_parse_header() don't check the
protocol version, so the inline header path is reachable on HSRv0 too.
The commit message ("This test needs a HSR device and the two slave devices
passed") and the usage text don't say that only HSRv1 is supported.
hsr_ptp.sh keeps the "# HSRv0/1" comment and the HSRv parameter of
setup_hsr_interfaces(), but it only calls:
setup_hsr_interfaces 1
so the v0 inline header path is never tested.
Should the test accept ETH_P_PRP on v0 and loop over both versions like
hsr_ping.sh does? Otherwise, could the HSRv1-only assumption be documented?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-hsr_ptp-v13-0-598326208fc5%40linutronix.de
prev parent reply other threads:[~2026-12-01 8:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 8:52 [PATCH net-next v13 0/8] hsr: Allow to send packets on specific port and pass the timestamp Sebastian Andrzej Siewior
2026-11-30 8:52 ` [PATCH net-next v13 1/8] hsr: Add header_ops::parse_protocol Sebastian Andrzej Siewior
2026-11-30 8:52 ` [PATCH net-next v13 2/8] hsr: Use skb_clone() while adding the HSR header Sebastian Andrzej Siewior
2026-12-01 8:55 ` netdev-bot+sashiko
2026-11-30 8:52 ` [PATCH net-next v13 3/8] hsr: Add a magic header for sending PTP packets Sebastian Andrzej Siewior
2026-12-01 8:55 ` netdev-bot+sashiko
2026-11-30 8:52 ` [PATCH net-next v13 4/8] hsr: Drop received " Sebastian Andrzej Siewior
2026-12-01 8:55 ` netdev-bot+sashiko
2026-11-30 8:52 ` [PATCH net-next v13 5/8] hsr: Use the port and header information in hsr_forward_skb() Sebastian Andrzej Siewior
2026-12-01 8:55 ` netdev-bot+sashiko
2026-11-30 8:52 ` [PATCH net-next v13 6/8] hsr: Assign a socket for cloned skbs Sebastian Andrzej Siewior
2026-12-01 8:55 ` netdev-bot+sashiko
2026-11-30 8:52 ` [PATCH net-next v13 7/8] hsr: Move struct hsr_ethhdr to a global header Sebastian Andrzej Siewior
2026-11-30 8:52 ` [PATCH net-next v13 8/8] selftests: hsr: Add test for the inline PTP header on HSR Sebastian Andrzej Siewior
2026-12-01 8:55 ` netdev-bot+sashiko [this message]
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=179611533353.3146.6294208363158546982@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=d-qiu@ti.com \
--cc=daniel.machon@microchip.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fmaurer@redhat.com \
--cc=horms@kernel.org \
--cc=j-rameshbabu@ti.com \
--cc=kuba@kernel.org \
--cc=neelima@ti.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=praneeth@ti.com \
--cc=pratheesh@ti.com \
--cc=richardcochran@gmail.com \
--cc=vigneshr@ti.com \
--cc=willemdebruijn.kernel@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