diff options
author | Ido Schimmel <idosch@mellanox.com> | 2020-05-29 21:36:49 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-01 11:49:23 -0700 |
commit | 9959b389779a9e688d1a9272eed6377d999d8739 (patch) | |
tree | 5e4f63e14b15e824e36aefd3e1faf88c2787827c /tools/testing/selftests/net | |
parent | mlxsw: spectrum_trap: Register ACL control traps (diff) | |
download | wireguard-linux-9959b389779a9e688d1a9272eed6377d999d8739.tar.xz wireguard-linux-9959b389779a9e688d1a9272eed6377d999d8739.zip |
selftests: mlxsw: Add test for control packets
Generate packets matching the various control traps and check that the
traps' stats increase accordingly.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net')
-rw-r--r-- | tools/testing/selftests/net/forwarding/devlink_lib.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/devlink_lib.sh b/tools/testing/selftests/net/forwarding/devlink_lib.sh index e27236109235..f0e6be4c09e9 100644 --- a/tools/testing/selftests/net/forwarding/devlink_lib.sh +++ b/tools/testing/selftests/net/forwarding/devlink_lib.sh @@ -423,6 +423,29 @@ devlink_trap_drop_cleanup() tc filter del dev $dev egress protocol $proto pref $pref handle $handle flower } +devlink_trap_stats_test() +{ + local test_name=$1; shift + local trap_name=$1; shift + local send_one="$@" + local t0_packets + local t1_packets + + RET=0 + + t0_packets=$(devlink_trap_rx_packets_get $trap_name) + + $send_one && sleep 1 + + t1_packets=$(devlink_trap_rx_packets_get $trap_name) + + if [[ $t1_packets -eq $t0_packets ]]; then + check_err 1 "Trap stats did not increase" + fi + + log_test "$test_name" +} + devlink_trap_policers_num_get() { devlink -j -p trap policer show | jq '.[]["'$DEVLINK_DEV'"] | length' |