Skip to content

Commit b442f2e

Browse files
daniellertsdavem330
authored andcommitted
mlxsw: spectrum_router: Consolidate MAC profiles when possible
Currently, when setting a router interface (RIF) MAC address while the MAC profile is not shared with other RIFs, the profile is edited so that the new MAC address is assigned to it. This does not take into account a situation in which the new MAC address already matches an existing MAC profile. In that situation, two MAC profiles will be occupied even though they hold MAC addresses from the same profile. In order to prevent that, add a check to ensure that editing a MAC profile takes place only when the new MAC address does not match an existing profile. Fixes: 605d25c ("mlxsw: spectrum_router: Add RIF MAC profiles support") Reported-by: Maksym Yaremchuk <maksymy@nvidia.com> Tested-by: Maksym Yaremchuk <maksymy@nvidia.com> Signed-off-by: Danielle Ratson <danieller@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5f9562e commit b442f2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8494,7 +8494,8 @@ mlxsw_sp_rif_mac_profile_replace(struct mlxsw_sp *mlxsw_sp,
84948494
u8 mac_profile;
84958495
int err;
84968496

8497-
if (!mlxsw_sp_rif_mac_profile_is_shared(rif))
8497+
if (!mlxsw_sp_rif_mac_profile_is_shared(rif) &&
8498+
!mlxsw_sp_rif_mac_profile_find(mlxsw_sp, new_mac))
84988499
return mlxsw_sp_rif_mac_profile_edit(rif, new_mac);
84998500

85008501
err = mlxsw_sp_rif_mac_profile_get(mlxsw_sp, new_mac,

0 commit comments

Comments
 (0)