summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/drivers
diff options
context:
space:
mode:
authorOleksandr Mazur <oleksandr.mazur@plvision.eu>2021-06-14 16:01:15 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-14 13:04:25 -0700
commit7a4f54798a53db5f94d6e0bd1b0bfe53900fc058 (patch)
tree2accac45347ffac203663115498b08a5b1b5d496 /tools/testing/selftests/drivers
parenta7b3527a43feb017f48c699d859aef787c8af031 (diff)
downloadlinux-7a4f54798a53db5f94d6e0bd1b0bfe53900fc058.tar.bz2
testing: selftests: drivers: net: netdevsim: devlink: add test case for hard drop statistics
Add hard drop counter check testcase, to make sure netdevsim driver properly handles the devlink hard drop counters get/set callbacks. Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/drivers')
-rwxr-xr-xtools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh
index 6165901a1cf3..109900c817be 100755
--- a/tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh
+++ b/tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh
@@ -165,6 +165,16 @@ trap_stats_test()
devlink_trap_action_set $trap_name "drop"
devlink_trap_stats_idle_test $trap_name
check_err $? "Stats of trap $trap_name not idle when action is drop"
+
+ echo "y"> $DEBUGFS_DIR/fail_trap_drop_counter_get
+ devlink -s trap show $DEVLINK_DEV trap $trap_name &> /dev/null
+ check_fail $? "Managed to read trap (hard dropped) statistics when should not"
+ echo "n"> $DEBUGFS_DIR/fail_trap_drop_counter_get
+ devlink -s trap show $DEVLINK_DEV trap $trap_name &> /dev/null
+ check_err $? "Did not manage to read trap (hard dropped) statistics when should"
+
+ devlink_trap_drop_stats_idle_test $trap_name
+ check_fail $? "Drop stats of trap $trap_name idle when should not"
else
devlink_trap_stats_idle_test $trap_name
check_fail $? "Stats of non-drop trap $trap_name idle when should not"