diff options
author | Ido Schimmel <idosch@mellanox.com> | 2016-07-02 11:00:12 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-02 15:21:17 -0400 |
commit | 11943ff4423d1f3f84d502d65d72f6a98bd2dc91 (patch) | |
tree | 463415bd215f9d2aecc923de3a423e1c625b7a1d /drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |
parent | 86bf95b334a77c388b2aca4b26d24216d9784823 (diff) | |
download | lwn-11943ff4423d1f3f84d502d65d72f6a98bd2dc91.tar.gz lwn-11943ff4423d1f3f84d502d65d72f6a98bd2dc91.zip |
mlxsw: spectrum: Remove RIF from PVID vPort when joining / leaving LAG
We are going to assign router interfaces (RIFs) to netdevs if an IPv4
address was assigned to them. If one was assigned to a port netdev, this
will translate to the PVID vPort being member in a RIF.
While it's possible for a LAG slave to have an IP address, we can't have
a vPort being member in two FIDs (assuming the LAG device will be
put in bridge / assigned an IP address).
Solve that by making the PVID vPort leave any FID it might be a member
in when joining / leaving LAG.
Note that the PVID vPort is the only vPort that can be present on the
port when it's put under LAG.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index f276c453885f..30fe0d2e31a6 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -2800,11 +2800,19 @@ mlxsw_sp_port_pvid_vport_lag_join(struct mlxsw_sp_port *mlxsw_sp_port, u16 lag_id) { struct mlxsw_sp_port *mlxsw_sp_vport; + struct mlxsw_sp_fid *f; mlxsw_sp_vport = mlxsw_sp_port_vport_find(mlxsw_sp_port, 1); if (WARN_ON(!mlxsw_sp_vport)) return; + /* If vPort is assigned a RIF, then leave it since it's no + * longer valid. + */ + f = mlxsw_sp_vport_fid_get(mlxsw_sp_vport); + if (f) + f->leave(mlxsw_sp_vport); + mlxsw_sp_vport->lag_id = lag_id; mlxsw_sp_vport->lagged = 1; } @@ -2813,11 +2821,16 @@ static void mlxsw_sp_port_pvid_vport_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port) { struct mlxsw_sp_port *mlxsw_sp_vport; + struct mlxsw_sp_fid *f; mlxsw_sp_vport = mlxsw_sp_port_vport_find(mlxsw_sp_port, 1); if (WARN_ON(!mlxsw_sp_vport)) return; + f = mlxsw_sp_vport_fid_get(mlxsw_sp_vport); + if (f) + f->leave(mlxsw_sp_vport); + mlxsw_sp_vport->lagged = 0; } |