summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
diff options
context:
space:
mode:
authorDavid S. Miller2019-06-04 23:21:41 +0200
committerDavid S. Miller2019-06-04 23:21:41 +0200
commitae95f9c1a5601b3dd40d72436ef835b5bbb429a7 (patch)
treec1a7b55e492892375bc5373dc5dbb11c8e165f96 /tools/testing/selftests/drivers/net/netdevsim/devlink.sh
parentnet: stmmac: socfpga: add RMII phy mode (diff)
parentselftests: add basic netdevsim devlink flash testing (diff)
downloadkernel-qcow2-linux-ae95f9c1a5601b3dd40d72436ef835b5bbb429a7.tar.gz
kernel-qcow2-linux-ae95f9c1a5601b3dd40d72436ef835b5bbb429a7.tar.xz
kernel-qcow2-linux-ae95f9c1a5601b3dd40d72436ef835b5bbb429a7.zip
Merge branch 'net-expose-flash-update-status-to-user'
Jiri Pirko says: ==================== expose flash update status to user When user is flashing device using devlink, he currenly does not see any information about what is going on, percentages, etc. Drivers, for example mlxsw and mlx5, have notion about the progress and what is happening. This patchset exposes this progress information to userspace. Example output for existing flash command: $ devlink dev flash pci/0000:01:00.0 file firmware.bin Preparing to flash Flashing 100% Flashing done See this console recording which shows flashing FW on a Mellanox Spectrum device: https://asciinema.org/a/247926 Please see individual patches for changelog. v2->v3 only adds tags and the last selftest patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/drivers/net/netdevsim/devlink.sh')
-rwxr-xr-xtools/testing/selftests/drivers/net/netdevsim/devlink.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
new file mode 100755
index 000000000000..9d8baf5d14b3
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+lib_dir=$(dirname $0)/../../../net/forwarding
+
+ALL_TESTS="fw_flash_test"
+NUM_NETIFS=0
+source $lib_dir/lib.sh
+
+BUS_ADDR=10
+PORT_COUNT=4
+DEV_NAME=netdevsim$BUS_ADDR
+SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/
+DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/
+DL_HANDLE=netdevsim/$DEV_NAME
+
+fw_flash_test()
+{
+ RET=0
+
+ devlink dev flash $DL_HANDLE file dummy
+ check_err $? "Failed to flash with status updates on"
+
+ echo "n"> $DEBUGFS_DIR/fw_update_status
+ check_err $? "Failed to disable status updates"
+
+ devlink dev flash $DL_HANDLE file dummy
+ check_err $? "Failed to flash with status updates off"
+
+ log_test "fw flash test"
+}
+
+setup_prepare()
+{
+ modprobe netdevsim
+ echo "$BUS_ADDR $PORT_COUNT" > /sys/bus/netdevsim/new_device
+ while [ ! -d $SYSFS_NET_DIR ] ; do :; done
+}
+
+cleanup()
+{
+ pre_cleanup
+ echo "$BUS_ADDR" > /sys/bus/netdevsim/del_device
+ modprobe -r netdevsim
+}
+
+trap cleanup EXIT
+
+setup_prepare
+
+tests_run
+
+exit $EXIT_STATUS