• Ido Schimmel's avatar
    mlxsw: spectrum_router: Make RIF deletion more robust · 965fa8e6
    Ido Schimmel authored
    In the past we had multiple instances where RIFs were not properly
    deleted.
    
    One of the reasons for leaking a RIF was that at the time when IP
    addresses were flushed from the respective netdev (prompting the
    destruction of the RIF), the netdev was no longer a mlxsw upper. This
    caused the inet{,6}addr notification blocks to ignore the NETDEV_DOWN
    event and leak the RIF.
    
    Instead of checking whether the netdev is our upper when an IP address
    is removed, we can instead check if the netdev has a RIF configured.
    
    To look up a RIF we need to access mlxsw private data, so the patch
    stores the notification blocks inside a mlxsw struct. This then allows
    us to use container_of() and extract the required private data.
    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>
    965fa8e6
spectrum.c 154 KB