selftests: lib: Add a generic helper for obtaining HW stats
authorPetr Machata <petrm@nvidia.com>
Sun, 8 May 2022 08:08:22 +0000 (11:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 May 2022 10:46:20 +0000 (11:46 +0100)
commit32fb67a3e7a65171cd790ff0e65fcee49cae7cf5
tree5814a2b4eed84e3c394de3d7c95f70c1a77036a8
parentc353fb0d4c932e4b8b561d31afc54b5a60df3d95
selftests: lib: Add a generic helper for obtaining HW stats

The function get_l3_stats() from the test hw_stats_l3.sh will be useful for
any test that wishes to work with L3 stats. Furthermore, it is easy to
generalize to other HW stats suites (for when such are added). Therefore,
move the code to lib.sh, rewrite it to have the same interface as the other
stats-collecting functions, and generalize to take the name of the HW stats
suite to collect as an argument.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/forwarding/hw_stats_l3.sh
tools/testing/selftests/net/forwarding/lib.sh