2 # SPDX-License-Identifier: GPL-2.0
4 lib_dir
=$
(dirname $0)/..
/..
/..
/net
/forwarding
6 ALL_TESTS
="check_devlink_test check_ports_test"
12 DEV_NAME
=netdevsim
$BUS_ADDR
13 SYSFS_NET_DIR
=/sys
/bus
/netdevsim
/devices
/$DEV_NAME/net
/
14 DL_HANDLE
=netdevsim
/$DEV_NAME
21 cmd_jq
"devlink -N $NETNS_NAME port show -j" \
22 ".[][\"$DL_HANDLE/$port_index\"].netdev" "-e"
29 for i
in $
(seq 0 $
(expr $PORT_COUNT - 1)); do
30 netdev_name
=$
(port_netdev_get
$i)
31 check_err $?
"Failed to get netdev name for port $DL_HANDLE/$i"
32 ip
-n $NETNS_NAME link show
$netdev_name &> /dev
/null
33 check_err $?
"Failed to find netdev $netdev_name"
36 log_test
"check ports test"
43 devlink
-N $NETNS_NAME dev show
$DL_HANDLE &> /dev
/null
44 check_err $?
"Failed to show devlink instance"
46 log_test
"check devlink test"
52 ip netns add
$NETNS_NAME
53 ip netns
exec $NETNS_NAME \
54 echo "$BUS_ADDR $PORT_COUNT" > /sys
/bus
/netdevsim
/new_device
55 while [ ! -d $SYSFS_NET_DIR ] ; do :; done
61 echo "$BUS_ADDR" > /sys
/bus
/netdevsim
/del_device
62 ip netns del
$NETNS_NAME