linux/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
Danielle Ratson 152f98e7c5 selftests: mlxsw: Add a scale test for RIF MAC profiles
Query the maximum number of supported RIF MAC profiles using
devlink-resource and verify that all available MAC profiles can be utilized
and that an error is generated when user space tries to exceed this number.

Output example in Spectrum-2:

$ TESTS='rif_mac_profile' ./resource_scale.sh
TEST: 'rif_mac_profile' 4                                           [ OK ]
TEST: 'rif_mac_profile' overflow 5                                  [ OK ]

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>
2021-10-26 13:35:58 +01:00

60 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
lib_dir=$(dirname $0)/../../../../net/forwarding
NUM_NETIFS=6
source $lib_dir/lib.sh
source $lib_dir/tc_common.sh
source devlink_lib_spectrum.sh
current_test=""
cleanup()
{
pre_cleanup
if [ ! -z $current_test ]; then
${current_test}_cleanup
fi
devlink_sp_size_kvd_to_default
}
devlink_sp_read_kvd_defaults
trap cleanup EXIT
ALL_TESTS="router tc_flower mirror_gre tc_police port rif_mac_profile"
for current_test in ${TESTS:-$ALL_TESTS}; do
RET_FIN=0
source ${current_test}_scale.sh
num_netifs_var=${current_test^^}_NUM_NETIFS
num_netifs=${!num_netifs_var:-$NUM_NETIFS}
for profile in $KVD_PROFILES; do
RET=0
devlink_sp_resource_kvd_profile_set $profile
if [[ $RET -gt 0 ]]; then
log_test "'$current_test' [$profile] setting"
continue
fi
for should_fail in 0 1; do
RET=0
target=$(${current_test}_get_target "$should_fail")
${current_test}_setup_prepare
setup_wait $num_netifs
${current_test}_test "$target" "$should_fail"
${current_test}_cleanup
if [[ "$should_fail" -eq 0 ]]; then
log_test "'$current_test' [$profile] $target"
else
log_test "'$current_test' [$profile] overflow $target"
fi
done
RET_FIN=$(( RET_FIN || RET ))
done
done
current_test=""
exit "$RET_FIN"