Browse Source

mlxsw: spectrum: Fix rollback order in LAG join failure

Make the leave procedure in the error path symmetric to the join
procedure and first remove the port from the collector before
potentially destroying the LAG.

Fixes: 0d65fc13042f ("mlxsw: spectrum: Implement LAG port join/leave")
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>
Ido Schimmel 9 years ago
parent
commit
51554db2d2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      drivers/net/ethernet/mellanox/mlxsw/spectrum.c

+ 2 - 2
drivers/net/ethernet/mellanox/mlxsw/spectrum.c

@@ -2541,11 +2541,11 @@ static int mlxsw_sp_port_lag_join(struct mlxsw_sp_port *mlxsw_sp_port,
 	lag->ref_count++;
 	lag->ref_count++;
 	return 0;
 	return 0;
 
 
+err_col_port_enable:
+	mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id);
 err_col_port_add:
 err_col_port_add:
 	if (!lag->ref_count)
 	if (!lag->ref_count)
 		mlxsw_sp_lag_destroy(mlxsw_sp, lag_id);
 		mlxsw_sp_lag_destroy(mlxsw_sp, lag_id);
-err_col_port_enable:
-	mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id);
 	return err;
 	return err;
 }
 }