Article View: linux.kernel.netdev
Article #26351Re: [PATCH net-next v3] net: dsa: b53: mirror CPU-bound frames to port 5 when port 8 is unused
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 12:14
Date: Thu, 03 Dec 2026 12:14
148 lines
13646 bytes
13646 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
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] b53_setup_cpu_mirror() changes the hardware on every 531x5
part (BCM53101/53115/53125/53128/53134) whenever the CPU port is 5,…
- [Medium] The egress mirror only needs port 8 to transmit, but
b53_setup_cpu_mirror() writes PORT_CTRL(8) = PORT_CTRL_DIS_STATE,…
--
net: dsa: b53: mirror CPU-bound frames to port 5 when port 8 is unused
This sets up a CPU mirror on 531x5 switches when port 5 is the CPU port,
Broadcom tags are enabled and port 8 is unused in DT. Port 8 is enabled
with a forced link and its egress is mirrored to port 5. Frames to the
bridge group address entering user ports are also mirrored to port 5, and
tc mirror offload is refused while this is active.
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index ee2d27732c0c8..2b51036d5675f 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -745,6 +745,10 @@ void b53_disable_port(struct dsa_switch *ds, int port)
> struct b53_device *dev = ds->priv;
> u8 reg;
>
> + /* Port 8 carries frames for the CPU to the mirror */
> + if (port == B53_CPU_PORT && dev->cpu_mirror)
> + return;
> +
> /* Disable Tx/Rx for the port */
> b53_read8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), ®);
> reg |= PORT_CTRL_RX_DISABLE | PORT_CTRL_TX_DISABLE;
[ ... ]
> @@ -1326,6 +1330,65 @@ int b53_setup_devlink_resources(struct dsa_switch *ds)
[ ... ]
> +static int b53_setup_cpu_mirror(struct dsa_switch *ds)
> +{
> + struct b53_device *dev = ds->priv;
> + int ret;
> +
> + dev->cpu_mirror = false;
> + /* 531x5 only: SoC switches wire port 8 to a MAC, 539x is untested */
> + if (!is531x5(dev) || dev->tag_protocol == DSA_TAG_PROTO_NONE ||
> + ds->num_ports <= B53_CPU_PORT ||
> + !dsa_is_cpu_port(ds, B53_CPU_PORT_25) ||
> + !dsa_is_unused_port(ds, B53_CPU_PORT))
> + return 0;
[Severity: Medium]
This check covers every 531x5 part (BCM53101, 53115, 53125, 53128,
53134) whenever port 5 is the CPU port, tags are on and port 8 is not in
DT. Does "unused in DT" reliably mean that port 8 is physically
unconnected and can transmit with a forced link?
The commit message says this "relies on port 8 transmitting with nothing
attached, as it does on the test board", and that board is a single
BCM53125.
Further down, the link is forced to 1000M full duplex:
ret = b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
PORT_OVERRIDE_EN | PORT_OVERRIDE_SPEED_1000M |
PORT_OVERRIDE_FULL_DUPLEX | PORT_OVERRIDE_LINK);
Nothing here checks or programs the IMP interface mode or the
B53_RGMII_CTRL_IMP clocking. The only code that programs them is
b53_adjust_531x5_rgmii(), and phylink only calls it for a port that is in
use. On an unused port 8 they keep their strap or reset values.
Take a board where port 8 cannot transmit in that configuration, for
example an MII/RvMII-strapped IMP or one with no TX clock. Would any
mirror copy reach port 5 there, or would the trapped frames still be
lost?
On such a board, b53_mirror_add() still refuses every tc matchall mirror
with -EOPNOTSUPP. Hardware mirroring would be gone and nothing gained.
Now take a board where port 8 is wired to a MAC that the DT does not
describe. Would trapped frames now go out to that MAC?
Before this patch, b53_setup() disabled port 8 through
b53_disable_port(). Now b53_disable_port() returns early for port 8
whenever cpu_mirror is set.
Would an explicit opt-in or opt-out be better than turning this on for
the whole family?
> +
> + /* Rx/Tx on, STP disabled, no flood Rx: only trapped frames leave it */
> + ret = b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(B53_CPU_PORT),
> + PORT_CTRL_DIS_STATE);
[Severity: Medium]
The egress mirror only needs port 8 to transmit. This write also clears
PORT_CTRL_RX_DISABLE, and the link is forced up just after it. Does that
leave port 8 receiving as well?
Port 8's own PVLAN mask is never narrowed. b53_imp_vlan_setup() only ORs
BIT(cpu_port) into each port's mask:
b53_for_each_port(dev, i) {
b53_read16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), &pvlan);
pvlan |= BIT(cpu_port);
b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), pvlan);
}
As a result, port 8 keeps its reset default mask.
Port 8 is also in enabled_ports on 531x5: 0x1ff on 53125/53128 and 0x11f
on 53101/53115. So b53_setup() adds it to the default VLAN as an
untagged member:
b53_for_each_port(dev, port) {
vl->members |= BIT(port);
if (!b53_vlan_port_needs_forced_tagged(ds, port))
vl->untag |= BIT(port);
}
Suppose a device the DT does not describe is attached to port 8, and the
disabled STP state does not drop ingress on this port. Could frames from
that device be switched to the user ports? That would bypass standalone
isolation, where user port masks are only {self, CPU}.
That device would also receive copies of all CPU-trapped traffic from the
user ports.
Before this patch, b53_disable_port() set both RX and TX disable on port
8. Would it be enough for the egress mirror to keep PORT_CTRL_RX_DISABLE
set here along with PORT_CTRL_DIS_STATE?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-b53-bpdu-mirror-v3-1-3d82c0e0571f%40telaak.dev
Technical Details
Message-ID:
<179630004040.3146.11125368359194350098@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376576-linux-kernel-netdev=dewy.ruReferences:
<20261130-b53-bpdu-mirror-v3-1-3d82c0e0571f@telaak.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376576-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3] net: dsa: b53: mirror CPU-bound frames to port 5 when port 8 is unused Date: Thu, 03 Dec 2026 12:14:00 +0000 Organization: Usenet Network Message-ID: <179630004040.3146.11125368359194350098@kernel.org> References: <20261130-b53-bpdu-mirror-v3-1-3d82c0e0571f@telaak.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2483773"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LiIRR1WJuQUkL/gsAPl8iWHMuIU= sha256:MKqJzb2KN5SSosf4N+g19yDF5PQAvzXm42MO6sEiWEo= sha1:SdOMhdk+53Wynha3FoQ8lv1Nv2k= sha256:UNZE4IzZHKSnEBDVoHSOaVmUZI5/ryS0kIssQT/5d/4= 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 D2330117926; Thu, 3 Dec 2026 15:14:57 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.74 X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, 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 AloEXOyh5aqr; Thu, 3 Dec 2026 15:14:54 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376576-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 9A19D1178DD; Thu, 3 Dec 2026 15:14:46 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 351C060522D; Thu, 3 Dec 2026 12:14:46 +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=1796300042; b=G+aGT2H7m8OVthL7b8Jwg6jmod+jFwcbtQ9EPjFR1bJzeLJw/7WIoC/Tz/huY9b6YU+V wfj/rrFOJJB8NDgh5islhNHRejqWVvO58afKYmwPUNoEuTDaorALB4dTR8M/CiRT1lLN5 q6NXMZGxZr7zmmvYR6OUqVMsDWeGmnpE+B5GWRsWcDu+064tGkdg4x/x7G6sCyDSxXlAr vbsnxrAYUUWpwg2IvxZ0ug0ObrkDod/Mly8oq3/SY0Zes45yAxDprya9/K2vK4c8Ri1r0 xXnBCfWXQEVxBh8/ZFAE9LK3l9ZWlsqe9g9DOnNSk6GMwImyt6cJlLiZB8tZdfkr6Tg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300042; 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=VW2ezMBB/1laNoTmprT/JZvsonW0K8m3X8JM0LdMxTQ=; b=cIBoZFMm3hX+vaqDK5RBLdOzAxR4iGWkV/ZSTMCYMe+/C6UbWsiYoPKvZyg450XqTJ9S HWurTE/+kcbIU/HyJwfQnGQqHrhJE0bf5hLg/yu5/M5uOChH80cl5gRvQJ91zesAGUueF hEmRXxBpnYE0XslIg372M3svq9KjZ7E0idMsif4iZuJrcKbZqxkEbJCCn0sYJqZCEng4W KXlNEvpbnqDZBG9LyR78KKZ93x6OuDVdO7GdFEer9fELOQ7MXzWC0ZzmLBZJ9rDcLfGtd xieLiPcOC+X+jZ/b0aFEmurSnYoVQJw2naqLggaNJcLnwnilH541h7dUaSRvc1PHHQw== 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="ADuviW/5"; 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 D81F3606BE9B; Thu, 3 Dec 2026 12:14:02 +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=ADuviW/5 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=1796300042; b=UmDjkNLW0QJjrDupxxkoYnw0TIyH0JLRrbE4wyXEXVBt9qD2DQzfT71QWGX3u0rb7WCP YWffEUABNaVois9SXvA22FMcWDJvod8GxPkLfhPRs8zaZ53cWPpZCeB/b5R4nXjMkV25h MfvIEiARMc58Zn2NEcg15kyeFGCjGFIktAfbq+j713YDwntQWHs+YAQ8tcGx9FWlALbMR mxHakIZsKRq3dtTR/9R0OH5Wz3ivkPoCLYzXHZ/OXLLUcUOTsl/n8ANATRp9KqsyD25GA m3u5Kb/XBUvbtm9TKAGXMZQNG1rH9pbToubG399jchjMHB6b0f+OWo4c6fX/Fzn0vzA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300042; 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=VW2ezMBB/1laNoTmprT/JZvsonW0K8m3X8JM0LdMxTQ=; b=aro3UfCN2F3CMTXkfdypj+5zVaEawXBkK/RI/XOhbqSaxplu2xyT/RcCKalHqrVJ3Ocr VOEIakH7NKBYKzczjeTni4XJkESr13AL/BnHf2bRFbZp4xO15AT+n66ESair9JKb257Kf r+YezP2sbG31d6MSVfcTny/yLNMLieZvc37XMuiCjCRkkO1P4tjKOtAiaWVFllbAyJphI L0Jf6GyqpdArkEY5xMMwgo4lQEU3vJrthQyPVoWdvM/slJzyW05vTYOeferchtq6YfWyN Gy4Nwt1hcQjfqJr7c2pnXjytf/XndPO9SQgLJSg6tgKjoQXu9rL8J+zzbYwpLEdPadQ== 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="ADuviW/5"; 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 04618606BE85; Thu, 3 Dec 2026 12:14:01 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E01811F00893; Thu, 3 Dec 2026 12:14:00 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796300041; bh=VW2ezMBB/1laNoTmprT/JZvsonW0K8m3X8JM0LdMxTQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ADuviW/5V5Yfp6f8DP8Uu74qsUHgSOLiGFDb/MDwVEybyOcSMx5CBYtpLZIfOtZox EyACZjUKmHUwS6pWcmbjfVu7V/3xvBVzWreuhsddjTIYNhD4w7xCtta5x7XRKB0yqc JwuOv8Zt50VF7u2/WPHyAwv2Jz46ezekEoZFqk0PwDcgKoPs3cGrhDMs27wpD9z6eR wMAVIkoT17LXZKnjFm3Wvg8ut0gCIIDVS9nKuAmS/qYakIQuYv9fEzGIbvnZk0swpi pJXI+871/+br//UHQ+b3qeOO9fkqO9GOAB6PHRIfV6LEul+OQLN+qc/pbWMWgcLxyp y+pcRfCJUy3Yg== X-Cc: florian.fainelli@broadcom.com, jonas.gorski@gmail.com, andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261130-b53-bpdu-mirror-v3-1-3d82c0e0571f@telaak.dev> 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