Skip to content

Commit c0d7ecc

Browse files
vladimirolteandavem330
authored andcommitted
net: mscc: ocelot: ANA_AUTOAGE_AGE_PERIOD holds a value in seconds, not ms
One may notice that automatically-learnt entries 'never' expire, even though the bridge configures the address age period at 300 seconds. Actually the value written to hardware corresponds to a time interval 1000 times higher than intended, i.e. 83 hours. Fixes: a556c76 ("net: mscc: Add initial Ocelot switch support") Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Faineli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 21ce7f3 commit c0d7ecc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,8 +1451,15 @@ static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port,
14511451

14521452
void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
14531453
{
1454-
ocelot_write(ocelot, ANA_AUTOAGE_AGE_PERIOD(msecs / 2),
1455-
ANA_AUTOAGE);
1454+
unsigned int age_period = ANA_AUTOAGE_AGE_PERIOD(msecs / 2000);
1455+
1456+
/* Setting AGE_PERIOD to zero effectively disables automatic aging,
1457+
* which is clearly not what our intention is. So avoid that.
1458+
*/
1459+
if (!age_period)
1460+
age_period = 1;
1461+
1462+
ocelot_rmw(ocelot, age_period, ANA_AUTOAGE_AGE_PERIOD_M, ANA_AUTOAGE);
14561463
}
14571464
EXPORT_SYMBOL(ocelot_set_ageing_time);
14581465

0 commit comments

Comments
 (0)