1fc4c93f1SJiri Pirko#!/bin/bash
2fc4c93f1SJiri Pirko# SPDX-License-Identifier: GPL-2.0
3fc4c93f1SJiri Pirko
4fc4c93f1SJiri Pirkolib_dir=$(dirname $0)/../../../net/forwarding
5fc4c93f1SJiri Pirko
6b74c37fdSJiri PirkoALL_TESTS="fw_flash_test params_test regions_test reload_test \
79b88fc54SJiri Pirko	   netns_reload_test resource_test dev_info_test \
8a27d8e35SDmytro Linkin	   empty_reporter_test dummy_reporter_test rate_test"
9fc4c93f1SJiri PirkoNUM_NETIFS=0
10fc4c93f1SJiri Pirkosource $lib_dir/lib.sh
11fc4c93f1SJiri Pirko
12fc4c93f1SJiri PirkoBUS_ADDR=10
13fc4c93f1SJiri PirkoPORT_COUNT=4
14a27d8e35SDmytro LinkinVF_COUNT=4
15fc4c93f1SJiri PirkoDEV_NAME=netdevsim$BUS_ADDR
16fc4c93f1SJiri PirkoSYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/
17fc4c93f1SJiri PirkoDEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/
18fc4c93f1SJiri PirkoDL_HANDLE=netdevsim/$DEV_NAME
19fc4c93f1SJiri Pirko
20f922c7b1SJiri Pirkowait_for_devlink()
21f922c7b1SJiri Pirko{
22f922c7b1SJiri Pirko	"$@" | grep -q $DL_HANDLE
23f922c7b1SJiri Pirko}
24f922c7b1SJiri Pirko
25f922c7b1SJiri Pirkodevlink_wait()
26f922c7b1SJiri Pirko{
27f922c7b1SJiri Pirko	local timeout=$1
28f922c7b1SJiri Pirko
29f922c7b1SJiri Pirko	busywait "$timeout" wait_for_devlink devlink dev
30f922c7b1SJiri Pirko}
31f922c7b1SJiri Pirko
32fc4c93f1SJiri Pirkofw_flash_test()
33fc4c93f1SJiri Pirko{
34*b819a848SJakub Kicinski	DUMMYFILE=$(find /lib/firmware -type f -printf '%P\n' | head -1)
35fc4c93f1SJiri Pirko	RET=0
36fc4c93f1SJiri Pirko
376151ff9cSJiri Pirko	if [ -z "$DUMMYFILE" ]
386151ff9cSJiri Pirko	then
396151ff9cSJiri Pirko		echo "SKIP: unable to find suitable dummy firmware file"
406151ff9cSJiri Pirko		return
416151ff9cSJiri Pirko	fi
426151ff9cSJiri Pirko
436151ff9cSJiri Pirko	devlink dev flash $DL_HANDLE file $DUMMYFILE
44fc4c93f1SJiri Pirko	check_err $? "Failed to flash with status updates on"
45fc4c93f1SJiri Pirko
466151ff9cSJiri Pirko	devlink dev flash $DL_HANDLE file $DUMMYFILE component fw.mgmt
47bc75c054SJacob Keller	check_err $? "Failed to flash with component attribute"
48bc75c054SJacob Keller
496151ff9cSJiri Pirko	devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite settings
50cbb58368SJacob Keller	check_fail $? "Flash with overwrite settings should be rejected"
51cbb58368SJacob Keller
52cbb58368SJacob Keller	echo "1"> $DEBUGFS_DIR/fw_update_overwrite_mask
53cbb58368SJacob Keller	check_err $? "Failed to change allowed overwrite mask"
54cbb58368SJacob Keller
556151ff9cSJiri Pirko	devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite settings
56cbb58368SJacob Keller	check_err $? "Failed to flash with settings overwrite enabled"
57cbb58368SJacob Keller
586151ff9cSJiri Pirko	devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite identifiers
59cbb58368SJacob Keller	check_fail $? "Flash with overwrite settings should be identifiers"
60cbb58368SJacob Keller
61cbb58368SJacob Keller	echo "3"> $DEBUGFS_DIR/fw_update_overwrite_mask
62cbb58368SJacob Keller	check_err $? "Failed to change allowed overwrite mask"
63cbb58368SJacob Keller
646151ff9cSJiri Pirko	devlink dev flash $DL_HANDLE file $DUMMYFILE overwrite identifiers overwrite settings
65cbb58368SJacob Keller	check_err $? "Failed to flash with settings and identifiers overwrite enabled"
66cbb58368SJacob Keller
67fc4c93f1SJiri Pirko	echo "n"> $DEBUGFS_DIR/fw_update_status
68fc4c93f1SJiri Pirko	check_err $? "Failed to disable status updates"
69fc4c93f1SJiri Pirko
706151ff9cSJiri Pirko	devlink dev flash $DL_HANDLE file $DUMMYFILE
71fc4c93f1SJiri Pirko	check_err $? "Failed to flash with status updates off"
72fc4c93f1SJiri Pirko
73fc4c93f1SJiri Pirko	log_test "fw flash test"
74fc4c93f1SJiri Pirko}
75fc4c93f1SJiri Pirko
76dc8a670aSJiri Pirkoparam_get()
77dc8a670aSJiri Pirko{
78dc8a670aSJiri Pirko	local name=$1
79dc8a670aSJiri Pirko
80dc8a670aSJiri Pirko	cmd_jq "devlink dev param show $DL_HANDLE name $name -j" \
81dc8a670aSJiri Pirko	       '.[][][].values[] | select(.cmode == "driverinit").value'
82dc8a670aSJiri Pirko}
83dc8a670aSJiri Pirko
84dc8a670aSJiri Pirkoparam_set()
85dc8a670aSJiri Pirko{
86dc8a670aSJiri Pirko	local name=$1
87dc8a670aSJiri Pirko	local value=$2
88dc8a670aSJiri Pirko
89dc8a670aSJiri Pirko	devlink dev param set $DL_HANDLE name $name cmode driverinit value $value
90dc8a670aSJiri Pirko}
91dc8a670aSJiri Pirko
92dc8a670aSJiri Pirkocheck_value()
93dc8a670aSJiri Pirko{
94dc8a670aSJiri Pirko	local name=$1
95dc8a670aSJiri Pirko	local phase_name=$2
96dc8a670aSJiri Pirko	local expected_param_value=$3
97dc8a670aSJiri Pirko	local expected_debugfs_value=$4
98dc8a670aSJiri Pirko	local value
99dc8a670aSJiri Pirko
100dc8a670aSJiri Pirko	value=$(param_get $name)
101dc8a670aSJiri Pirko	check_err $? "Failed to get $name param value"
102dc8a670aSJiri Pirko	[ "$value" == "$expected_param_value" ]
103dc8a670aSJiri Pirko	check_err $? "Unexpected $phase_name $name param value"
104dc8a670aSJiri Pirko	value=$(<$DEBUGFS_DIR/$name)
105dc8a670aSJiri Pirko	check_err $? "Failed to get $name debugfs value"
106dc8a670aSJiri Pirko	[ "$value" == "$expected_debugfs_value" ]
107dc8a670aSJiri Pirko	check_err $? "Unexpected $phase_name $name debugfs value"
108dc8a670aSJiri Pirko}
109dc8a670aSJiri Pirko
110dc8a670aSJiri Pirkoparams_test()
111dc8a670aSJiri Pirko{
112dc8a670aSJiri Pirko	RET=0
113dc8a670aSJiri Pirko
114dc8a670aSJiri Pirko	local max_macs
115dc8a670aSJiri Pirko	local test1
116dc8a670aSJiri Pirko
117dc8a670aSJiri Pirko	check_value max_macs initial 32 32
118dc8a670aSJiri Pirko	check_value test1 initial true Y
119dc8a670aSJiri Pirko
120dc8a670aSJiri Pirko	param_set max_macs 16
121dc8a670aSJiri Pirko	check_err $? "Failed to set max_macs param value"
122dc8a670aSJiri Pirko	param_set test1 false
123dc8a670aSJiri Pirko	check_err $? "Failed to set test1 param value"
124dc8a670aSJiri Pirko
125dc8a670aSJiri Pirko	check_value max_macs post-set 16 32
126dc8a670aSJiri Pirko	check_value test1 post-set false Y
127dc8a670aSJiri Pirko
128dc8a670aSJiri Pirko	devlink dev reload $DL_HANDLE
129dc8a670aSJiri Pirko
130dc8a670aSJiri Pirko	check_value max_macs post-reload 16 16
131dc8a670aSJiri Pirko	check_value test1 post-reload false N
132dc8a670aSJiri Pirko
133dc8a670aSJiri Pirko	log_test "params test"
134dc8a670aSJiri Pirko}
135dc8a670aSJiri Pirko
1365156d7efSJiri Pirkocheck_region_size()
1375156d7efSJiri Pirko{
1385156d7efSJiri Pirko	local name=$1
1395156d7efSJiri Pirko	local size
1405156d7efSJiri Pirko
1415156d7efSJiri Pirko	size=$(devlink region show $DL_HANDLE/$name -j | jq -e -r '.[][].size')
1425156d7efSJiri Pirko	check_err $? "Failed to get $name region size"
1435156d7efSJiri Pirko	[ $size -eq 32768 ]
1445156d7efSJiri Pirko	check_err $? "Invalid $name region size"
1455156d7efSJiri Pirko}
1465156d7efSJiri Pirko
1475156d7efSJiri Pirkocheck_region_snapshot_count()
1485156d7efSJiri Pirko{
1495156d7efSJiri Pirko	local name=$1
1505156d7efSJiri Pirko	local phase_name=$2
1515156d7efSJiri Pirko	local expected_count=$3
1525156d7efSJiri Pirko	local count
1535156d7efSJiri Pirko
1545156d7efSJiri Pirko	count=$(devlink region show $DL_HANDLE/$name -j | jq -e -r '.[][].snapshot | length')
1555156d7efSJiri Pirko	[ $count -eq $expected_count ]
1565156d7efSJiri Pirko	check_err $? "Unexpected $phase_name snapshot count"
1575156d7efSJiri Pirko}
1585156d7efSJiri Pirko
1595156d7efSJiri Pirkoregions_test()
1605156d7efSJiri Pirko{
1615156d7efSJiri Pirko	RET=0
1625156d7efSJiri Pirko
1635156d7efSJiri Pirko	local count
1645156d7efSJiri Pirko
1655156d7efSJiri Pirko	check_region_size dummy
1665156d7efSJiri Pirko	check_region_snapshot_count dummy initial 0
1675156d7efSJiri Pirko
1685156d7efSJiri Pirko	echo ""> $DEBUGFS_DIR/take_snapshot
1695156d7efSJiri Pirko	check_err $? "Failed to take first dummy region snapshot"
1705156d7efSJiri Pirko	check_region_snapshot_count dummy post-first-snapshot 1
1715156d7efSJiri Pirko
1725156d7efSJiri Pirko	echo ""> $DEBUGFS_DIR/take_snapshot
1735156d7efSJiri Pirko	check_err $? "Failed to take second dummy region snapshot"
1745156d7efSJiri Pirko	check_region_snapshot_count dummy post-second-snapshot 2
1755156d7efSJiri Pirko
1765156d7efSJiri Pirko	echo ""> $DEBUGFS_DIR/take_snapshot
1775156d7efSJiri Pirko	check_err $? "Failed to take third dummy region snapshot"
1785156d7efSJiri Pirko	check_region_snapshot_count dummy post-third-snapshot 3
1795156d7efSJiri Pirko
1805156d7efSJiri Pirko	devlink region del $DL_HANDLE/dummy snapshot 1
1815156d7efSJiri Pirko	check_err $? "Failed to delete first dummy region snapshot"
1825156d7efSJiri Pirko
1835156d7efSJiri Pirko	check_region_snapshot_count dummy post-first-delete 2
1845156d7efSJiri Pirko
1853fe0fd53SJacob Keller	devlink region new $DL_HANDLE/dummy snapshot 25
1863fe0fd53SJacob Keller	check_err $? "Failed to create a new snapshot with id 25"
1873fe0fd53SJacob Keller
1883fe0fd53SJacob Keller	check_region_snapshot_count dummy post-first-request 3
1893fe0fd53SJacob Keller
1905a46b062SJakub Kicinski	devlink region dump $DL_HANDLE/dummy snapshot 25 >> /dev/null
1915a46b062SJakub Kicinski	check_err $? "Failed to dump snapshot with id 25"
1925a46b062SJakub Kicinski
1935a46b062SJakub Kicinski	devlink region read $DL_HANDLE/dummy snapshot 25 addr 0 len 1 >> /dev/null
1945a46b062SJakub Kicinski	check_err $? "Failed to read snapshot with id 25 (1 byte)"
1955a46b062SJakub Kicinski
1965a46b062SJakub Kicinski	devlink region read $DL_HANDLE/dummy snapshot 25 addr 128 len 128 >> /dev/null
1975a46b062SJakub Kicinski	check_err $? "Failed to read snapshot with id 25 (128 bytes)"
1985a46b062SJakub Kicinski
1995a46b062SJakub Kicinski	devlink region read $DL_HANDLE/dummy snapshot 25 addr 128 len $((1<<32)) >> /dev/null
2005a46b062SJakub Kicinski	check_err $? "Failed to read snapshot with id 25 (oversized)"
2015a46b062SJakub Kicinski
2025a46b062SJakub Kicinski	devlink region read $DL_HANDLE/dummy snapshot 25 addr $((1<<32)) len 128 >> /dev/null 2>&1
2035a46b062SJakub Kicinski	check_fail $? "Bad read of snapshot with id 25 did not fail"
2045a46b062SJakub Kicinski
2053fe0fd53SJacob Keller	devlink region del $DL_HANDLE/dummy snapshot 25
2063fe0fd53SJacob Keller	check_err $? "Failed to delete snapshot with id 25"
2073fe0fd53SJacob Keller
2083fe0fd53SJacob Keller	check_region_snapshot_count dummy post-second-delete 2
2093fe0fd53SJacob Keller
210043b3e22SJakub Kicinski	sid=$(devlink -j region new $DL_HANDLE/dummy | jq '.[][][][]')
211043b3e22SJakub Kicinski	check_err $? "Failed to create a new snapshot with id allocated by the kernel"
212043b3e22SJakub Kicinski
213043b3e22SJakub Kicinski	check_region_snapshot_count dummy post-first-request 3
214043b3e22SJakub Kicinski
215043b3e22SJakub Kicinski	devlink region dump $DL_HANDLE/dummy snapshot $sid >> /dev/null
216043b3e22SJakub Kicinski	check_err $? "Failed to dump a snapshot with id allocated by the kernel"
217043b3e22SJakub Kicinski
218043b3e22SJakub Kicinski	devlink region del $DL_HANDLE/dummy snapshot $sid
219043b3e22SJakub Kicinski	check_err $? "Failed to delete snapshot with id allocated by the kernel"
220043b3e22SJakub Kicinski
221043b3e22SJakub Kicinski	check_region_snapshot_count dummy post-first-request 2
222043b3e22SJakub Kicinski
2235156d7efSJiri Pirko	log_test "regions test"
2245156d7efSJiri Pirko}
2255156d7efSJiri Pirko
226b74c37fdSJiri Pirkoreload_test()
227b74c37fdSJiri Pirko{
228b74c37fdSJiri Pirko	RET=0
229b74c37fdSJiri Pirko
230b74c37fdSJiri Pirko	devlink dev reload $DL_HANDLE
231b74c37fdSJiri Pirko	check_err $? "Failed to reload"
232b74c37fdSJiri Pirko
2339278bc9fSJiri Pirko	echo "y"> $DEBUGFS_DIR/fail_reload
2349278bc9fSJiri Pirko	check_err $? "Failed to setup devlink reload to fail"
2359278bc9fSJiri Pirko
2369278bc9fSJiri Pirko	devlink dev reload $DL_HANDLE
2379278bc9fSJiri Pirko	check_fail $? "Unexpected success of devlink reload"
2389278bc9fSJiri Pirko
2399278bc9fSJiri Pirko	echo "n"> $DEBUGFS_DIR/fail_reload
2409278bc9fSJiri Pirko	check_err $? "Failed to setup devlink reload not to fail"
2419278bc9fSJiri Pirko
2429278bc9fSJiri Pirko	devlink dev reload $DL_HANDLE
2439278bc9fSJiri Pirko	check_err $? "Failed to reload after set not to fail"
2449278bc9fSJiri Pirko
2459278bc9fSJiri Pirko	echo "y"> $DEBUGFS_DIR/dont_allow_reload
2469278bc9fSJiri Pirko	check_err $? "Failed to forbid devlink reload"
2479278bc9fSJiri Pirko
2489278bc9fSJiri Pirko	devlink dev reload $DL_HANDLE
2499278bc9fSJiri Pirko	check_fail $? "Unexpected success of devlink reload"
2509278bc9fSJiri Pirko
2519278bc9fSJiri Pirko	echo "n"> $DEBUGFS_DIR/dont_allow_reload
2529278bc9fSJiri Pirko	check_err $? "Failed to re-enable devlink reload"
2539278bc9fSJiri Pirko
2549278bc9fSJiri Pirko	devlink dev reload $DL_HANDLE
2559278bc9fSJiri Pirko	check_err $? "Failed to reload after re-enable"
2569278bc9fSJiri Pirko
257b74c37fdSJiri Pirko	log_test "reload test"
258b74c37fdSJiri Pirko}
259b74c37fdSJiri Pirko
260b74c37fdSJiri Pirkonetns_reload_test()
261b74c37fdSJiri Pirko{
262b74c37fdSJiri Pirko	RET=0
263b74c37fdSJiri Pirko
264b74c37fdSJiri Pirko	ip netns add testns1
265b74c37fdSJiri Pirko	check_err $? "Failed add netns \"testns1\""
266b74c37fdSJiri Pirko	ip netns add testns2
267b74c37fdSJiri Pirko	check_err $? "Failed add netns \"testns2\""
268b74c37fdSJiri Pirko
269b74c37fdSJiri Pirko	devlink dev reload $DL_HANDLE netns testns1
270b74c37fdSJiri Pirko	check_err $? "Failed to reload into netns \"testns1\""
271b74c37fdSJiri Pirko
272b74c37fdSJiri Pirko	devlink -N testns1 dev reload $DL_HANDLE netns testns2
273b74c37fdSJiri Pirko	check_err $? "Failed to reload from netns \"testns1\" into netns \"testns2\""
274b74c37fdSJiri Pirko
275b74c37fdSJiri Pirko	ip netns del testns2
276b74c37fdSJiri Pirko	ip netns del testns1
277b74c37fdSJiri Pirko
278f922c7b1SJiri Pirko	# Wait until netns async cleanup is done.
279f922c7b1SJiri Pirko	devlink_wait 2000
280f922c7b1SJiri Pirko
281b74c37fdSJiri Pirko	log_test "netns reload test"
282b74c37fdSJiri Pirko}
283b74c37fdSJiri Pirko
284b74c37fdSJiri PirkoDUMMYDEV="dummytest"
285b74c37fdSJiri Pirko
286b74c37fdSJiri Pirkores_val_get()
287b74c37fdSJiri Pirko{
288b74c37fdSJiri Pirko	local netns=$1
289b74c37fdSJiri Pirko	local parentname=$2
290b74c37fdSJiri Pirko	local name=$3
291b74c37fdSJiri Pirko	local type=$4
292b74c37fdSJiri Pirko
293b74c37fdSJiri Pirko	cmd_jq "devlink -N $netns resource show $DL_HANDLE -j" \
294b74c37fdSJiri Pirko	       ".[][][] | select(.name == \"$parentname\").resources[] \
295b74c37fdSJiri Pirko	        | select(.name == \"$name\").$type"
296b74c37fdSJiri Pirko}
297b74c37fdSJiri Pirko
298b74c37fdSJiri Pirkoresource_test()
299b74c37fdSJiri Pirko{
300b74c37fdSJiri Pirko	RET=0
301b74c37fdSJiri Pirko
302b74c37fdSJiri Pirko	ip netns add testns1
303b74c37fdSJiri Pirko	check_err $? "Failed add netns \"testns1\""
304b74c37fdSJiri Pirko	ip netns add testns2
305b74c37fdSJiri Pirko	check_err $? "Failed add netns \"testns2\""
306b74c37fdSJiri Pirko
307b74c37fdSJiri Pirko	devlink dev reload $DL_HANDLE netns testns1
308b74c37fdSJiri Pirko	check_err $? "Failed to reload into netns \"testns1\""
309b74c37fdSJiri Pirko
310b74c37fdSJiri Pirko	# Create dummy dev to add the address and routes on.
311b74c37fdSJiri Pirko
312b74c37fdSJiri Pirko	ip -n testns1 link add name $DUMMYDEV type dummy
313b74c37fdSJiri Pirko	check_err $? "Failed create dummy device"
314b74c37fdSJiri Pirko	ip -n testns1 link set $DUMMYDEV up
315b74c37fdSJiri Pirko	check_err $? "Failed bring up dummy device"
316b74c37fdSJiri Pirko	ip -n testns1 a a 192.0.1.1/24 dev $DUMMYDEV
317b74c37fdSJiri Pirko	check_err $? "Failed add an IP address to dummy device"
318b74c37fdSJiri Pirko
319b74c37fdSJiri Pirko	local occ=$(res_val_get testns1 IPv4 fib occ)
320b74c37fdSJiri Pirko	local limit=$((occ+1))
321b74c37fdSJiri Pirko
322b74c37fdSJiri Pirko	# Set fib size limit to handle one another route only.
323b74c37fdSJiri Pirko
324b74c37fdSJiri Pirko	devlink -N testns1 resource set $DL_HANDLE path IPv4/fib size $limit
325b74c37fdSJiri Pirko	check_err $? "Failed to set IPv4/fib resource size"
326b74c37fdSJiri Pirko	local size_new=$(res_val_get testns1 IPv4 fib size_new)
327b74c37fdSJiri Pirko	[ "$size_new" -eq "$limit" ]
328b74c37fdSJiri Pirko	check_err $? "Unexpected \"size_new\" value (got $size_new, expected $limit)"
329b74c37fdSJiri Pirko
330b74c37fdSJiri Pirko	devlink -N testns1 dev reload $DL_HANDLE
331b74c37fdSJiri Pirko	check_err $? "Failed to reload"
332b74c37fdSJiri Pirko	local size=$(res_val_get testns1 IPv4 fib size)
333b74c37fdSJiri Pirko	[ "$size" -eq "$limit" ]
334b74c37fdSJiri Pirko	check_err $? "Unexpected \"size\" value (got $size, expected $limit)"
335b74c37fdSJiri Pirko
336b74c37fdSJiri Pirko	# Insert 2 routes, the first is going to be inserted,
337b74c37fdSJiri Pirko	# the second is expected to fail to be inserted.
338b74c37fdSJiri Pirko
339b74c37fdSJiri Pirko	ip -n testns1 r a 192.0.2.0/24 via 192.0.1.2
340b74c37fdSJiri Pirko	check_err $? "Failed to add route"
341b74c37fdSJiri Pirko
342b74c37fdSJiri Pirko	ip -n testns1 r a 192.0.3.0/24 via 192.0.1.2
343b74c37fdSJiri Pirko	check_fail $? "Unexpected successful route add over limit"
344b74c37fdSJiri Pirko
345b74c37fdSJiri Pirko	# Now create another dummy in second network namespace and
346b74c37fdSJiri Pirko	# insert two routes. That is over the limit of the netdevsim
347b74c37fdSJiri Pirko	# instance in the first namespace. Move the netdevsim instance
348b74c37fdSJiri Pirko	# into the second namespace and expect it to fail.
349b74c37fdSJiri Pirko
350b74c37fdSJiri Pirko	ip -n testns2 link add name $DUMMYDEV type dummy
351b74c37fdSJiri Pirko	check_err $? "Failed create dummy device"
352b74c37fdSJiri Pirko	ip -n testns2 link set $DUMMYDEV up
353b74c37fdSJiri Pirko	check_err $? "Failed bring up dummy device"
354b74c37fdSJiri Pirko	ip -n testns2 a a 192.0.1.1/24 dev $DUMMYDEV
355b74c37fdSJiri Pirko	check_err $? "Failed add an IP address to dummy device"
356b74c37fdSJiri Pirko	ip -n testns2 r a 192.0.2.0/24 via 192.0.1.2
357b74c37fdSJiri Pirko	check_err $? "Failed to add route"
358b74c37fdSJiri Pirko	ip -n testns2 r a 192.0.3.0/24 via 192.0.1.2
359b74c37fdSJiri Pirko	check_err $? "Failed to add route"
360b74c37fdSJiri Pirko
361b74c37fdSJiri Pirko	devlink -N testns1 dev reload $DL_HANDLE netns testns2
362b74c37fdSJiri Pirko	check_fail $? "Unexpected successful reload from netns \"testns1\" into netns \"testns2\""
363b74c37fdSJiri Pirko
364462ef975SJakub Kicinski	devlink -N testns2 resource set $DL_HANDLE path IPv4/fib size ' -1'
365462ef975SJakub Kicinski	check_err $? "Failed to reset IPv4/fib resource size"
366462ef975SJakub Kicinski
367462ef975SJakub Kicinski	devlink -N testns2 dev reload $DL_HANDLE netns 1
368462ef975SJakub Kicinski	check_err $? "Failed to reload devlink back"
369462ef975SJakub Kicinski
370b74c37fdSJiri Pirko	ip netns del testns2
371b74c37fdSJiri Pirko	ip netns del testns1
372b74c37fdSJiri Pirko
373f922c7b1SJiri Pirko	# Wait until netns async cleanup is done.
374f922c7b1SJiri Pirko	devlink_wait 2000
375f922c7b1SJiri Pirko
376b74c37fdSJiri Pirko	log_test "resource test"
377b74c37fdSJiri Pirko}
378b74c37fdSJiri Pirko
37962ede55fSJiri Pirkoinfo_get()
38062ede55fSJiri Pirko{
38162ede55fSJiri Pirko	local name=$1
38262ede55fSJiri Pirko
38362ede55fSJiri Pirko	cmd_jq "devlink dev info $DL_HANDLE -j" ".[][][\"$name\"]" "-e"
38462ede55fSJiri Pirko}
38562ede55fSJiri Pirko
38662ede55fSJiri Pirkodev_info_test()
38762ede55fSJiri Pirko{
38862ede55fSJiri Pirko	RET=0
38962ede55fSJiri Pirko
39062ede55fSJiri Pirko	driver=$(info_get "driver")
39162ede55fSJiri Pirko	check_err $? "Failed to get driver name"
39262ede55fSJiri Pirko	[ "$driver" == "netdevsim" ]
39362ede55fSJiri Pirko	check_err $? "Unexpected driver name $driver"
39462ede55fSJiri Pirko
39562ede55fSJiri Pirko	log_test "dev_info test"
39662ede55fSJiri Pirko}
39762ede55fSJiri Pirko
3989b88fc54SJiri Pirkoempty_reporter_test()
3999b88fc54SJiri Pirko{
4009b88fc54SJiri Pirko	RET=0
4019b88fc54SJiri Pirko
4029b88fc54SJiri Pirko	devlink health show $DL_HANDLE reporter empty >/dev/null
4039b88fc54SJiri Pirko	check_err $? "Failed show empty reporter"
4049b88fc54SJiri Pirko
4059b88fc54SJiri Pirko	devlink health dump show $DL_HANDLE reporter empty >/dev/null
4069b88fc54SJiri Pirko	check_err $? "Failed show dump of empty reporter"
4079b88fc54SJiri Pirko
4089b88fc54SJiri Pirko	devlink health diagnose $DL_HANDLE reporter empty >/dev/null
4099b88fc54SJiri Pirko	check_err $? "Failed diagnose empty reporter"
4109b88fc54SJiri Pirko
4119b88fc54SJiri Pirko	devlink health recover $DL_HANDLE reporter empty
4129b88fc54SJiri Pirko	check_err $? "Failed recover empty reporter"
4139b88fc54SJiri Pirko
4149b88fc54SJiri Pirko	log_test "empty reporter test"
4159b88fc54SJiri Pirko}
4169b88fc54SJiri Pirko
4179b88fc54SJiri Pirkocheck_reporter_info()
4189b88fc54SJiri Pirko{
4199b88fc54SJiri Pirko	local name=$1
4209b88fc54SJiri Pirko	local expected_state=$2
4219b88fc54SJiri Pirko	local expected_error=$3
4229b88fc54SJiri Pirko	local expected_recover=$4
4239b88fc54SJiri Pirko	local expected_grace_period=$5
4249b88fc54SJiri Pirko	local expected_auto_recover=$6
4259b88fc54SJiri Pirko
4269b88fc54SJiri Pirko	local show=$(devlink health show $DL_HANDLE reporter $name -j | jq -e -r ".[][][]")
4279b88fc54SJiri Pirko	check_err $? "Failed show $name reporter"
4289b88fc54SJiri Pirko
4299b88fc54SJiri Pirko	local state=$(echo $show | jq -r ".state")
4309b88fc54SJiri Pirko	[ "$state" == "$expected_state" ]
4319b88fc54SJiri Pirko	check_err $? "Unexpected \"state\" value (got $state, expected $expected_state)"
4329b88fc54SJiri Pirko
4339b88fc54SJiri Pirko	local error=$(echo $show | jq -r ".error")
4349b88fc54SJiri Pirko	[ "$error" == "$expected_error" ]
4359b88fc54SJiri Pirko	check_err $? "Unexpected \"error\" value (got $error, expected $expected_error)"
4369b88fc54SJiri Pirko
4379b88fc54SJiri Pirko	local recover=`echo $show | jq -r ".recover"`
4389b88fc54SJiri Pirko	[ "$recover" == "$expected_recover" ]
4399b88fc54SJiri Pirko	check_err $? "Unexpected \"recover\" value (got $recover, expected $expected_recover)"
4409b88fc54SJiri Pirko
4419b88fc54SJiri Pirko	local grace_period=$(echo $show | jq -r ".grace_period")
4429b88fc54SJiri Pirko	check_err $? "Failed get $name reporter grace_period"
4439b88fc54SJiri Pirko	[ "$grace_period" == "$expected_grace_period" ]
4449b88fc54SJiri Pirko	check_err $? "Unexpected \"grace_period\" value (got $grace_period, expected $expected_grace_period)"
4459b88fc54SJiri Pirko
4469b88fc54SJiri Pirko	local auto_recover=$(echo $show | jq -r ".auto_recover")
4479b88fc54SJiri Pirko	[ "$auto_recover" == "$expected_auto_recover" ]
4489b88fc54SJiri Pirko	check_err $? "Unexpected \"auto_recover\" value (got $auto_recover, expected $expected_auto_recover)"
4499b88fc54SJiri Pirko}
4509b88fc54SJiri Pirko
4519b88fc54SJiri Pirkodummy_reporter_test()
4529b88fc54SJiri Pirko{
4539b88fc54SJiri Pirko	RET=0
4549b88fc54SJiri Pirko
455c7f0d4c8SEran Ben Elisha	check_reporter_info dummy healthy 0 0 0 true
456c7f0d4c8SEran Ben Elisha
457c7f0d4c8SEran Ben Elisha	devlink health set $DL_HANDLE reporter dummy auto_recover false
458c7f0d4c8SEran Ben Elisha	check_err $? "Failed to dummy reporter auto_recover option"
459c7f0d4c8SEran Ben Elisha
4609b88fc54SJiri Pirko	check_reporter_info dummy healthy 0 0 0 false
4619b88fc54SJiri Pirko
4629b88fc54SJiri Pirko	local BREAK_MSG="foo bar"
4639b88fc54SJiri Pirko	echo "$BREAK_MSG"> $DEBUGFS_DIR/health/break_health
4649b88fc54SJiri Pirko	check_err $? "Failed to break dummy reporter"
4659b88fc54SJiri Pirko
4669b88fc54SJiri Pirko	check_reporter_info dummy error 1 0 0 false
4679b88fc54SJiri Pirko
4689b88fc54SJiri Pirko	local dump=$(devlink health dump show $DL_HANDLE reporter dummy -j)
4699b88fc54SJiri Pirko	check_err $? "Failed show dump of dummy reporter"
4709b88fc54SJiri Pirko
4719b88fc54SJiri Pirko	local dump_break_msg=$(echo $dump | jq -r ".break_message")
4729b88fc54SJiri Pirko	[ "$dump_break_msg" == "$BREAK_MSG" ]
4739b88fc54SJiri Pirko	check_err $? "Unexpected dump break message value (got $dump_break_msg, expected $BREAK_MSG)"
4749b88fc54SJiri Pirko
4759b88fc54SJiri Pirko	devlink health dump clear $DL_HANDLE reporter dummy
4769b88fc54SJiri Pirko	check_err $? "Failed clear dump of dummy reporter"
4779b88fc54SJiri Pirko
4789b88fc54SJiri Pirko	devlink health recover $DL_HANDLE reporter dummy
4799b88fc54SJiri Pirko	check_err $? "Failed recover dummy reporter"
4809b88fc54SJiri Pirko
4819b88fc54SJiri Pirko	check_reporter_info dummy healthy 1 1 0 false
4829b88fc54SJiri Pirko
4839b88fc54SJiri Pirko	devlink health set $DL_HANDLE reporter dummy auto_recover true
4849b88fc54SJiri Pirko	check_err $? "Failed to dummy reporter auto_recover option"
4859b88fc54SJiri Pirko
4869b88fc54SJiri Pirko	check_reporter_info dummy healthy 1 1 0 true
4879b88fc54SJiri Pirko
4889b88fc54SJiri Pirko	echo "$BREAK_MSG"> $DEBUGFS_DIR/health/break_health
4899b88fc54SJiri Pirko	check_err $? "Failed to break dummy reporter"
4909b88fc54SJiri Pirko
4919b88fc54SJiri Pirko	check_reporter_info dummy healthy 2 2 0 true
4929b88fc54SJiri Pirko
4939b88fc54SJiri Pirko	local diagnose=$(devlink health diagnose $DL_HANDLE reporter dummy -j -p)
4949b88fc54SJiri Pirko	check_err $? "Failed show diagnose of dummy reporter"
4959b88fc54SJiri Pirko
4969b88fc54SJiri Pirko	local rcvrd_break_msg=$(echo $diagnose | jq -r ".recovered_break_message")
4979b88fc54SJiri Pirko	[ "$rcvrd_break_msg" == "$BREAK_MSG" ]
4989b88fc54SJiri Pirko	check_err $? "Unexpected recovered break message value (got $rcvrd_break_msg, expected $BREAK_MSG)"
4999b88fc54SJiri Pirko
5009b88fc54SJiri Pirko	devlink health set $DL_HANDLE reporter dummy grace_period 10
5019b88fc54SJiri Pirko	check_err $? "Failed to dummy reporter grace_period option"
5029b88fc54SJiri Pirko
5039b88fc54SJiri Pirko	check_reporter_info dummy healthy 2 2 10 true
5049b88fc54SJiri Pirko
5059b88fc54SJiri Pirko	echo "Y"> $DEBUGFS_DIR/health/fail_recover
5069b88fc54SJiri Pirko	check_err $? "Failed set dummy reporter recovery to fail"
5079b88fc54SJiri Pirko
5089b88fc54SJiri Pirko	echo "$BREAK_MSG"> $DEBUGFS_DIR/health/break_health
5099b88fc54SJiri Pirko	check_fail $? "Unexpected success of dummy reporter break"
5109b88fc54SJiri Pirko
5119b88fc54SJiri Pirko	check_reporter_info dummy error 3 2 10 true
5129b88fc54SJiri Pirko
5139b88fc54SJiri Pirko	devlink health recover $DL_HANDLE reporter dummy
5149b88fc54SJiri Pirko	check_fail $? "Unexpected success of dummy reporter recover"
5159b88fc54SJiri Pirko
5169b88fc54SJiri Pirko	echo "N"> $DEBUGFS_DIR/health/fail_recover
5179b88fc54SJiri Pirko	check_err $? "Failed set dummy reporter recovery to be successful"
5189b88fc54SJiri Pirko
5199b88fc54SJiri Pirko	devlink health recover $DL_HANDLE reporter dummy
5209b88fc54SJiri Pirko	check_err $? "Failed recover dummy reporter"
5219b88fc54SJiri Pirko
5229b88fc54SJiri Pirko	check_reporter_info dummy healthy 3 3 10 true
5239b88fc54SJiri Pirko
524ff18176aSAya Levin	echo 8192 > $DEBUGFS_DIR/health/binary_len
5252fc60e2fSJakub Kicinski	check_err $? "Failed set dummy reporter binary len to 8192"
526ff18176aSAya Levin
527ff18176aSAya Levin	local dump=$(devlink health dump show $DL_HANDLE reporter dummy -j)
528ff18176aSAya Levin	check_err $? "Failed show dump of dummy reporter"
529ff18176aSAya Levin
530ff18176aSAya Levin	devlink health dump clear $DL_HANDLE reporter dummy
531ff18176aSAya Levin	check_err $? "Failed clear dump of dummy reporter"
532ff18176aSAya Levin
5339b88fc54SJiri Pirko	log_test "dummy reporter test"
5349b88fc54SJiri Pirko}
5359b88fc54SJiri Pirko
536a27d8e35SDmytro Linkinrate_leafs_get()
537a27d8e35SDmytro Linkin{
538a27d8e35SDmytro Linkin	local handle=$1
539a27d8e35SDmytro Linkin
540a27d8e35SDmytro Linkin	cmd_jq "devlink port function rate show -j" \
541a27d8e35SDmytro Linkin	       '.[] | to_entries | .[] | select(.value.type == "leaf") | .key | select(contains("'$handle'"))'
542a27d8e35SDmytro Linkin}
543a27d8e35SDmytro Linkin
544413ee943SDmytro Linkinrate_nodes_get()
545413ee943SDmytro Linkin{
546413ee943SDmytro Linkin	local handle=$1
547413ee943SDmytro Linkin
548413ee943SDmytro Linkin	cmd_jq "devlink port function rate show -j" \
549413ee943SDmytro Linkin		'.[] | to_entries | .[] | select(.value.type == "node") | .key | select(contains("'$handle'"))'
550413ee943SDmytro Linkin}
551413ee943SDmytro Linkin
55231f07233SDmytro Linkinrate_attr_set()
55331f07233SDmytro Linkin{
55431f07233SDmytro Linkin	local handle=$1
55531f07233SDmytro Linkin	local name=$2
55631f07233SDmytro Linkin	local value=$3
55731f07233SDmytro Linkin	local units=$4
55831f07233SDmytro Linkin
55931f07233SDmytro Linkin	devlink port function rate set $handle $name $value$units
56031f07233SDmytro Linkin}
56131f07233SDmytro Linkin
56231f07233SDmytro Linkinrate_attr_get()
56331f07233SDmytro Linkin{
56431f07233SDmytro Linkin	local handle=$1
56531f07233SDmytro Linkin	local name=$2
56631f07233SDmytro Linkin
56731f07233SDmytro Linkin	cmd_jq "devlink port function rate show $handle -j" '.[][].'$name
56831f07233SDmytro Linkin}
56931f07233SDmytro Linkin
57031f07233SDmytro Linkinrate_attr_tx_rate_check()
57131f07233SDmytro Linkin{
57231f07233SDmytro Linkin	local handle=$1
57331f07233SDmytro Linkin	local name=$2
57431f07233SDmytro Linkin	local rate=$3
57531f07233SDmytro Linkin	local debug_file=$4
57631f07233SDmytro Linkin
57731f07233SDmytro Linkin	rate_attr_set $handle $name $rate mbit
57831f07233SDmytro Linkin	check_err $? "Failed to set $name value"
57931f07233SDmytro Linkin
58031f07233SDmytro Linkin	local debug_value=$(cat $debug_file)
58131f07233SDmytro Linkin	check_err $? "Failed to read $name value from debugfs"
58231f07233SDmytro Linkin	[ "$debug_value" == "$rate" ]
58331f07233SDmytro Linkin	check_err $? "Unexpected $name debug value $debug_value != $rate"
58431f07233SDmytro Linkin
58531f07233SDmytro Linkin	local api_value=$(( $(rate_attr_get $handle $name) * 8 / 1000000 ))
58631f07233SDmytro Linkin	check_err $? "Failed to get $name attr value"
58731f07233SDmytro Linkin	[ "$api_value" == "$rate" ]
58831f07233SDmytro Linkin	check_err $? "Unexpected $name attr value $api_value != $rate"
58931f07233SDmytro Linkin}
59031f07233SDmytro Linkin
5911a9c0482SDmytro Linkinrate_attr_parent_check()
5921a9c0482SDmytro Linkin{
5931a9c0482SDmytro Linkin	local handle=$1
5941a9c0482SDmytro Linkin	local parent=$2
5951a9c0482SDmytro Linkin	local debug_file=$3
5961a9c0482SDmytro Linkin
5971a9c0482SDmytro Linkin	rate_attr_set $handle parent $parent
5981a9c0482SDmytro Linkin	check_err $? "Failed to set parent"
5991a9c0482SDmytro Linkin
6001a9c0482SDmytro Linkin	debug_value=$(cat $debug_file)
6011a9c0482SDmytro Linkin	check_err $? "Failed to get parent debugfs value"
6021a9c0482SDmytro Linkin	[ "$debug_value" == "$parent" ]
6031a9c0482SDmytro Linkin	check_err $? "Unexpected parent debug value $debug_value != $parent"
6041a9c0482SDmytro Linkin
6051a9c0482SDmytro Linkin	api_value=$(rate_attr_get $r_obj parent)
6061a9c0482SDmytro Linkin	check_err $? "Failed to get parent attr value"
6071a9c0482SDmytro Linkin	[ "$api_value" == "$parent" ]
6081a9c0482SDmytro Linkin	check_err $? "Unexpected parent attr value $api_value != $parent"
6091a9c0482SDmytro Linkin}
6101a9c0482SDmytro Linkin
611413ee943SDmytro Linkinrate_node_add()
612413ee943SDmytro Linkin{
613413ee943SDmytro Linkin	local handle=$1
614413ee943SDmytro Linkin
615413ee943SDmytro Linkin	devlink port function rate add $handle
616413ee943SDmytro Linkin}
617413ee943SDmytro Linkin
618413ee943SDmytro Linkinrate_node_del()
619413ee943SDmytro Linkin{
620413ee943SDmytro Linkin	local handle=$1
621413ee943SDmytro Linkin
622413ee943SDmytro Linkin	devlink port function rate del $handle
623413ee943SDmytro Linkin}
624413ee943SDmytro Linkin
625a27d8e35SDmytro Linkinrate_test()
626a27d8e35SDmytro Linkin{
627a27d8e35SDmytro Linkin	RET=0
628a27d8e35SDmytro Linkin
629a27d8e35SDmytro Linkin	echo $VF_COUNT > /sys/bus/netdevsim/devices/$DEV_NAME/sriov_numvfs
630a27d8e35SDmytro Linkin	devlink dev eswitch set $DL_HANDLE mode switchdev
631a27d8e35SDmytro Linkin	local leafs=`rate_leafs_get $DL_HANDLE`
632a27d8e35SDmytro Linkin	local num_leafs=`echo $leafs | wc -w`
633a27d8e35SDmytro Linkin	[ "$num_leafs" == "$VF_COUNT" ]
634a27d8e35SDmytro Linkin	check_err $? "Expected $VF_COUNT rate leafs but got $num_leafs"
635a27d8e35SDmytro Linkin
63631f07233SDmytro Linkin	rate=10
63731f07233SDmytro Linkin	for r_obj in $leafs
63831f07233SDmytro Linkin	do
63931f07233SDmytro Linkin		rate_attr_tx_rate_check $r_obj tx_share $rate \
64031f07233SDmytro Linkin			$DEBUGFS_DIR/ports/${r_obj##*/}/tx_share
64131f07233SDmytro Linkin		rate=$(($rate+10))
64231f07233SDmytro Linkin	done
64331f07233SDmytro Linkin
64431f07233SDmytro Linkin	rate=100
64531f07233SDmytro Linkin	for r_obj in $leafs
64631f07233SDmytro Linkin	do
64731f07233SDmytro Linkin		rate_attr_tx_rate_check $r_obj tx_max $rate \
64831f07233SDmytro Linkin			$DEBUGFS_DIR/ports/${r_obj##*/}/tx_max
64931f07233SDmytro Linkin		rate=$(($rate+100))
65031f07233SDmytro Linkin	done
65131f07233SDmytro Linkin
652413ee943SDmytro Linkin	local node1_name='group1'
653413ee943SDmytro Linkin	local node1="$DL_HANDLE/$node1_name"
654413ee943SDmytro Linkin	rate_node_add "$node1"
655413ee943SDmytro Linkin	check_err $? "Failed to add node $node1"
656413ee943SDmytro Linkin
657413ee943SDmytro Linkin	local num_nodes=`rate_nodes_get $DL_HANDLE | wc -w`
658413ee943SDmytro Linkin	[ $num_nodes == 1 ]
659413ee943SDmytro Linkin	check_err $? "Expected 1 rate node in output but got $num_nodes"
660413ee943SDmytro Linkin
661413ee943SDmytro Linkin	local node_tx_share=10
662413ee943SDmytro Linkin	rate_attr_tx_rate_check $node1 tx_share $node_tx_share \
663413ee943SDmytro Linkin		$DEBUGFS_DIR/rate_nodes/${node1##*/}/tx_share
664413ee943SDmytro Linkin
665413ee943SDmytro Linkin	local node_tx_max=100
666413ee943SDmytro Linkin	rate_attr_tx_rate_check $node1 tx_max $node_tx_max \
667413ee943SDmytro Linkin		$DEBUGFS_DIR/rate_nodes/${node1##*/}/tx_max
668413ee943SDmytro Linkin
669413ee943SDmytro Linkin	rate_node_del "$node1"
670413ee943SDmytro Linkin	check_err $? "Failed to delete node $node1"
671413ee943SDmytro Linkin	local num_nodes=`rate_nodes_get $DL_HANDLE | wc -w`
672413ee943SDmytro Linkin	[ $num_nodes == 0 ]
673413ee943SDmytro Linkin	check_err $? "Expected 0 rate node but got $num_nodes"
674413ee943SDmytro Linkin
6751a9c0482SDmytro Linkin	local node1_name='group1'
6761a9c0482SDmytro Linkin	local node1="$DL_HANDLE/$node1_name"
6771a9c0482SDmytro Linkin	rate_node_add "$node1"
6781a9c0482SDmytro Linkin	check_err $? "Failed to add node $node1"
6791a9c0482SDmytro Linkin
6801a9c0482SDmytro Linkin	rate_attr_parent_check $r_obj $node1_name \
6811a9c0482SDmytro Linkin		$DEBUGFS_DIR/ports/${r_obj##*/}/rate_parent
6821a9c0482SDmytro Linkin
6831a9c0482SDmytro Linkin	local node2_name='group2'
6841a9c0482SDmytro Linkin	local node2="$DL_HANDLE/$node2_name"
6851a9c0482SDmytro Linkin	rate_node_add "$node2"
6861a9c0482SDmytro Linkin	check_err $? "Failed to add node $node2"
6871a9c0482SDmytro Linkin
6881a9c0482SDmytro Linkin	rate_attr_parent_check $node2 $node1_name \
6891a9c0482SDmytro Linkin		$DEBUGFS_DIR/rate_nodes/$node2_name/rate_parent
6901a9c0482SDmytro Linkin	rate_node_del "$node2"
6911a9c0482SDmytro Linkin	check_err $? "Failed to delete node $node2"
6921a9c0482SDmytro Linkin	rate_attr_set "$r_obj" noparent
6931a9c0482SDmytro Linkin	check_err $? "Failed to unset $r_obj parent node"
6941a9c0482SDmytro Linkin	rate_node_del "$node1"
6951a9c0482SDmytro Linkin	check_err $? "Failed to delete node $node1"
6961a9c0482SDmytro Linkin
697a27d8e35SDmytro Linkin	log_test "rate test"
698a27d8e35SDmytro Linkin}
699a27d8e35SDmytro Linkin
700fc4c93f1SJiri Pirkosetup_prepare()
701fc4c93f1SJiri Pirko{
702fc4c93f1SJiri Pirko	modprobe netdevsim
703fc4c93f1SJiri Pirko	echo "$BUS_ADDR $PORT_COUNT" > /sys/bus/netdevsim/new_device
704fc4c93f1SJiri Pirko	while [ ! -d $SYSFS_NET_DIR ] ; do :; done
705fc4c93f1SJiri Pirko}
706fc4c93f1SJiri Pirko
707fc4c93f1SJiri Pirkocleanup()
708fc4c93f1SJiri Pirko{
709fc4c93f1SJiri Pirko	pre_cleanup
710fc4c93f1SJiri Pirko	echo "$BUS_ADDR" > /sys/bus/netdevsim/del_device
711fc4c93f1SJiri Pirko	modprobe -r netdevsim
712fc4c93f1SJiri Pirko}
713fc4c93f1SJiri Pirko
714fc4c93f1SJiri Pirkotrap cleanup EXIT
715fc4c93f1SJiri Pirko
716fc4c93f1SJiri Pirkosetup_prepare
717fc4c93f1SJiri Pirko
718fc4c93f1SJiri Pirkotests_run
719fc4c93f1SJiri Pirko
720fc4c93f1SJiri Pirkoexit $EXIT_STATUS
721