[RFC PATCH 02/10] net: dsa: b53: prevent FAST_AGE access on BCM5325

Álvaro Fernández Rojas posted 10 patches 6 months, 2 weeks ago
There is a newer version of this series
[RFC PATCH 02/10] net: dsa: b53: prevent FAST_AGE access on BCM5325
Posted by Álvaro Fernández Rojas 6 months, 2 weeks ago
BCM5325 doesn't implement FAST_AGE registers so we should avoid reading or
writing them.

Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/net/dsa/b53/b53_common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 03c1e2e75061..d1249aac6136 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -486,6 +486,9 @@ static int b53_flush_arl(struct b53_device *dev, u8 mask)
 {
 	unsigned int i;
 
+	if (is5325(dev))
+		return 0;
+
 	b53_write8(dev, B53_CTRL_PAGE, B53_FAST_AGE_CTRL,
 		   FAST_AGE_DONE | FAST_AGE_DYNAMIC | mask);
 
@@ -510,6 +513,9 @@ static int b53_flush_arl(struct b53_device *dev, u8 mask)
 
 static int b53_fast_age_port(struct b53_device *dev, int port)
 {
+	if (is5325(dev))
+		return 0;
+
 	b53_write8(dev, B53_CTRL_PAGE, B53_FAST_AGE_PORT_CTRL, port);
 
 	return b53_flush_arl(dev, FAST_AGE_PORT);
@@ -517,6 +523,9 @@ static int b53_fast_age_port(struct b53_device *dev, int port)
 
 static int b53_fast_age_vlan(struct b53_device *dev, u16 vid)
 {
+	if (is5325(dev))
+		return 0;
+
 	b53_write16(dev, B53_CTRL_PAGE, B53_FAST_AGE_VID_CTRL, vid);
 
 	return b53_flush_arl(dev, FAST_AGE_VLAN);
-- 
2.39.5

Re: [RFC PATCH 02/10] net: dsa: b53: prevent FAST_AGE access on BCM5325
Posted by Vladimir Oltean 6 months, 2 weeks ago
Hello,

On Sat, May 31, 2025 at 12:13:00PM +0200, Álvaro Fernández Rojas wrote:
> BCM5325 doesn't implement FAST_AGE registers so we should avoid reading or
> writing them.
> 
> Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---

How about implementing a "slow age" procedure instead? Walk through the
FDB, and delete the dynamically learned entries for the port?

Address aging is important for STP state transitions.
Re: [RFC PATCH 02/10] net: dsa: b53: prevent FAST_AGE access on BCM5325
Posted by Florian Fainelli 6 months, 2 weeks ago
On 6/2/25 02:37, Vladimir Oltean wrote:
> Hello,
> 
> On Sat, May 31, 2025 at 12:13:00PM +0200, Álvaro Fernández Rojas wrote:
>> BCM5325 doesn't implement FAST_AGE registers so we should avoid reading or
>> writing them.
>>
>> Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
>> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
>> ---
> 
> How about implementing a "slow age" procedure instead? Walk through the
> FDB, and delete the dynamically learned entries for the port?
> 
> Address aging is important for STP state transitions.

That's a good suggestion, I suppose for now this can be b53 specific 
until we encounter another 20 year old switch and then we move that 
logic within the DSA framework?
-- 
Florian
Re: [RFC PATCH 02/10] net: dsa: b53: prevent FAST_AGE access on BCM5325
Posted by Vladimir Oltean 6 months, 2 weeks ago
On Mon, Jun 02, 2025 at 11:01:40AM -0700, Florian Fainelli wrote:
> On 6/2/25 02:37, Vladimir Oltean wrote:
> > Hello,
> > 
> > On Sat, May 31, 2025 at 12:13:00PM +0200, Álvaro Fernández Rojas wrote:
> > > BCM5325 doesn't implement FAST_AGE registers so we should avoid reading or
> > > writing them.
> > > 
> > > Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
> > > Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> > > ---
> > 
> > How about implementing a "slow age" procedure instead? Walk through the
> > FDB, and delete the dynamically learned entries for the port?
> > 
> > Address aging is important for STP state transitions.
> 
> That's a good suggestion, I suppose for now this can be b53 specific until
> we encounter another 20 year old switch and then we move that logic within
> the DSA framework?
> -- 
> Florian

Hmm, thank you for saying that, I didn't even consider consolidating the
logic in the DSA framework, but it sure makes sense and we already have
almost all API required to do that.

So I now have a WIP patch attached, but the consolidation into the
framework is definitely a net-next activity, since it will also affect
mt7530, hellcreek and vsc73xx, and those need testing. Also, for b53 it
further requires changing the port_fast_age() prototype.

The question further becomes whether for stable kernels we should
implement a local slow age procedure in b53 like the one from sja1105,
only to delete it in net-next, or to skip it altogether, go with
Álvaro's patch as is and concentrate on the net-next implementation
directly. I'm ok both ways.