diff options
author | Petr Machata | 2018-11-19 17:11:13 +0100 |
---|---|---|
committer | David S. Miller | 2018-11-20 02:59:43 +0100 |
commit | d1038cd0f67e542f2744782f958b95c4909fb63a (patch) | |
tree | 90b60b42d15a65fc4e3d135fa6e3df3bf89e34fc /tools | |
parent | selftests: forwarding: ping{6, }_do(): Allow passing ping arguments (diff) | |
download | kernel-qcow2-linux-d1038cd0f67e542f2744782f958b95c4909fb63a.tar.gz kernel-qcow2-linux-d1038cd0f67e542f2744782f958b95c4909fb63a.tar.xz kernel-qcow2-linux-d1038cd0f67e542f2744782f958b95c4909fb63a.zip |
selftests: forwarding: lib: Add link_stats_rx_errors_get()
Such a function will be useful for counting malformed packets in the ECN
decap test.
To that end, introduce a common handler for handling stat-fetching, and
reuse it in link_stats_tx_packets_get() and link_stats_rx_errors_get().
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/net/forwarding/lib.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index e916663a1019..7af5a03bcb32 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -477,11 +477,24 @@ master_name_get() ip -j link show dev $if_name | jq -r '.[]["master"]' } +link_stats_get() +{ + local if_name=$1; shift + local dir=$1; shift + local stat=$1; shift + + ip -j -s link show dev $if_name \ + | jq '.[]["stats64"]["'$dir'"]["'$stat'"]' +} + link_stats_tx_packets_get() { - local if_name=$1 + link_stats_get $1 tx packets +} - ip -j -s link show dev $if_name | jq '.[]["stats64"]["tx"]["packets"]' +link_stats_rx_errors_get() +{ + link_stats_get $1 rx errors } tc_rule_stats_get() |