Skip to content

Commit

Permalink
Merge branch 'mlxsw-fixes'
Browse files Browse the repository at this point in the history
Ido Schimmel says:

====================
mlxsw: MAC profiles occupancy fix

Patch #1 fixes a router interface (RIF) MAC profiles occupancy bug that
was merged in the last cycle.

Patch #2 adds a selftest that fails without the fix.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Dec 14, 2021
2 parents 5f9562e + 2061771 commit 3dd7d40
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -8494,7 +8494,8 @@ mlxsw_sp_rif_mac_profile_replace(struct mlxsw_sp *mlxsw_sp,
u8 mac_profile;
int err;

if (!mlxsw_sp_rif_mac_profile_is_shared(rif))
if (!mlxsw_sp_rif_mac_profile_is_shared(rif) &&
!mlxsw_sp_rif_mac_profile_find(mlxsw_sp, new_mac))
return mlxsw_sp_rif_mac_profile_edit(rif, new_mac);

err = mlxsw_sp_rif_mac_profile_get(mlxsw_sp, new_mac,
Expand Down
30 changes: 30 additions & 0 deletions tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,35 @@ rif_mac_profile_replacement_test()
ip link set $h1.10 address $h1_10_mac
}

rif_mac_profile_consolidation_test()
{
local count=$1; shift
local h1_20_mac

RET=0

if [[ $count -eq 1 ]]; then
return
fi

h1_20_mac=$(mac_get $h1.20)

# Set the MAC of $h1.20 to that of $h1.10 and confirm that they are
# using the same MAC profile.
ip link set $h1.20 address 00:11:11:11:11:11
check_err $?

occ=$(devlink -j resource show $DEVLINK_DEV \
| jq '.[][][] | select(.name=="rif_mac_profiles") |.["occ"]')

[[ $occ -eq $((count - 1)) ]]
check_err $? "MAC profile occupancy did not decrease"

log_test "RIF MAC profile consolidation"

ip link set $h1.20 address $h1_20_mac
}

rif_mac_profile_shared_replacement_test()
{
local count=$1; shift
Expand Down Expand Up @@ -104,6 +133,7 @@ rif_mac_profile_edit_test()
create_max_rif_mac_profiles $count

rif_mac_profile_replacement_test
rif_mac_profile_consolidation_test $count
rif_mac_profile_shared_replacement_test $count
}

Expand Down

0 comments on commit 3dd7d40

Please sign in to comment.