* [PATCH net v2] net: dsa: b53: fix ageing time for BCM53101
@ 2025-09-05 12:45 Jonas Gorski
2025-09-05 16:29 ` Florian Fainelli
2025-09-09 1:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jonas Gorski @ 2025-09-05 12:45 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jonas Gorski
Cc: netdev, linux-kernel
For some reason Broadcom decided that BCM53101 uses 0.5s increments for
the ageing time register, but kept the field width the same [1]. Due to
this, the actual ageing time was always half of what was configured.
Fix this by adapting the limits and value calculation for BCM53101.
So far it looks like this is the only chip with the increased tick
speed:
$ grep -l -r "Specifies the aging time in 0.5 seconds" cdk/PKG/chip | sort
cdk/PKG/chip/bcm53101/bcm53101_a0_defs.h
$ grep -l -r "Specifies the aging time in seconds" cdk/PKG/chip | sort
cdk/PKG/chip/bcm53010/bcm53010_a0_defs.h
cdk/PKG/chip/bcm53020/bcm53020_a0_defs.h
cdk/PKG/chip/bcm53084/bcm53084_a0_defs.h
cdk/PKG/chip/bcm53115/bcm53115_a0_defs.h
cdk/PKG/chip/bcm53118/bcm53118_a0_defs.h
cdk/PKG/chip/bcm53125/bcm53125_a0_defs.h
cdk/PKG/chip/bcm53128/bcm53128_a0_defs.h
cdk/PKG/chip/bcm53134/bcm53134_a0_defs.h
cdk/PKG/chip/bcm53242/bcm53242_a0_defs.h
cdk/PKG/chip/bcm53262/bcm53262_a0_defs.h
cdk/PKG/chip/bcm53280/bcm53280_a0_defs.h
cdk/PKG/chip/bcm53280/bcm53280_b0_defs.h
cdk/PKG/chip/bcm53600/bcm53600_a0_defs.h
cdk/PKG/chip/bcm89500/bcm89500_a0_defs.h
[1] https://github.com/Broadcom/OpenMDK/blob/a5d3fc9b12af3eeb68f2ca0ce7ec4056cd14d6c2/cdk/PKG/chip/bcm53101/bcm53101_a0_defs.h#L28966
Fixes: e39d14a760c0 ("net: dsa: b53: implement setting ageing time")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
v1 -> v2:
* Updated github URL to point to fixed commit
* added grep output for tick speed to commit message
* dropped extra empty line added at the start in b53_setup()
drivers/net/dsa/b53/b53_common.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 829b1f087e9e..2f846381d5a7 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1273,9 +1273,15 @@ static int b53_setup(struct dsa_switch *ds)
*/
ds->untag_vlan_aware_bridge_pvid = true;
- /* Ageing time is set in seconds */
- ds->ageing_time_min = 1 * 1000;
- ds->ageing_time_max = AGE_TIME_MAX * 1000;
+ if (dev->chip_id == BCM53101_DEVICE_ID) {
+ /* BCM53101 uses 0.5 second increments */
+ ds->ageing_time_min = 1 * 500;
+ ds->ageing_time_max = AGE_TIME_MAX * 500;
+ } else {
+ /* Everything else uses 1 second increments */
+ ds->ageing_time_min = 1 * 1000;
+ ds->ageing_time_max = AGE_TIME_MAX * 1000;
+ }
ret = b53_reset_switch(dev);
if (ret) {
@@ -2559,7 +2565,10 @@ int b53_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
else
reg = B53_AGING_TIME_CONTROL;
- atc = DIV_ROUND_CLOSEST(msecs, 1000);
+ if (dev->chip_id == BCM53101_DEVICE_ID)
+ atc = DIV_ROUND_CLOSEST(msecs, 500);
+ else
+ atc = DIV_ROUND_CLOSEST(msecs, 1000);
if (!is5325(dev) && !is5365(dev))
atc |= AGE_CHANGE;
base-commit: 157cf360c4a8751f7f511a71cc3a283b5d27f889
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: dsa: b53: fix ageing time for BCM53101
2025-09-05 12:45 [PATCH net v2] net: dsa: b53: fix ageing time for BCM53101 Jonas Gorski
@ 2025-09-05 16:29 ` Florian Fainelli
2025-09-09 1:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2025-09-05 16:29 UTC (permalink / raw)
To: Jonas Gorski, Andrew Lunn, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel
On 9/5/25 05:45, Jonas Gorski wrote:
> For some reason Broadcom decided that BCM53101 uses 0.5s increments for
> the ageing time register, but kept the field width the same [1]. Due to
> this, the actual ageing time was always half of what was configured.
>
> Fix this by adapting the limits and value calculation for BCM53101.
>
> So far it looks like this is the only chip with the increased tick
> speed:
>
> $ grep -l -r "Specifies the aging time in 0.5 seconds" cdk/PKG/chip | sort
> cdk/PKG/chip/bcm53101/bcm53101_a0_defs.h
>
> $ grep -l -r "Specifies the aging time in seconds" cdk/PKG/chip | sort
> cdk/PKG/chip/bcm53010/bcm53010_a0_defs.h
> cdk/PKG/chip/bcm53020/bcm53020_a0_defs.h
> cdk/PKG/chip/bcm53084/bcm53084_a0_defs.h
> cdk/PKG/chip/bcm53115/bcm53115_a0_defs.h
> cdk/PKG/chip/bcm53118/bcm53118_a0_defs.h
> cdk/PKG/chip/bcm53125/bcm53125_a0_defs.h
> cdk/PKG/chip/bcm53128/bcm53128_a0_defs.h
> cdk/PKG/chip/bcm53134/bcm53134_a0_defs.h
> cdk/PKG/chip/bcm53242/bcm53242_a0_defs.h
> cdk/PKG/chip/bcm53262/bcm53262_a0_defs.h
> cdk/PKG/chip/bcm53280/bcm53280_a0_defs.h
> cdk/PKG/chip/bcm53280/bcm53280_b0_defs.h
> cdk/PKG/chip/bcm53600/bcm53600_a0_defs.h
> cdk/PKG/chip/bcm89500/bcm89500_a0_defs.h
>
> [1] https://github.com/Broadcom/OpenMDK/blob/a5d3fc9b12af3eeb68f2ca0ce7ec4056cd14d6c2/cdk/PKG/chip/bcm53101/bcm53101_a0_defs.h#L28966
>
> Fixes: e39d14a760c0 ("net: dsa: b53: implement setting ageing time")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: dsa: b53: fix ageing time for BCM53101
2025-09-05 12:45 [PATCH net v2] net: dsa: b53: fix ageing time for BCM53101 Jonas Gorski
2025-09-05 16:29 ` Florian Fainelli
@ 2025-09-09 1:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-09 1:20 UTC (permalink / raw)
To: Jonas Gorski
Cc: florian.fainelli, andrew, olteanv, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 5 Sep 2025 14:45:07 +0200 you wrote:
> For some reason Broadcom decided that BCM53101 uses 0.5s increments for
> the ageing time register, but kept the field width the same [1]. Due to
> this, the actual ageing time was always half of what was configured.
>
> Fix this by adapting the limits and value calculation for BCM53101.
>
> So far it looks like this is the only chip with the increased tick
> speed:
>
> [...]
Here is the summary with links:
- [net,v2] net: dsa: b53: fix ageing time for BCM53101
https://git.kernel.org/netdev/net/c/674b34c4c770
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-09 1:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-05 12:45 [PATCH net v2] net: dsa: b53: fix ageing time for BCM53101 Jonas Gorski
2025-09-05 16:29 ` Florian Fainelli
2025-09-09 1:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).