• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4NUM_NETIFS=6
5source ../../../../net/forwarding/lib.sh
6source ../../../../net/forwarding/tc_common.sh
7source devlink_lib_spectrum.sh
8
9current_test=""
10
11cleanup()
12{
13	pre_cleanup
14	if [ ! -z $current_test ]; then
15		${current_test}_cleanup
16	fi
17	devlink_sp_size_kvd_to_default
18}
19
20devlink_sp_read_kvd_defaults
21trap cleanup EXIT
22
23ALL_TESTS="router tc_flower mirror_gre"
24for current_test in ${TESTS:-$ALL_TESTS}; do
25	source ${current_test}_scale.sh
26
27	num_netifs_var=${current_test^^}_NUM_NETIFS
28	num_netifs=${!num_netifs_var:-$NUM_NETIFS}
29
30	for profile in $KVD_PROFILES; do
31		RET=0
32		devlink_sp_resource_kvd_profile_set $profile
33		if [[ $RET -gt 0 ]]; then
34			log_test "'$current_test' [$profile] setting"
35			continue
36		fi
37
38		for should_fail in 0 1; do
39			RET=0
40			target=$(${current_test}_get_target "$should_fail")
41			${current_test}_setup_prepare
42			setup_wait $num_netifs
43			${current_test}_test "$target" "$should_fail"
44			${current_test}_cleanup
45			if [[ "$should_fail" -eq 0 ]]; then
46				log_test "'$current_test' [$profile] $target"
47			else
48				log_test "'$current_test' [$profile] overflow $target"
49			fi
50		done
51	done
52done
53current_test=""
54
55exit "$RET"
56