Commit 9959b389 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

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: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 88e27749
...@@ -423,6 +423,29 @@ devlink_trap_drop_cleanup() ...@@ -423,6 +423,29 @@ devlink_trap_drop_cleanup()
tc filter del dev $dev egress protocol $proto pref $pref handle $handle flower 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_trap_policers_num_get()
{ {
devlink -j -p trap policer show | jq '.[]["'$DEVLINK_DEV'"] | length' devlink -j -p trap policer show | jq '.[]["'$DEVLINK_DEV'"] | length'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment