2 # SPDX-License-Identifier: GPL-2.0
11 source ..
/..
/..
/net
/forwarding
/lib.sh
12 source ..
/..
/..
/net
/forwarding
/devlink_lib.sh
24 simple_if_init
$h1 192.0.1.1/24
29 simple_if_fini
$h1 192.0.1.1/24
34 simple_if_init
$h2 192.0.1.2/24
39 simple_if_fini
$h2 192.0.1.2/24
44 local dl_port
=$1; shift
50 max_occ
=$
(devlink sb
-j occupancy show
$dl_port \
51 | jq
-e ".[][][\"pool\"][\"$pool\"][\"max\"]")
53 if [[ "$max_occ" -ne "$exp_max_occ" ]]; then
63 local dl_port
=$1; shift
69 max_occ
=$
(devlink sb
-j occupancy show
$dl_port \
70 | jq
-e ".[][][\"itc\"][\"$itc\"][\"max\"]")
72 if [[ "$max_occ" -ne "$exp_max_occ" ]]; then
82 local dl_port
=$1; shift
84 local exp_max_occ
=$1; shift
88 max_occ
=$
(devlink sb
-j occupancy show
$dl_port \
89 | jq
-e ".[][][\"etc\"][\"$etc\"][\"max\"]")
91 if [[ "$max_occ" -ne "$exp_max_occ" ]]; then
101 local exp_max_occ
=288
104 devlink sb occupancy clearmax
$DEVLINK_DEV
106 $MZ $h1 -c 1 -p 160 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \
109 devlink sb occupancy snapshot
$DEVLINK_DEV
112 max_occ
=$
(sb_occ_pool_check
$dl_port1 $SB_POOL_ING $exp_max_occ)
113 check_err $?
"Expected iPool($SB_POOL_ING) max occupancy to be $exp_max_occ, but got $max_occ"
114 log_test
"physical port's($h1) ingress pool"
117 max_occ
=$
(sb_occ_pool_check
$dl_port2 $SB_POOL_ING $exp_max_occ)
118 check_err $?
"Expected iPool($SB_POOL_ING) max occupancy to be $exp_max_occ, but got $max_occ"
119 log_test
"physical port's($h2) ingress pool"
122 max_occ
=$
(sb_occ_pool_check
$cpu_dl_port $SB_POOL_EGR_CPU $exp_max_occ)
123 check_err $?
"Expected ePool($SB_POOL_EGR_CPU) max occupancy to be $exp_max_occ, but got $max_occ"
124 log_test
"CPU port's egress pool"
129 local exp_max_occ
=288
132 devlink sb occupancy clearmax
$DEVLINK_DEV
134 $MZ $h1 -c 1 -p 160 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \
137 devlink sb occupancy snapshot
$DEVLINK_DEV
140 max_occ
=$
(sb_occ_itc_check
$dl_port2 $SB_ITC $exp_max_occ)
141 check_err $?
"Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
142 log_test
"physical port's($h1) ingress TC - IP packet"
145 max_occ
=$
(sb_occ_itc_check
$dl_port2 $SB_ITC $exp_max_occ)
146 check_err $?
"Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
147 log_test
"physical port's($h2) ingress TC - IP packet"
150 max_occ
=$
(sb_occ_etc_check
$cpu_dl_port $SB_ITC_CPU_IP $exp_max_occ)
151 check_err $?
"Expected egress TC($SB_ITC_CPU_IP) max occupancy to be $exp_max_occ, but got $max_occ"
152 log_test
"CPU port's egress TC - IP packet"
160 if [[ $MLXSW_CHIP != "mlxsw_spectrum" ]]; then
164 devlink sb occupancy clearmax
$DEVLINK_DEV
166 $MZ $h1 -c 1 -p 160 -a $h1mac -A 192.0.1.1 -t arp
-q
168 devlink sb occupancy snapshot
$DEVLINK_DEV
171 max_occ
=$
(sb_occ_itc_check
$dl_port2 $SB_ITC $exp_max_occ)
172 check_err $?
"Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
173 log_test
"physical port's($h1) ingress TC - ARP packet"
176 max_occ
=$
(sb_occ_itc_check
$dl_port2 $SB_ITC $exp_max_occ)
177 check_err $?
"Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ"
178 log_test
"physical port's($h2) ingress TC - ARP packet"
181 max_occ
=$
(sb_occ_etc_check
$cpu_dl_port $SB_ITC_CPU_ARP $exp_max_occ)
182 check_err $?
"Expected egress TC($SB_ITC_IP2ME) max occupancy to be $exp_max_occ, but got $max_occ"
183 log_test
"CPU port's egress TC - ARP packet"
194 dl_port1
=$
(devlink_port_by_netdev
$h1)
195 dl_port2
=$
(devlink_port_by_netdev
$h2)
197 cpu_dl_port
=$
(devlink_cpu_port_get
)