Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Danielle Ratson and committed by
David S. Miller
20617717 b442f2ea

+30
+30
tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh
··· 72 72 ip link set $h1.10 address $h1_10_mac 73 73 } 74 74 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 + 75 104 rif_mac_profile_shared_replacement_test() 76 105 { 77 106 local count=$1; shift ··· 133 104 create_max_rif_mac_profiles $count 134 105 135 106 rif_mac_profile_replacement_test 107 + rif_mac_profile_consolidation_test $count 136 108 rif_mac_profile_shared_replacement_test $count 137 109 } 138 110