• Petr Machata's avatar
    mlxsw: spectrum_router: Onload conflicting tunnels · af641713
    Petr Machata authored
    The approach for offloading IP tunnels implemented currently by mlxsw
    doesn't allow two tunnels that have the same local IP address in the
    same (underlay) VRF. Previously, offloads were introduced on demand as
    encap routes were formed. When such a route was created that would cause
    offload of a conflicting tunnel, mlxsw_sp_ipip_entry_create() would
    detect it and return -EEXIST, which would propagate up and cause FIB
    abort.
    
    Now however IPIP entries are created as soon as an offloadable netdevice
    is created, and the failure prevents creation of such device.
    Furthermore, if the driver is installed at the point where such
    conflicting tunnels exist, the failure actually prevents successful
    modprobe.
    
    Furthermore, follow-up patches implement handling of NETDEV_CHANGE due
    to the local address change. However, NETDEV_CHANGE can't be vetoed. The
    failure merely means that the offloads weren't updated, but the change
    in Linux configuration is not rolled back. It is thus desirable to have
    a robust way of handling these conflicts, which can later be reused for
    handling NETDEV_CHANGE as well.
    
    To fix this, when a conflicting tunnel is created, instead of failing,
    simply pull the old tunnel to slow path and reject offloading the
    new one.
    
    Introduce two functions: mlxsw_sp_ipip_entry_demote_tunnel() and
    mlxsw_sp_ipip_demote_tunnel_by_saddr() to handle this. Make them both
    public, because they will be useful later on in this patchset.
    Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
    Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    af641713
spectrum_router.c 183 KB