On Thu, Dec 3, 2026 at 8:46 AM Rafał Miłecki <zaje…@gmail.com> wrote:
> > From: Rafał Miłecki <raf…@milecki.pl> > > Port 8 allows using all switch features as in opposite to ports 5 and 7. > > Signed-off-by: Rafał Miłecki <raf…@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
This comment only makes sense for embedded switches in NSP and similar; external switch chips have only two CPU ports (IMP0 and IMP1).
> + * 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
relay -> rely
> + * 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;
Is this enough to make sure that everything works as expected even if both CPU ports (5 and 8) are defined and we enable dual IMP mode? I'm thinking about the WAN_PORT_SEL register, where the bootloader may have configured one as wan, which AFAIU would send its (non-trapped) traffic to IMP1 as well as isolate it from the other ports, so I wonder what happens if you bridge it.
> +} > + > 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,
More a random thought than a request for change, I wonder if we also should explicitly initialize .port_change_conduit to NULL along with a comment that secondary CPU ports aren't supported, so it's obvious this wasn't just forgotten. I first considered a stub that just returns -EOPNOTSUPP, but that would make dsa do a lot of work before calling .port_change_conduit (and then undo it again) instead of failing directly. Best regards, Jonas