mirror of https://gitee.com/openkylin/linux.git
testing: selftests: net: forwarding: add devlink-required functionality to test (hard) dropped stats field
Add devlink_trap_drop_packets_get function, as well as test that are used to verify devlink (hard) dropped stats functionality works. Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ddee9dbc3d
commit
53f1bd6b28
|
@ -324,6 +324,14 @@ devlink_trap_rx_bytes_get()
|
|||
| jq '.[][][]["stats"]["rx"]["bytes"]'
|
||||
}
|
||||
|
||||
devlink_trap_drop_packets_get()
|
||||
{
|
||||
local trap_name=$1; shift
|
||||
|
||||
devlink -js trap show $DEVLINK_DEV trap $trap_name \
|
||||
| jq '.[][][]["stats"]["rx"]["dropped"]'
|
||||
}
|
||||
|
||||
devlink_trap_stats_idle_test()
|
||||
{
|
||||
local trap_name=$1; shift
|
||||
|
@ -345,6 +353,24 @@ devlink_trap_stats_idle_test()
|
|||
fi
|
||||
}
|
||||
|
||||
devlink_trap_drop_stats_idle_test()
|
||||
{
|
||||
local trap_name=$1; shift
|
||||
local t0_packets t0_bytes
|
||||
|
||||
t0_packets=$(devlink_trap_drop_packets_get $trap_name)
|
||||
|
||||
sleep 1
|
||||
|
||||
t1_packets=$(devlink_trap_drop_packets_get $trap_name)
|
||||
|
||||
if [[ $t0_packets -eq $t1_packets ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
devlink_traps_enable_all()
|
||||
{
|
||||
local trap_name
|
||||
|
|
Loading…
Reference in New Issue