Thread (22 messages) 22 messages, 3 authors, 2025-06-12
STALE375d REVIEWED: 15 (15M)
Revisions (4)
  1. rfc [diff vs current]
  2. v2 [diff vs current]
  3. v3 current
  4. v4 [diff vs current]

[PATCH net-next v3 10/14] net: dsa: b53: prevent BRCM_HDR access on older devices

From: Álvaro Fernández Rojas <hidden>
Date: 2025-06-12 08:38:05
Also in: lkml
Subsystem: broadcom b53/sf2 ethernet switch driver, networking drivers, networking [dsa], the rest · Maintainers: Florian Fainelli, Jonas Gorski, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Linus Torvalds

Older switches don't implement BRCM_HDR register so we should avoid
reading or writing it.

Fixes: b409a9efa183 ("net: dsa: b53: Move Broadcom header setup to b53")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Álvaro Fernández Rojas <redacted>
---
 drivers/net/dsa/b53/b53_common.c | 5 +++++
 1 file changed, 5 insertions(+)

 v3: add changes requested by Jonas:
  - Check for legacy tag protocols instead of is5325().

 v2: no changes
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 1ecadcd84a283..d082e5a851ab5 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -730,6 +730,11 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
 		hdr_ctl |= GC_FRM_MGMT_PORT_M;
 	b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl);
 
+	/* B53_BRCM_HDR not present on devices with legacy tags */
+	if (dev->tag_protocol == DSA_TAG_PROTO_BRCM_LEGACY ||
+	    dev->tag_protocol == DSA_TAG_PROTO_BRCM_LEGACY_FCS)
+		return;
+
 	/* Enable Broadcom tags for IMP port */
 	b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl);
 	if (tag_en)
-- 
2.39.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help