Skip to content
  • Ido Schimmel's avatar
    mlxsw: spectrum: Remove reference count from VLAN entries · 635c8c8b
    Ido Schimmel authored
    Commit b3529af6
    
     ("spectrum: Reference count VLAN entries") started
    reference counting port-VLAN entries in a similar fashion to the 8021q
    driver.
    
    However, this is not actually needed and only complicates things.
    Instead, the driver should forbid the creation of a VLAN on a port if
    this VLAN already exists. This would also solve the issue fixed by the
    mentioned commit.
    
    Therefore, remove the get()/put() API and use create()/destroy()
    instead.
    
    One place that needs special attention is VLAN addition in a VLAN-aware
    bridge via switchdev operations. In case the VLAN flags (e.g., 'pvid')
    are toggled, then the VLAN entry already exists. To prevent the driver
    from wrongly returning EEXIST, the driver is changed to check in the
    prepare phase whether the entry already exists and only returns an error
    in case it is not associated with the correct bridge port.
    
    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>
    635c8c8b