• Vladimir Oltean's avatar
    net: bridge: add helper to replay port and local fdb entries · 04846f90
    Vladimir Oltean authored
    When a switchdev port starts offloading a LAG that is already in a
    bridge and has an FDB entry pointing to it:
    
    ip link set bond0 master br0
    bridge fdb add dev bond0 00:01:02:03:04:05 master static
    ip link set swp0 master bond0
    
    the switchdev driver will have no idea that this FDB entry is there,
    because it missed the switchdev event emitted at its creation.
    
    Ido Schimmel pointed this out during a discussion about challenges with
    switchdev offloading of stacked interfaces between the physical port and
    the bridge, and recommended to just catch that condition and deny the
    CHANGEUPPER event:
    https://lore.kernel.org/netdev/20210210105949.GB287766@shredder.lan/
    
    But in fact, we might need to deal with the hard thing anyway, which is
    to replay all FDB addresses relevant to this port, because it isn't just
    static FDB entries, but also local addresses (ones that are not
    forwarded but terminated by the bridge). There, we can't just say 'oh
    yeah, there was an upper already so I'm not joining that'.
    
    So, similar to the logic for replaying MDB entries, add a function that
    must be called by individual switchdev drivers and replays local FDB
    entries as well as ones pointing towards a bridge port. This time, we
    use the atomic switchdev notifier block, since that's what FDB entries
    expect for some reason.
    Reported-by: default avatarIdo Schimmel <idosch@idosch.org>
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    04846f90
br_fdb.c 33.6 KB