• Ido Schimmel's avatar
    mlxsw: spectrum_switchdev: Have VXLAN device take reference on FID · 71afb45a
    Ido Schimmel authored
    Up until now only local ports and the router port (which is also a local
    port) took a reference on the corresponding FID (Filtering Identifier)
    when joining a bridge. For example:
    
            192.0.2.1/24
                br0
                 |
          +------+------+
          |             |
         swp1        vxlan0
    
    In this case the reference count of the FID will be '2'. Since the VXLAN
    device does not take a reference on the FID, whenever a local port joins
    the bridge it needs to check if a VXLAN device is already enslaved. If
    the VXLAN device should be mapped to the FID in question, then the VXLAN
    device's VNI is set on the FID.
    
    Beside the fact that this scheme special-cases the VXLAN device, it also
    creates an unnecessary dependency between the routing and bridge code:
    
    1. [R] IP address is added on 'br0', which prompts the creation of a RIF
       and a backing FID
    2. [B] VNI is enabled on backing FID
    3. [R] Host route corresponding to VXLAN device's source address is
       promoted to perform NVE decapsulation
    
    [R] - Routing code
    [B] - Bridge code
    
    This back and forth dependency will become problematic when a lock is
    added in the routing code instead of relying on RTNL, as it will result
    in an AA deadlock.
    
    Instead, have the VXLAN device take a reference on the FID just like all
    the other netdev members of the bridge. In order to correctly handle the
    case where VXLAN devices are already enslaved to the bridge when it is
    offloaded, walk the bridge's slaves and replay the configuration.
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
    Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    71afb45a
spectrum_switchdev.c 96.3 KB