Article View: linux.kernel.netdev
Article #25097Re: [PATCH net-next v13 5/8] hsr: Use the port and header information in hsr_forward_skb()
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 08:55
Date: Tue, 01 Dec 2026 08:55
164 lines
13712 bytes
13712 bytes
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 new req_tx_port / has_hsr_header TX semantics are
implemented only in the software HSR path.
- [Low] fill_frame_info() now skips hsr_get_node() whenever
has_hsr_header is set, whatever the protocol, so frame->node_src stays…
--
hsr: Use the port and header information in hsr_forward_skb()
With this commit, hsr_forward_skb() honours a TX port and an existing HSR
header supplied by the upper layer. When a header is present, it skips
sequence number assignment, h_source replacement and the node_db lookup,
then clones the frame and sends it as is.
> 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". Is that limit enforced anywhere?
hsr_dev_xmit()->hsr_ptp_parse_header() accepts the inline header on any
hsr device. It does not check the slave port features or
hsr->fwd_offloaded.
With NETIF_F_HW_HSR_TAG_INS (xrs700x, TI ICSSG in HSR offload mode), this
shortcut skips hsr_create_tagged_frame(). That is the only place that
checks the flag:
net/hsr/hsr_forward.c:hsr_create_tagged_frame() {
...
if (port->dev->features & NETIF_F_HW_HSR_TAG_INS)
return skb;
...
}
The already-tagged clone then goes to dev_queue_xmit(). ICSSG sets
PRUETH_UNDIRECTED_PKT_TAG_INS on every TX frame when TAG_INS is enabled.
Would the hardware add a second HSR tag with its own sequence number?
That would also lose the original sequence number that this commit
wants to preserve.
With NETIF_F_HW_HSR_DUP (ksz9477, xrs700x, ICSSG, and DSA switches that
use dsa_port_simple_hsr_join()), the req_tx_port check only chooses which
software port gets the skb. dsa_xmit_port_mask() still adds every HSR
port of the switch to the mask:
net/dsa/tag.h:dsa_xmit_port_mask() {
...
if (IS_ENABLED(CONFIG_HSR) &&
unlikely(dev->features & NETIF_F_HW_HSR_DUP)) {
struct net_device *hsr_dev = dp->hsr_dev;
struct dsa_port *other_dp;
dsa_hsr_foreach_port(other_dp, dp->ds, hsr_dev)
mask |= BIT(other_dp->index);
}
...
}
ICSSG uses PRUETH_UNDIRECTED_PKT_DST_TAG in the same situation. Wouldn't
a per-port PTP message such as Pdelay_Req still go out on both ring
ports?
Should these requests be rejected, or the flags ignored, when the slave
ports have HSR offload features?
[ ... ]
> @@ -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]
Only the HSR implementation of proto_ops->fill_frame_info() looks at
frame->has_hsr_header. What happens on a PRP_V1 device?
hsr_ptp_parse_header() accepts has_hsr_header = 1 without checking
hsr->prot_version. fill_frame_info() then skips hsr_get_node() for every
protocol, so frame->node_src stays NULL. prp_fill_frame_info() ignores
the flag:
net/hsr/hsr_forward.c:prp_fill_frame_info() {
struct prp_rct *rct = skb_get_PRP_rct(skb);
if (rct &&
prp_check_lsdu_size(skb, rct, frame->is_supervision)) {
...
frame->skb_std = NULL;
frame->skb_prp = skb;
...
}
handle_std_frame(skb, frame);
...
}
Usually the frame goes through handle_std_frame(), which takes and
increments hsr->sequence_nr. The has_hsr_header clone shortcut in
hsr_forward_do() then sends the frame unchanged.
Doesn't that contradict "we don't want to assign a sequence number to
it"? It also leaves a gap in the PRP sequence.
If the payload happens to end in something skb_get_PRP_rct() accepts,
the frame is classified as skb_prp with skb_std == NULL. The
"has_hsr_header && skb_std" shortcut then doesn't fire. The frame takes
the normal prp_create_tagged_frame() path with node_src == NULL, and
prp_set_lan_id() rewrites the RCT.
This doesn't crash today: prp_register_frame_out() returns early for
frames from the master port, and the PRP drop and tag helpers don't use
node_src.
Should has_hsr_header be rejected on PRP devices, or handled the same
way in prp_fill_frame_info()?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-hsr_ptp-v13-0-598326208fc5%40linutronix.de
Technical Details
Message-ID:
<179611532994.3146.16083901140596742462@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374866-linux-kernel-netdev=dewy.ruReferences:
<20261130-hsr_ptp-v13-5-598326208fc5@linutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374866-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v13 5/8] hsr: Use the port and header information in hsr_forward_skb() Date: Tue, 01 Dec 2026 08:55:29 +0000 Organization: Usenet Network Message-ID: <179611532994.3146.16083901140596742462@kernel.org> References: <20261130-hsr_ptp-v13-5-598326208fc5@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1665883"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:TVWamiw/6tVx6jK89c27ELqcyV4= sha256:BVQeEb2njH5eOyonGs6Lj4orxJb9NXLtEtaccML+5Hk= sha1:am6yDbXiObQpJ7qivHSIKIlTw28= sha256:qPzlwhsOdEaRTP3Q4Yqm81W+KS/LbfxfDORCO7RGP58= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id DF55E1172E3; Tue, 1 Dec 2026 11:55:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ur0sq4QncKNa; Tue, 1 Dec 2026 11:55:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374866-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 140361172DD; Tue, 1 Dec 2026 11:55:34 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id C930325A87; Tue, 1 Dec 2026 08:55:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796115332; b=R2thYEh3rujyeDCBkmElI2f8kQQJMy9BGBwrLF2qnUpDes383Nc5Sh/VL57h2UWIPxix 9boNkt0ZLmMuHOgTaxblwsPeMoC7992+o9RGnOwXhEWKu404Uj2qW6p/nQl0QVePbe9IL dSprbPF2TBU0DIckRGHTLwObMN3QJRlybjXDMhcmXeBbw/XztAE5SUCvlr9Vk877tshRr PBT1IU8qOVccyMoKEiQetx+YeN3PZ7F489RW7rXttvMucydOymj9125+qXJnNAMBFu+Gp ga5o245X/SzPYlsTDZV/Nfijk8QmaszoV9ltC7evSz401urvPWNeCLgHRxX8R8om9YQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796115332; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=1F0awZKSCBVMEO4H+I2U9bVp8i/q2c+6zaADEPejGOU=; b=wW0oBKWcet6fytWFel1yDf4YEMywbdFE+hNgaRNPxdzJ4xjX4/iNwSL7Tt1bwvx6nrNi rrOL/WmDHuXJPrzMwH3ZB/0x7h4mRWlA81e999A2VdAQwWgKZlmB2GK164HjcwcMxg+YI iHG04Lz9tMwr3zi70ywcyjVqRWUUG3QMPeq/R7GnD6HkwsF2Vc6fyw2B7/xj8AdPbFwyn elbR2ozVG0FY4RR6vWtrM8IkXlMgkf45bb410Zt/F5R9bymtEoS0l4dLnUMrNQOAC8eX5 zocpU6biZ5obvjWKZHDi7JQlg30vHvPKNLqF/XXF+R5kcnob1lOEZ/ctUB8oeo8kWAA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="WGR1n/9E"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DDDE606A325; Tue, 1 Dec 2026 08:55:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WGR1n/9E X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796115331; b=Ugtca2X+De+VAPDqI5CTHYcwsUCvENPexC7LhbajUJZKMCZcRa9bC04p8VVK5E+whXc7 ShkNcgwwuK36X21AdGyr8too0PqH0VbtFZqdbnaw5peUBmri7RYa9Lcoh92OBXNSuSCm0 g9J9JHVaEXv6Pun9NoEedMh3Iwy5cX+R8u0ltnxVY9704HUP05hLF6u0/qZg1wh2fPyMf CNMAfbepU/o8VPVm5IfVti3XcRywAwQa+TxyVy95EAchxd6f9dn9ytoViDPr30hwq0bQI ++QsCtX15SC0NBsSK276zxOqgSxcefrtYBsiuLvvRGxu7ygFIYCX780A3JV3uzg41xw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796115331; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=1F0awZKSCBVMEO4H+I2U9bVp8i/q2c+6zaADEPejGOU=; b=ILvVKbchw/l2n/M5klmXzeoojOL0ca1koWvd21uB5UUZYnzgSEiXi5rUbs6edWKCbhFA GwiKLCqivNz9jiTSXQNW7cZp/Xgj6vM+pe1cWe+py3BMO7146+xwqeoXnqN5QNc66S3J9 9pB7CapSeNEAd+dzBd0x/KELYuqGkoghszgiJQwmWx6Y4OkUAvaPWLKn67+2SwgJW/D5U iaPVneQ5S3BIkWgbwrLs72fdPgwEreOdA2brTAlIwi9tCaixPJ5hAuWV2VcQ7hQnf40FM o/C7IdiKQ00Y4Xbeqi37bIFz5b8jw7vmP+vsed6sS4thVp9DoaHsxZFs7LoboxTR44g== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="WGR1n/9E"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF179606A320 for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 08:55:31 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AAE61F000C1; Tue, 1 Dec 2026 08:55:30 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796115331; bh=1F0awZKSCBVMEO4H+I2U9bVp8i/q2c+6zaADEPejGOU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=WGR1n/9EicL0aC1c9DYjs6T7aAl6SdzicxfjBV35efLpgBOHZcvqkR/a3+Fc/AwQP WO8Xesvqpbcjlm944zzLG8Uvebmxi9gEmsBYCg2zcZ050d9Xpg3S1BK5nWnOTa9H70 5SDl+DZSCMm84zOSmaFU5pLQTPmmVKk8cD2a5caBJtT62TCQOmwXZCkVfaM2NUiKLI jh+pRPl4s3K1QUDhD9Z8vcfez6FWg4XW91vfyDU+VqL16EDvVXXnZHdTYbVfqMRAFI Zu0/DyKmungRH0qovJNtLkcO9FJUo/STz3ZpRYxDL5Tm74LRBxhn4D5IqPTO2UOpfO ff/ZrGUW7CZkA== X-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 X-In-Reply-To: <20261130-hsr_ptp-v13-5-598326208fc5@linutronix.de> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list