Skip to content

Commit 2061771

Browse files
daniellertsdavem330
authored andcommitted
selftests: mlxsw: Add a test case for MAC profiles consolidation
Add a test case to cover the bug fixed by the previous patch. Edit the MAC address of one netdev so that it matches the MAC address of the second netdev. Verify that the two MAC profiles were consolidated by testing that the MAC profiles occupancy decreased by one. Signed-off-by: Danielle Ratson <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b442f2e commit 2061771

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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)