Skip to content

Commit

Permalink
selftests: forwarding: lib: Add link_stats_rx_errors_get()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Petr Machata authored and David S. Miller committed Nov 20, 2018
1 parent d20b0f2 commit d1038cd
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d1038cd

Please sign in to comment.