Commit 96b12796 authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5e: Declare stats groups via macro

Introduce new macros to declare stats callbacks and groups, for better
code reuse and for individual groups selection per profile which will be
introduced in next patches.
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
parent 3460c184
......@@ -162,7 +162,7 @@ static void mlx5e_uplink_rep_update_hw_counters(struct mlx5e_priv *priv)
struct mlx5e_pport_stats *pstats = &priv->stats.pport;
struct rtnl_link_stats64 *vport_stats;
mlx5e_grp_802_3_update_stats(priv);
MLX5E_STATS_GRP_OP(802_3, update_stats)(priv);
vport_stats = &priv->stats.vf_vport;
......
......@@ -29,6 +29,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __MLX5_EN_STATS_H__
#define __MLX5_EN_STATS_H__
......@@ -68,6 +69,28 @@ struct mlx5e_stats_grp {
void (*update_stats)(struct mlx5e_priv *priv);
};
#define MLX5E_STATS_GRP_OP(grp, name) mlx5e_stats_grp_ ## grp ## _ ## name
#define MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(grp) \
int MLX5E_STATS_GRP_OP(grp, num_stats)(struct mlx5e_priv *priv)
#define MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(grp) \
void MLX5E_STATS_GRP_OP(grp, update_stats)(struct mlx5e_priv *priv)
#define MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(grp) \
int MLX5E_STATS_GRP_OP(grp, fill_strings)(struct mlx5e_priv *priv, u8 *data, int idx)
#define MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(grp) \
int MLX5E_STATS_GRP_OP(grp, fill_stats)(struct mlx5e_priv *priv, u64 *data, int idx)
#define MLX5E_DEFINE_STATS_GRP(grp, mask) { \
.get_num_stats = MLX5E_STATS_GRP_OP(grp, num_stats), \
.fill_stats = MLX5E_STATS_GRP_OP(grp, fill_stats), \
.fill_strings = MLX5E_STATS_GRP_OP(grp, fill_strings), \
.update_stats = MLX5E_STATS_GRP_OP(grp, update_stats), \
.update_stats_mask = mask, \
}
unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv);
void mlx5e_stats_update(struct mlx5e_priv *priv);
void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx);
......@@ -345,6 +368,6 @@ struct mlx5e_stats {
extern const struct mlx5e_stats_grp mlx5e_nic_stats_grps[];
unsigned int mlx5e_nic_stats_grps_num(struct mlx5e_priv *priv);
void mlx5e_grp_802_3_update_stats(struct mlx5e_priv *priv);
MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(802_3);
#endif /* __MLX5_EN_STATS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment