2 # SPDX-License-Identifier: GPL-2.0
4 source "../../../../net/forwarding/devlink_lib.sh"
6 if [ "$DEVLINK_VIDDID" != "15b3:cb84" ]; then
7 echo "SKIP: test is tailored for Mellanox Spectrum"
11 # Needed for returning to default
12 declare -A KVD_DEFAULTS
14 KVD_CHILDREN
="linear hash_single hash_double"
15 KVDL_CHILDREN
="singles chunks large_chunks"
17 devlink_sp_resource_minimize
()
22 for i
in $KVD_CHILDREN; do
23 size
=$
(devlink_resource_get kvd
"$i" | jq
'.["size_min"]')
24 devlink_resource_size_set
"$size" kvd
"$i"
27 for i
in $KVDL_CHILDREN; do
28 size
=$
(devlink_resource_get kvd linear
"$i" | \
30 devlink_resource_size_set
"$size" kvd linear
"$i"
34 devlink_sp_size_kvd_to_default
()
39 for i
in $KVD_CHILDREN; do
40 local size
=$
(echo "${KVD_DEFAULTS[kvd_$i]}" | jq
'.["size"]')
41 current_size
=$
(devlink_resource_size_get kvd
"$i")
43 if [ "$size" -ne "$current_size" ]; then
44 devlink_resource_size_set
"$size" kvd
"$i"
49 for i
in $KVDL_CHILDREN; do
50 local size
=$
(echo "${KVD_DEFAULTS[kvd_linear_$i]}" | \
52 current_size
=$
(devlink_resource_size_get kvd linear
"$i")
54 if [ "$size" -ne "$current_size" ]; then
55 devlink_resource_size_set
"$size" kvd linear
"$i"
60 if [ "$need_reload" -ne "0" ]; then
65 devlink_sp_read_kvd_defaults
()
70 KVD_DEFAULTS
[kvd
]=$
(devlink_resource_get
"kvd")
71 for i
in $KVD_CHILDREN; do
73 KVD_DEFAULTS
[$key]=$
(devlink_resource_get kvd
"$i")
76 for i
in $KVDL_CHILDREN; do
78 KVD_DEFAULTS
[$key]=$
(devlink_resource_get kvd linear
"$i")
82 KVD_PROFILES
="default scale ipv4_max"
84 devlink_sp_resource_kvd_profile_set
()
90 devlink_resource_size_set
64000 kvd linear
91 devlink_resource_size_set
15616 kvd linear singles
92 devlink_resource_size_set
32000 kvd linear chunks
93 devlink_resource_size_set
16384 kvd linear large_chunks
94 devlink_resource_size_set
128000 kvd hash_single
95 devlink_resource_size_set
48000 kvd hash_double
99 devlink_resource_size_set
64000 kvd linear
100 devlink_resource_size_set
15616 kvd linear singles
101 devlink_resource_size_set
32000 kvd linear chunks
102 devlink_resource_size_set
16384 kvd linear large_chunks
103 devlink_resource_size_set
144000 kvd hash_single
104 devlink_resource_size_set
32768 kvd hash_double
108 devlink_resource_size_set
98304 kvd linear
109 devlink_resource_size_set
16384 kvd linear singles
110 devlink_resource_size_set
49152 kvd linear chunks
111 devlink_resource_size_set
32768 kvd linear large_chunks
112 devlink_resource_size_set
87040 kvd hash_single
113 devlink_resource_size_set
60416 kvd hash_double
117 check_err
1 "Unknown profile $profile"