* [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices
@ 2026-12-02 10:34 Rafał Miłecki
2026-12-02 20:13 ` Florian Fainelli
2026-12-03 10:35 ` netdev-bot+sashiko
0 siblings, 2 replies; 5+ messages in thread
From: Rafał Miłecki @ 2026-12-02 10:34 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, Vladimir Oltean, Florian Fainelli, Jonas Gorski
Cc: netdev, Rosen Penev, Rafał Miłecki
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>
---
V4: Add check for NULL pointer
drivers/net/dsa/b53/b53_common.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index ee2d27732c0c..53625090131e 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -758,6 +758,32 @@ 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;
+
+ /*
+ * Northstar SoCs devices have 3 Ethernet controllers and 3 CPU ports:
+ * 5 (IMP1), 7, 8 (IMP0). This design was meant for dual IMP setups when
+ * WAN traffic goes to port 5 and LAN traffic goes to port 8.
+ *
+ * While all 3 ports support Broadcom header, ports 5 and 7 have their
+ * limitations. Features that relay on trapping to CPU (e.g. EAP, STP)
+ * won't work when using those as CPU ones.
+ *
+ * Prefer CPU port 8 if available.
+ */
+ if (is5301x(dev)) {
+ 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 +2929,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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices
2026-12-02 10:34 [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices Rafał Miłecki
@ 2026-12-02 20:13 ` Florian Fainelli
2026-12-02 20:32 ` Rafał Miłecki
2026-12-03 10:35 ` netdev-bot+sashiko
1 sibling, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2026-12-02 20:13 UTC (permalink / raw)
To: Rafał Miłecki, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, Vladimir Oltean,
Jonas Gorski
Cc: netdev, Rosen Penev, Rafał Miłecki
On 12/2/26 02:34, Rafał Miłecki wrote:
> 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>
> ---
> V4: Add check for NULL pointer
>
> drivers/net/dsa/b53/b53_common.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index ee2d27732c0c..53625090131e 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -758,6 +758,32 @@ 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;
> +
> + /*
> + * Northstar SoCs devices have 3 Ethernet controllers and 3 CPU ports:
> + * 5 (IMP1), 7, 8 (IMP0). This design was meant for dual IMP setups when
> + * WAN traffic goes to port 5 and LAN traffic goes to port 8.
> + *
> + * While all 3 ports support Broadcom header, ports 5 and 7 have their
> + * limitations. Features that relay on trapping to CPU (e.g. EAP, STP)
> + * won't work when using those as CPU ones.
typo: s/relay/rely/
> + *
> + * Prefer CPU port 8 if available.
> + */
> + if (is5301x(dev)) {
Appreciate you want to be somewhat conservative here but the list is
much longer, in fact, we should probably implement this by exception,
the norm is to use port 8, and the exception is to use another one.
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices
2026-12-02 20:13 ` Florian Fainelli
@ 2026-12-02 20:32 ` Rafał Miłecki
2026-12-02 21:10 ` Florian Fainelli
0 siblings, 1 reply; 5+ messages in thread
From: Rafał Miłecki @ 2026-12-02 20:32 UTC (permalink / raw)
To: Florian Fainelli, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, Vladimir Oltean, Jonas Gorski
Cc: netdev, Rosen Penev, Rafał Miłecki
W dniu 2.12.2026 o 21:13, Florian Fainelli pisze:
> On 12/2/26 02:34, Rafał Miłecki wrote:
>> 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>
>> ---
>> V4: Add check for NULL pointer
>>
>> drivers/net/dsa/b53/b53_common.c | 27 +++++++++++++++++++++++++++
>> 1 file changed, 27 insertions(+)
>>
>> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
>> index ee2d27732c0c..53625090131e 100644
>> --- a/drivers/net/dsa/b53/b53_common.c
>> +++ b/drivers/net/dsa/b53/b53_common.c
>> @@ -758,6 +758,32 @@ 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;
>> +
>> + /*
>> + * Northstar SoCs devices have 3 Ethernet controllers and 3 CPU ports:
>> + * 5 (IMP1), 7, 8 (IMP0). This design was meant for dual IMP setups when
>> + * WAN traffic goes to port 5 and LAN traffic goes to port 8.
>> + *
>> + * While all 3 ports support Broadcom header, ports 5 and 7 have their
>> + * limitations. Features that relay on trapping to CPU (e.g. EAP, STP)
>> + * won't work when using those as CPU ones.
>
> typo: s/relay/rely/
>
>> + *
>> + * Prefer CPU port 8 if available.
>> + */
>> + if (is5301x(dev)) {
>
> Appreciate you want to be somewhat conservative here but the list is much longer, in fact, we should probably implement this by exception, the norm is to use port 8, and the exception is to use another one.
I'm just not really familiar with other hardware supported by b53.
Are you aware of any devices that this logic shouldn't be applied to?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices
2026-12-02 20:32 ` Rafał Miłecki
@ 2026-12-02 21:10 ` Florian Fainelli
0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2026-12-02 21:10 UTC (permalink / raw)
To: Rafał Miłecki, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, Vladimir Oltean,
Jonas Gorski
Cc: netdev, Rosen Penev, Rafał Miłecki
On 12/2/26 12:32, Rafał Miłecki wrote:
> W dniu 2.12.2026 o 21:13, Florian Fainelli pisze:
>> On 12/2/26 02:34, Rafał Miłecki wrote:
>>> 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>
>>> ---
>>> V4: Add check for NULL pointer
>>>
>>> drivers/net/dsa/b53/b53_common.c | 27 +++++++++++++++++++++++++++
>>> 1 file changed, 27 insertions(+)
>>>
>>> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/
>>> b53_common.c
>>> index ee2d27732c0c..53625090131e 100644
>>> --- a/drivers/net/dsa/b53/b53_common.c
>>> +++ b/drivers/net/dsa/b53/b53_common.c
>>> @@ -758,6 +758,32 @@ 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;
>>> +
>>> + /*
>>> + * Northstar SoCs devices have 3 Ethernet controllers and 3 CPU
>>> ports:
>>> + * 5 (IMP1), 7, 8 (IMP0). This design was meant for dual IMP
>>> setups when
>>> + * WAN traffic goes to port 5 and LAN traffic goes to port 8.
>>> + *
>>> + * While all 3 ports support Broadcom header, ports 5 and 7 have
>>> their
>>> + * limitations. Features that relay on trapping to CPU (e.g.
>>> EAP, STP)
>>> + * won't work when using those as CPU ones.
>>
>> typo: s/relay/rely/
>>
>>> + *
>>> + * Prefer CPU port 8 if available.
>>> + */
>>> + if (is5301x(dev)) {
>>
>> Appreciate you want to be somewhat conservative here but the list is
>> much longer, in fact, we should probably implement this by exception,
>> the norm is to use port 8, and the exception is to use another one.
>
> I'm just not really familiar with other hardware supported by b53.
>
> Are you aware of any devices that this logic shouldn't be applied to?
Except 5325 and 5365, and some odd combinations where there is an actual
ned not to use port 8, see
https://lore.kernel.org/all/20261130-b53-bpdu-mirror-v3-1-3d82c0e0571f@telaak.dev
then I can't think of a configuration where it is not done. With that
said, I would go with something like this:
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;
/* Port 8 (IMP0) is the fully featured CPU port. Ports 5 and
7 ... */
cpu_dp = dsa_to_port(ds, B53_CPU_PORT);
if (cpu_dp && dsa_port_is_cpu(cpu_dp))
return cpu_dp;
return NULL;
}
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices
2026-12-02 10:34 [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices Rafał Miłecki
2026-12-02 20:13 ` Florian Fainelli
@ 2026-12-03 10:35 ` netdev-bot+sashiko
1 sibling, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-12-03 10:35 UTC (permalink / raw)
To: zajec5
Cc: davem, edumazet, kuba, pabeni, andrew, olteanv, florian.fainelli,
jonas.gorski, netdev, rosenp, rafal
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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] This finding is speculative: it depends on how the hardware
decodes GLOBAL_CONFIG bits [7:6] on BCM5301x.
- [Low] On existing Northstar boards, the new
b53_preferred_default_local_cpu_port()…
- [Low] The comment added in b53_preferred_default_local_cpu_port()
(drivers/net/dsa/b53/b53_common.c:771-773) describes a functional…
--
net: dsa: b53: prefer CPU port 8 for Northstar devices
This adds a preferred_default_local_cpu_port callback to the b53 driver.
On BCM5301x (Northstar) switches it returns port 8 when that port is
configured as a CPU port. DSA then assigns all user ports to port 8
instead of the first CPU port listed in the device tree.
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index ee2d27732c0c8..53625090131e9 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -758,6 +758,32 @@ 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;
> +
> + /*
> + * Northstar SoCs devices have 3 Ethernet controllers and 3 CPU ports:
> + * 5 (IMP1), 7, 8 (IMP0). This design was meant for dual IMP setups when
> + * WAN traffic goes to port 5 and LAN traffic goes to port 8.
> + *
> + * While all 3 ports support Broadcom header, ports 5 and 7 have their
> + * limitations. Features that relay on trapping to CPU (e.g. EAP, STP)
> + * won't work when using those as CPU ones.
[Severity: Low]
This comment says STP and EAP trapping don't work when port 5 or 7 is the
CPU port. bcm-ns.dtsi lists port@5 first. That means boards such as
rt-ac3100, rt-ac3200, rt-ac5300 and wxr-1750dhp currently get port 5 as
the default CPU port, and rt-ac88u gets port 7.
If the comment is accurate, isn't this patch a fix for a functional
regression rather than a preference change? The commit message only says
"prefer" and has no Fixes: tag. That makes it hard to tell whether the
patch belongs in net with a Fixes: tag or in net-next.
Could the commit message say what is broken and which change made port
5/7 the default? If there is no functional bug, does the comment overstate
the problem?
This patch also doesn't help boards that enable only port 5 as a CPU port
(most Luxul boards, Netgear R6250, Buffalo WZR-1166DHP, Meraki MR26/MR32,
bcm953012er). Going by the comment, trapping would stay broken on them.
Should the commit message mention that?
> + *
> + * Prefer CPU port 8 if available.
> + */
> + if (is5301x(dev)) {
> + cpu_dp = dsa_to_port(ds, B53_CPU_PORT);
> +
> + if (cpu_dp && dsa_port_is_cpu(cpu_dp))
> + return cpu_dp;
> + }
[Severity: Low]
Does this change the conduit for user ports on existing boards?
dsa_tree_setup_cpu_ports() walks the ports in DT order and gives all user
ports to the first local CPU port. In bcm-ns.dtsi that is port@5 (gmac0).
With this callback in place, ports 5 and 7 are skipped:
net/dsa/dsa.c:dsa_tree_setup_cpu_ports() {
...
if (preferred_cpu_dp && preferred_cpu_dp != cpu_dp)
continue;
...
}
As a result, every user port gets port 8 (gmac2) as its conduit.
These in-tree boards keep more than one CPU port enabled:
bcm47094-asus-rt-ac3100.dtsi (ports 5, 7 and 8; gmac0 -> gmac2)
bcm4709-asus-rt-ac3200.dts
bcm47094-asus-rt-ac5300.dts
bcm4708-buffalo-wxr-1750dhp.dts
bcm47094-asus-rt-ac88u.dts (port 7/gmac1 -> port 8/gmac2)
On these boards, user ports would appear as lan1@eth2 instead of
lan1@eth0. Conduit-specific configuration (MTU, ethtool/tc on the
conduit, distro network scripts) would then apply to a different
interface.
b53 doesn't implement .port_change_conduit, so dsa_user_change_conduit()
returns -EOPNOTSUPP. Users can't restore the previous conduit at runtime
through IFLA_DSA_CONDUIT; the only way back is to edit the DT.
Could the commit message document this user-visible change?
[Severity: Medium]
This one is speculative and depends on how BCM5301x decodes bits [7:6] of
B53_GLOBAL_CONFIG. Does the frame management port setting match the new
default CPU port?
b53_setup() calls b53_enable_cpu_port()->b53_brcm_hdr_setup() for each
CPU port in ascending order. b53_brcm_hdr_setup() only ORs bits in:
drivers/net/dsa/b53/b53_common.c:b53_brcm_hdr_setup() {
...
b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &hdr_ctl);
if (port == 8)
hdr_ctl |= GC_FRM_MGMT_PORT_MII;
else if (port == 5)
hdr_ctl |= GC_FRM_MGMT_PORT_M;
b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl);
...
}
GC_FRM_MGMT_PORT_M is 0xC0 and GC_FRM_MGMT_PORT_MII is 0x80. A switch
with both port 5 and port 8 as CPU ports therefore ends up with 0xC0,
which is the value the driver uses for port 5. No later code clears these
bits.
If 0b11 selects port 5 as the frame management port on BCM5301x, wouldn't
trapped BPDUs and EAP frames still go to port 5/gmac0, while DSA has bound
all user ports to port 8? In that case, should b53_brcm_hdr_setup() clear
GC_FRM_MGMT_PORT_M and then set the IMP0 value for the preferred CPU port?
There is evidence the other way. b53_srab.c names port 5 IMP1 and port 8
IMP0, and the comment above describes a dual IMP design. So 0b11 may mean
dual IMP mode with port 8 still IMP0. Could someone with the BCM5301x
datasheet confirm which encoding applies?
> +
> + return NULL;
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202103450.24657-1-zajec5%40gmail.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-03 10:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 10:34 [PATCH net-next V4] net: dsa: b53: prefer CPU port 8 for Northstar devices Rafał Miłecki
2026-12-02 20:13 ` Florian Fainelli
2026-12-02 20:32 ` Rafał Miłecki
2026-12-02 21:10 ` Florian Fainelli
2026-12-03 10:35 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox