• Vladimir Oltean's avatar
    net: dsa: centralize fast ageing when address learning is turned off · 045c45d1
    Vladimir Oltean authored
    Currently DSA leaves it down to device drivers to fast age the FDB on a
    port when address learning is disabled on it. There are 2 reasons for
    doing that in the first place:
    
    - when address learning is disabled by user space, through
      IFLA_BRPORT_LEARNING or the brport_attr_learning sysfs, what user
      space typically wants to achieve is to operate in a mode with no
      dynamic FDB entry on that port. But if the port is already up, some
      addresses might have been already learned on it, and it seems silly to
      wait for 5 minutes for them to expire until something useful can be
      done.
    
    - when a port leaves a bridge and becomes standalone, DSA turns off
      address learning on it. This also has the nice side effect of flushing
      the dynamically learned bridge FDB entries on it, which is a good idea
      because standalone ports should not have bridge FDB entries on them.
    
    We let drivers manage fast ageing under this condition because if DSA
    were to do it, it would need to track each port's learning state, and
    act upon the transition, which it currently doesn't.
    
    But there are 2 reasons why doing it is better after all:
    
    - drivers might get it wrong and not do it (see b53_port_set_learning)
    
    - we would like to flush the dynamic entries from the software bridge
      too, and letting drivers do that would be another pain point
    
    So track the port learning state and trigger a fast age process
    automatically within DSA.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    045c45d1
dsa.h 33.5 KB