On Sat, Oct 22, 2022 at 09:31:06AM +0200, netdev@kapio-technology.com wrote:
But I think it should be so that turning MAB off will clear the ALE entries regardless, as the port can continue to be locked and needing port association, or you want them to just age out normally in that case, thus lingering for up to bridge ageing time?
Even without BR_PORT_LOCKED, I find it normal that dynamically learned FDB entries are forcefully aged out when BR_LEARNING is turned off, instead of lingering on until they expire.
This does not happen in the software bridge, and I did not understand why (I suspected some backwards compatibility reasons), and for this reason, it is only from within DSA that we are forcing this behavior to take place. In dsa_port_bridge_flags(), when BR_LEARNING is turned off, we call dsa_port_fast_age() which also calls SWITCHDEV_FDB_FLUSH_TO_BRIDGE (and this clears the bridge software FDB of dynamically learned entries).
I very much expect the same thing with MAB and BR_FDB_LOCKED entries, that they go away when the BR_PORT_MAB/BR_LEARNING flag (whichever way we call it) is unset.
Now, if the bridge should initiate the flushing, or still DSA, is perhaps a topic for further discussion. Given that BR_FDB_LOCKED entries are new, maybe the bridge could do it in this case (no backwards compatibility to handle).
Currently the DSA logic mentioned above is bypassed, because we treat MAB and autonomous learning differently. If we accepted that MAB is still a form of learning (managed through BR_LEARNING+BR_PORT_LOCKED), then the DSA logic would kick in, and both the software bridge and the hardware driver would have a hook to clean up the BR_FDB_LOCKED entries, plus anything else that is dynamic. The DSA logic would also kick in if we treated BR_PORT_MAB within DSA like BR_LEARNING, which basically amounts to the same thing, except for the confusing (IMO) UAPI of having a flag (BR_PORT_MAB) which is basically a form of learning that isn't controlled by the BR_LEARNING flag (which is undefined and unclear if it should be set or not, in BR_PORT_LOCKED mode).