2 # SPDX-License-Identifier: GPL-2.0-only
4 NSIM_ID
=$
((RANDOM
% 1024))
5 NSIM_DEV_SYS
=/sys
/bus
/netdevsim
/devices
/netdevsim
$NSIM_ID
6 NSIM_DEV_DFS
=/sys
/kernel
/debug
/netdevsim
/netdevsim
$NSIM_ID/ports
/0
11 function cleanup_nsim
{
12 if [ -e $NSIM_DEV_SYS ]; then
13 echo $NSIM_ID > /sys
/bus
/netdevsim
/del_device
28 if [ $code -ne 0 ]; then
33 if [ "$str" != "$exp_str" ]; then
34 echo -e "Expected: '$exp_str', got '$str'"
42 function make_netdev
{
44 old_netdevs
=$
(ls /sys
/class
/net
)
46 if ! $
(lsmod |
grep -q netdevsim
); then
50 echo $NSIM_ID > /sys
/bus
/netdevsim
/new_device
52 ls /sys
/bus
/netdevsim
/devices
/netdevsim
${NSIM_ID}/net
/