• Petr Machata's avatar
    mlxsw: spectrum_switchdev: Manage RIFs on PVID change · a5b52692
    Petr Machata authored
    Currently, mlxsw has several shortcomings with regards to RIF handling due
    to PVID changes:
    
    - In order to cause RIF for a bridge device to be created, the user is
      expected first to set PVID, then to add an IP address. The reverse
      ordering is disallowed, which is not very user-friendly.
    
    - When such bridge gets a VLAN upper whose VID was the same as the existing
      PVID, and this VLAN netdevice gets an IP address, a RIF is created for
      this netdevice. The new RIF is then assigned to the 802.1Q FID for the
      given VID. This results in a working configuration. However, then, when
      the VLAN netdevice is removed again, the RIF for the bridge itself is
      never reassociated to the VLAN.
    
    - PVID cannot be changed once the bridge has uppers. Presumably this is
      because the driver does not manage RIFs properly in face of PVID changes.
      However, as the previous point shows, it is still possible to get into
      invalid configurations.
    
    In this patch, add the logic necessary for creation of a RIF as a result of
    PVID change. Moreover, when a VLAN upper is created whose VID matches lower
    PVID, do not create RIF for this netdevice.
    
    These changes obviate the need for ordering of IP address additions and
    PVID configuration, so stop forbidding addition of an IP address to a
    PVID-less bridge. Instead, bail out quietly. Also stop preventing PVID
    changes when the bridge has uppers.
    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>
    a5b52692
spectrum_router.h 6.77 KB