]> Git Repo - linux.git/commitdiff
net: mscc: ocelot: ANA_AUTOAGE_AGE_PERIOD holds a value in seconds, not ms
authorVladimir Oltean <[email protected]>
Sun, 3 May 2020 22:20:27 +0000 (01:20 +0300)
committerDavid S. Miller <[email protected]>
Thu, 7 May 2020 00:15:25 +0000 (17:15 -0700)
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: a556c76adc05 ("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]>
drivers/net/ethernet/mscc/ocelot.c

index 887b3cc88354f0bf02c4b0a214fa2d41b3e0947b..02350c3d9d011a155c584b6e891d745f5f8aa7b5 100644 (file)
@@ -1451,8 +1451,15 @@ static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port,
 
 void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
 {
-       ocelot_write(ocelot, ANA_AUTOAGE_AGE_PERIOD(msecs / 2),
-                    ANA_AUTOAGE);
+       unsigned int age_period = ANA_AUTOAGE_AGE_PERIOD(msecs / 2000);
+
+       /* Setting AGE_PERIOD to zero effectively disables automatic aging,
+        * which is clearly not what our intention is. So avoid that.
+        */
+       if (!age_period)
+               age_period = 1;
+
+       ocelot_rmw(ocelot, age_period, ANA_AUTOAGE_AGE_PERIOD_M, ANA_AUTOAGE);
 }
 EXPORT_SYMBOL(ocelot_set_ageing_time);
 
This page took 0.0595 seconds and 4 git commands to generate.