From: "Rafał Miłecki" <zajec5@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Jonas Gorski <jonas.gorski@gmail.com>
Cc: netdev@vger.kernel.org, "Rosen Penev" <rosenp@gmail.com>,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: [PATCH net-next V5] net: dsa: b53: prefer CPU port 8 when available
Date: Thu, 3 Dec 2026 08:46:27 +0100 [thread overview]
Message-ID: <20261203074627.15461-1-zajec5@gmail.com> (raw)
From: Rafał Miłecki <rafal@milecki.pl>
Port 8 allows using all switch features as in opposite to ports 5 and 7.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V5: Prefer port 8 for all devices except BCM5325/5365 (not just Northstar)
V4: Add check for NULL pointer
drivers/net/dsa/b53/b53_common.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index ee2d27732c0c..da78185fec11 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -758,6 +758,34 @@ void b53_disable_port(struct dsa_switch *ds, int port)
}
EXPORT_SYMBOL(b53_disable_port);
+static struct dsa_port *b53_preferred_default_local_cpu_port(struct dsa_switch *ds)
+{
+ struct b53_device *dev = ds->priv;
+ struct dsa_port *cpu_dp;
+
+ /* BCM5325/5365 only have CPU port 5 (port 8 is an alias) */
+ if (is5325(dev) || is5365(dev))
+ return NULL;
+
+ /*
+ * Most devices have 3 CPU ports: 5 (IMP1), 7, 8 (IMP0). They are
+ * connected to separated Ethernet controllers. This design allows e.g.
+ * dual IMP setups where WAN traffic goes to port 5 and LAN traffic goes
+ * to port 8.
+ *
+ * Port 8 (IMP0) is the fully featured CPU port. Ports 5 and 7 support
+ * Broadcom header but don't support features that relay on trapping to
+ * CPU (e.g. EAP, STP).
+ *
+ * Prefer CPU port 8 if available.
+ */
+ cpu_dp = dsa_to_port(ds, B53_CPU_PORT);
+ if (cpu_dp && dsa_port_is_cpu(cpu_dp))
+ return cpu_dp;
+
+ return NULL;
+}
+
void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
{
struct b53_device *dev = ds->priv;
@@ -2903,6 +2931,7 @@ static const struct dsa_switch_ops b53_switch_ops = {
.port_setup = b53_setup_port,
.port_enable = b53_enable_port,
.port_disable = b53_disable_port,
+ .preferred_default_local_cpu_port = b53_preferred_default_local_cpu_port,
.support_eee = b53_support_eee,
.set_mac_eee = b53_set_mac_eee,
.set_ageing_time = b53_set_ageing_time,
--
2.51.0
next reply other threads:[~2026-12-03 7:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 7:46 Rafał Miłecki [this message]
2026-12-03 9:03 ` [PATCH net-next V5] net: dsa: b53: prefer CPU port 8 when available Jonas Gorski
2026-12-04 7:47 ` 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=20261203074627.15461-1-zajec5@gmail.com \
--to=zajec5@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=jonas.gorski@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=rafal@milecki.pl \
--cc=rosenp@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.