Skip to content

Commit 3dd7d40

Browse files
committed
Merge branch 'mlxsw-fixes'
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]>
2 parents 5f9562e + 2061771 commit 3dd7d40

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-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,

tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,35 @@ rif_mac_profile_replacement_test()
7272
ip link set $h1.10 address $h1_10_mac
7373
}
7474

75+
rif_mac_profile_consolidation_test()
76+
{
77+
local count=$1; shift
78+
local h1_20_mac
79+
80+
RET=0
81+
82+
if [[ $count -eq 1 ]]; then
83+
return
84+
fi
85+
86+
h1_20_mac=$(mac_get $h1.20)
87+
88+
# Set the MAC of $h1.20 to that of $h1.10 and confirm that they are
89+
# using the same MAC profile.
90+
ip link set $h1.20 address 00:11:11:11:11:11
91+
check_err $?
92+
93+
occ=$(devlink -j resource show $DEVLINK_DEV \
94+
| jq '.[][][] | select(.name=="rif_mac_profiles") |.["occ"]')
95+
96+
[[ $occ -eq $((count - 1)) ]]
97+
check_err $? "MAC profile occupancy did not decrease"
98+
99+
log_test "RIF MAC profile consolidation"
100+
101+
ip link set $h1.20 address $h1_20_mac
102+
}
103+
75104
rif_mac_profile_shared_replacement_test()
76105
{
77106
local count=$1; shift
@@ -104,6 +133,7 @@ rif_mac_profile_edit_test()
104133
create_max_rif_mac_profiles $count
105134

106135
rif_mac_profile_replacement_test
136+
rif_mac_profile_consolidation_test $count
107137
rif_mac_profile_shared_replacement_test $count
108138
}
109139

0 commit comments

Comments
 (0)