1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 4lib_dir=$(dirname $0)/../../../net/forwarding 5 6ALL_TESTS="fw_flash_test" 7NUM_NETIFS=0 8source $lib_dir/lib.sh 9 10BUS_ADDR=10 11PORT_COUNT=4 12DEV_NAME=netdevsim$BUS_ADDR 13SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/ 14DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/ 15DL_HANDLE=netdevsim/$DEV_NAME 16 17fw_flash_test() 18{ 19 RET=0 20 21 devlink dev flash $DL_HANDLE file dummy 22 check_err $? "Failed to flash with status updates on" 23 24 echo "n"> $DEBUGFS_DIR/fw_update_status 25 check_err $? "Failed to disable status updates" 26 27 devlink dev flash $DL_HANDLE file dummy 28 check_err $? "Failed to flash with status updates off" 29 30 log_test "fw flash test" 31} 32 33setup_prepare() 34{ 35 modprobe netdevsim 36 echo "$BUS_ADDR $PORT_COUNT" > /sys/bus/netdevsim/new_device 37 while [ ! -d $SYSFS_NET_DIR ] ; do :; done 38} 39 40cleanup() 41{ 42 pre_cleanup 43 echo "$BUS_ADDR" > /sys/bus/netdevsim/del_device 44 modprobe -r netdevsim 45} 46 47trap cleanup EXIT 48 49setup_prepare 50 51tests_run 52 53exit $EXIT_STATUS 54