net/mlx5e: Introduce stats group API
authorKamal Heib <kamalh@mellanox.com>
Wed, 23 Aug 2017 11:42:03 +0000 (14:42 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Tue, 31 Oct 2017 21:20:46 +0000 (14:20 -0700)
commitc0752f2bd6ee77aa9334da4f69e8f54a325d282b
tree56b7467a6accb597253ec75e3a540475b0378bcb
parentaa2bc739ef4a181a7589eb009be96a870cc1788f
net/mlx5e: Introduce stats group API

Currently the mlx5e driver has multiple groups of stats, each group is
used for different purposes and it may depend on hardware capabilities
or not. The problem with the current implementation is that there is no
clear API to create a new group of stats.

This change define a new API to create a group of stats and simplifies
the way of handling them by defining a new struct "mlx5e_stats_grp" which
have the following three function pointers:
- get_num_stats() - return the number of counters in the group.
- fill_strings() - fill counters strings within the group.
- fill_stats() - fill counters values within the group.

The above function pointers are used within the ethtool callbaks while
calling "ethtool -S" from userspace. This change also switch the SW
group to use the new API.

Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Reviewed-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/Makefile
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h