Skip to content
  • Ido Schimmel's avatar
    mlxsw: spectrum: Properly cleanup LAG uppers when removing port from LAG · be2d6f42
    Ido Schimmel authored
    
    
    When a LAG device or a VLAN device on top of it is enslaved to a bridge,
    the driver propagates the CHANGEUPPER event to the LAG's slaves.
    
    This causes each physical port to increase the reference count of the
    internal representation of the bridge port by calling
    mlxsw_sp_port_bridge_join().
    
    However, when a port is removed from a LAG, the corresponding leave()
    function is not called and the reference count is not decremented. This
    leads to ugly hacks such as mlxsw_sp_bridge_port_should_destroy() that
    try to understand if the bridge port should be destroyed even when its
    reference count is not 0.
    
    Instead, make sure that when a port is unlinked from a LAG it would see
    the same events as if the LAG (or its uppers) were unlinked from a
    bridge.
    
    The above is achieved by walking the LAG's uppers when a port is
    unlinked and calling mlxsw_sp_port_bridge_leave() for each upper that is
    enslaved to a bridge.
    
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    be2d6f42