net/mlx5e: Add channel events counter
authorTariq Toukan <tariqt@mellanox.com>
Tue, 13 Mar 2018 09:19:28 +0000 (11:19 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 28 Jun 2018 21:44:19 +0000 (14:44 -0700)
Add per-channel and global ethtool counters for channel events.
Each event indicates an interrupt on one of the channel's
completion queues.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c

index dd3b5a0..0c18b20 100644 (file)
@@ -84,6 +84,7 @@ static const struct counter_desc sw_stats_desc[] = {
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_busy) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_waive) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_congst_umr) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_events) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_poll) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_arm) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_aff_change) },
@@ -154,6 +155,7 @@ void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv)
                s->rx_cache_busy  += rq_stats->cache_busy;
                s->rx_cache_waive += rq_stats->cache_waive;
                s->rx_congst_umr  += rq_stats->congst_umr;
+               s->ch_events      += ch_stats->events;
                s->ch_poll        += ch_stats->poll;
                s->ch_arm         += ch_stats->arm;
                s->ch_aff_change  += ch_stats->aff_change;
@@ -1162,6 +1164,7 @@ static const struct counter_desc sq_stats_desc[] = {
 };
 
 static const struct counter_desc ch_stats_desc[] = {
+       { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, events) },
        { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, poll) },
        { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, arm) },
        { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, aff_change) },
index 4e54cb8..70a0529 100644 (file)
@@ -95,6 +95,7 @@ struct mlx5e_sw_stats {
        u64 rx_cache_busy;
        u64 rx_cache_waive;
        u64 rx_congst_umr;
+       u64 ch_events;
        u64 ch_poll;
        u64 ch_arm;
        u64 ch_aff_change;
@@ -222,6 +223,7 @@ struct mlx5e_sq_stats {
 };
 
 struct mlx5e_ch_stats {
+       u64 events;
        u64 poll;
        u64 arm;
        u64 aff_change;
index 9f6e978..4e1f99a 100644 (file)
@@ -124,8 +124,9 @@ void mlx5e_completion_event(struct mlx5_core_cq *mcq)
 {
        struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq);
 
-       cq->event_ctr++;
        napi_schedule(cq->napi);
+       cq->event_ctr++;
+       cq->channel->stats->events++;
 }
 
 void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event)