diff options
author | Amit Cohen <amcohen@nvidia.com> | 2022-06-21 11:33:37 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-06-22 12:56:57 +0100 |
commit | c96a9919c79e61e791c561a9c9c2ce56371866a1 (patch) | |
tree | 328bc8832232222cccc0cc18d5bd3b9b8528e946 /drivers | |
parent | a6f43b1dad800d816d62dc478e68eb5230a9465c (diff) | |
download | linux-stable-c96a9919c79e61e791c561a9c9c2ce56371866a1.tar.gz linux-stable-c96a9919c79e61e791c561a9c9c2ce56371866a1.tar.bz2 linux-stable-c96a9919c79e61e791c561a9c9c2ce56371866a1.zip |
mlxsw: spectrum_switchdev: Add error path in mlxsw_sp_port_mc_disabled_set()
The above mentioned function just returns an error in case that
mlxsw_sp_bridge_ports_flood_table_set() fails. That means that the previous
configurations are not cleaned.
Fix it by adding error path to clean the configurations in case of error.
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 303909bc43c6..127ebd10c16e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -900,6 +900,7 @@ static int mlxsw_sp_port_mc_disabled_set(struct mlxsw_sp_port *mlxsw_sp_port, struct net_device *orig_dev, bool mc_disabled) { + enum mlxsw_sp_flood_type packet_type = MLXSW_SP_FLOOD_TYPE_MC; struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; struct mlxsw_sp_bridge_device *bridge_device; struct mlxsw_sp_bridge_port *bridge_port; @@ -919,17 +920,29 @@ static int mlxsw_sp_port_mc_disabled_set(struct mlxsw_sp_port *mlxsw_sp_port, mlxsw_sp_bridge_mdb_mc_enable_sync(mlxsw_sp, bridge_device); list_for_each_entry(bridge_port, &bridge_device->ports_list, list) { - enum mlxsw_sp_flood_type packet_type = MLXSW_SP_FLOOD_TYPE_MC; bool member = mlxsw_sp_mc_flood(bridge_port); err = mlxsw_sp_bridge_ports_flood_table_set(bridge_port, packet_type, member); if (err) - return err; + goto err_flood_table_set; } return 0; + +err_flood_table_set: + list_for_each_entry_continue_reverse(bridge_port, + &bridge_device->ports_list, list) { + bool member = mlxsw_sp_mc_flood(bridge_port); + + mlxsw_sp_bridge_ports_flood_table_set(bridge_port, packet_type, + !member); + } + + bridge_device->multicast_enabled = mc_disabled; + mlxsw_sp_bridge_mdb_mc_enable_sync(mlxsw_sp, bridge_device); + return err; } static int mlxsw_sp_smid_router_port_set(struct mlxsw_sp *mlxsw_sp, |