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 v11 5/8] hsr: Use the port and header information in hsr_forward_skb()
Date: Tue, 24 Nov 2026 11:25:43 +0000 [thread overview]
Message-ID: <179551954393.3135.14245872279309105973@kernel.org> (raw)
In-Reply-To: <20261120-hsr_ptp-v11-5-264c88f4f1d0@linutronix.de>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
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 new path "is only used in the pure
software version" and that NETIF_F_HW_* offload "need[s] to be…
- [Low] The has_hsr_header semantics added by this patch are implemented
for HSR only, not PRP.
--
hsr: Use the port and header information in hsr_forward_skb()
This commit makes hsr_forward_skb() honour a TX port requested by the
upper layer and a flag saying the frame already carries an HSR header.
Frames that already have a header are cloned and sent unchanged on the
requested port. They skip sequence number assignment, source address
substitution and the node_db lookup.
> diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
> index f49d962337f8b..1d1d75ed8cd06 100644
> --- a/net/hsr/hsr_forward.c
> +++ b/net/hsr/hsr_forward.c
[ ... ]
> @@ -570,6 +571,20 @@ static void hsr_forward_do(struct hsr_frame_info *frame)
> if ((port->dev->features & NETIF_F_HW_HSR_DUP) && sent)
> continue;
>
> + /* If this frame has a specific outgoing port specified (by the
> + * sender) then send it on this port only.
> + */
> + if (frame->req_tx_port != HSR_PT_NONE &&
> + frame->req_tx_port != port->type)
> + continue;
> + /* 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;
> + }
> +
[Severity: Medium]
The commit message says:
This is only used in the pure software version. Hardware with any kind
of NETIF_F_HW_* offload support need to be addressed separately.
Does anything in the code actually limit this to software?
hsr_dev_xmit() accepts the inline header for ETH_P_1588 frames on any HSR
device. Neither the req_tx_port filter nor the has_hsr_header shortcut
here checks port->dev->features.
When a slave has NETIF_F_HW_HSR_DUP (ksz9477 and xrs700x through DSA),
software sends one clone to the requested port only. However,
dsa_xmit_port_mask() in net/dsa/tag.h ORs every HSR member port into the
TX mask:
if (IS_ENABLED(CONFIG_HSR) &&
unlikely(dev->features & NETIF_F_HW_HSR_DUP)) {
...
dsa_hsr_foreach_port(other_dp, dp->ds, hsr_dev)
mask |= BIT(other_dp->index);
}
icssg also switches to PRUETH_UNDIRECTED_PKT_DST_TAG in that mode.
Wouldn't a PTP frame meant for one ring port then go out on both?
For NETIF_F_HW_HSR_TAG_INS (xrs700x, icssg), hsr_create_tagged_frame()
hands these devices untagged frames so the hardware can insert the tag:
if (port->dev->features & NETIF_F_HW_HSR_TAG_INS)
return skb;
The shortcut above passes a clone of the already tagged skb_std straight
to the slave. icssg sets PRUETH_UNDIRECTED_PKT_TAG_INS whenever it is in
HSR offload mode.
Could the frame then get a second tag and lose the sequence number that
the commit says must be preserved?
The later commit "hsr: Move struct hsr_ethhdr to a global header" says
drivers will need to inspect the header and suppress offloading. No
driver in the series does that, so these requests are accepted and then
mishandled without any error.
Should hsr_dev_xmit() reject inline header requests when a slave has
NETIF_F_HW_HSR_* features set?
As a side note, skb_hsr frames from the master in hsr_create_tagged_frame()
already skip the TAG_INS check, so that part is pre-existing behaviour.
[ ... ]
> @@ -661,6 +677,13 @@ int hsr_fill_frame_info(__be16 proto, struct sk_buff *skb,
> struct hsr_port *port = frame->port_rcv;
> struct hsr_priv *hsr = port->hsr;
>
> + if (frame->has_hsr_header) {
> + frame->skb_std = skb;
> +
> + WARN_ON_ONCE(port->type != HSR_PT_MASTER);
> + WARN_ON_ONCE(skb->mac_len < sizeof(struct hsr_ethhdr));
> + return 0;
> + }
[Severity: Low]
This early return exists only in hsr_fill_frame_info(). On a PRP device,
proto_ops->fill_frame_info is prp_fill_frame_info(), and that function
ignores has_hsr_header.
hsr_ptp_parse_header() in net/hsr/hsr_device.c doesn't check
hsr->prot_version either. It also adds HSR_HLEN to the header length,
although PRP frames have no HSR tag.
What is supposed to happen to a PRP frame with has_hsr_header set?
Without a valid RCT, handle_std_frame() still takes a sequence number:
frame->sequence_nr = hsr->sequence_nr;
WRITE_ONCE(hsr->sequence_nr, hsr->sequence_nr + 1);
The frame is then sent unchanged through the skb_std shortcut in
hsr_forward_do(). The counter still advances, which leaves gaps in the
sequence numbers.
With a valid RCT, skb_std stays NULL, so this check in hsr_forward_do()
is false:
if (frame->has_hsr_header && frame->skb_std) {
The frame then goes down the normal register_frame_out, drop_frame and
prp_create_tagged_frame() path with node_src still NULL.
prp_set_lan_id() then rewrites the trailer the user supplied.
A NULL dereference of node_src seems to be avoided only by accident:
- prp_register_frame_out() returns early because port_rcv is
HSR_PT_MASTER.
- req_tx_port limits egress to HSR_PT_SLAVE_A/B, so
hsr_handle_sup_frame() isn't reached.
- hsr_xmit() now skips hsr_addr_subst_dest().
The later commit "hsr: Assign a socket for cloned skbs" says PRP is not
considered, but the parser still accepts the flag on PRP devices. Should
hsr_ptp_parse_header() reject has_hsr_header on PRP, or should
prp_fill_frame_info() get a matching branch?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-hsr_ptp-v11-0-264c88f4f1d0%40linutronix.de
next prev parent reply other threads:[~2026-11-24 11:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 10:16 [PATCH net-next v11 0/8] hsr: Allow to send packets on specific port and pass the timestamp Sebastian Andrzej Siewior
2026-11-20 10:16 ` [PATCH net-next v11 1/8] hsr: Add header_ops::parse_protocol Sebastian Andrzej Siewior
2026-11-20 10:16 ` [PATCH net-next v11 2/8] hsr: Use skb_clone() while adding the HSR header Sebastian Andrzej Siewior
2026-11-20 10:16 ` [PATCH net-next v11 3/8] hsr: Add a magic header for sending PTP packets Sebastian Andrzej Siewior
2026-11-20 12:56 ` Daniel Machon
2026-11-24 11:25 ` netdev-bot+sashiko
2026-11-20 10:17 ` [PATCH net-next v11 4/8] hsr: Drop received " Sebastian Andrzej Siewior
2026-11-24 11:25 ` netdev-bot+sashiko
2026-11-20 10:17 ` [PATCH net-next v11 5/8] hsr: Use the port and header information in hsr_forward_skb() Sebastian Andrzej Siewior
2026-11-20 12:57 ` Daniel Machon
2026-11-24 11:25 ` netdev-bot+sashiko [this message]
2026-11-20 10:17 ` [PATCH net-next v11 6/8] hsr: Assign a socket for cloned skbs Sebastian Andrzej Siewior
2026-11-24 11:25 ` netdev-bot+sashiko
2026-11-20 10:17 ` [PATCH net-next v11 7/8] hsr: Move struct hsr_ethhdr to a global header Sebastian Andrzej Siewior
2026-11-20 10:17 ` [PATCH net-next v11 8/8] selftests: hsr: Add test for the inline PTP header on HSR Sebastian Andrzej Siewior
2026-11-24 11:25 ` 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=179551954393.3135.14245872279309105973@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