]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: dsa: centralize fast ageing when address learning is turned off
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sun, 8 Aug 2021 14:35:23 +0000 (17:35 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Aug 2021 19:56:51 +0000 (20:56 +0100)
commit045c45d1f598c65806f885b59f6fbc4cebb62b15
treeb0b5a95c39dd800c4776262e5b1a234b1b6e2fbe
parent64ec13ec92d5b28371cb620928588a324cc74f54
net: dsa: centralize fast ageing when address learning is turned off

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: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c
include/net/dsa.h
net/dsa/dsa_priv.h
net/dsa/port.c