aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/net/forwarding/lib.sh
diff options
context:
space:
mode:
authorBaowen Zheng <baowen.zheng@corigine.com>2021-03-26 14:09:38 +0100
committerDavid S. Miller <davem@davemloft.net>2021-03-28 17:48:28 -0700
commit53b61f29367df398243b7298ad1e5793c289a493 (patch)
tree16489985622369179f8283873cf9b7f19db3b642 /tools/testing/selftests/net/forwarding/lib.sh
parentselftests: tc-testing: add action police selftest for packets per second (diff)
downloadwireguard-linux-53b61f29367df398243b7298ad1e5793c289a493.tar.xz
wireguard-linux-53b61f29367df398243b7298ad1e5793c289a493.zip
selftests: forwarding: Add tc-police tests for packets per second
Test tc-police action for packets per second. The test is mainly in scenarios Rx policing and Tx policing. The test passes with veth pairs ports. Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/forwarding/lib.sh')
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 05c05e02bade..42e28c983d41 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -772,6 +772,15 @@ rate()
echo $((8 * (t1 - t0) / interval))
}
+packets_rate()
+{
+ local t0=$1; shift
+ local t1=$1; shift
+ local interval=$1; shift
+
+ echo $(((t1 - t0) / interval))
+}
+
mac_get()
{
local if_name=$1