• Petr Machata's avatar
    mlxsw: spectrum_router: Replay MACVLANs when RIF is made · 49c3a615
    Petr Machata authored
    If IP address is added to a MACVLAN netdevice, the effect is of configuring
    VRRP on the RIF for the netdevice linked to the MACVLAN. Because the
    MACVLAN offload is tied to existence of a RIF at the linked netdevice,
    adding a MACVLAN is currently not allowed until a RIF is present.
    
    If this requirement stays, it will never be possible to attach a first port
    into a topology that involves a MACVLAN. Thus topologies would need to be
    built in a certain order, which is impractical.
    
    Additionally, IP address removal, which leads to disappearance of the RIF
    that the MACVLAN depends on, cannot be vetoed. Thus even as things stand
    now it is possible to get to a state where a MACVLAN netdevice exists
    without a RIF, despite having mlxsw lowers. And once the MACVLAN is
    un-offloaded due to RIF getting destroyed, recreating the RIF does not
    bring it back.
    
    In this patch, accept that MACVLAN can be created out of order and support
    that use case.
    
    One option would seem to be to simply recognize MACVLAN netdevices as
    "interesting", and let the existing replay mechanisms take care of the
    offload. However, that does not address the necessity to reoffload MACVLAN
    once a RIF is created.
    
    Thus add a new replay hook, symmetrical to mlxsw_sp_rif_macvlan_flush(),
    called mlxsw_sp_rif_macvlan_replay(), which instead of unwinding the
    existing offloads, applies the configuration as if the netdevice were
    created just now.
    
    Additionally, remove all vetoes and warning messages that checked for
    presence of a RIF at the linked device.
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Reviewed-by: default avatarDanielle Ratson <danieller@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    49c3a615
spectrum_router.c 303 KB