]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net/mlx5e: Add NAPI statistics
authorTariq Toukan <tariqt@mellanox.com>
Wed, 2 May 2018 15:29:42 +0000 (18:29 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 28 Jun 2018 21:44:17 +0000 (14:44 -0700)
Add per-channel and global ethtool counters for NAPI.
This helps us monitor and analyze performance in general.

- ch[i]_poll:
  the number of times the channel's NAPI poll was invoked.

- ch[i]_arm:
  the number of times the channel's NAPI poll completed
  and armed the completion queues.

- ch[i]_aff_change:
  the number of times the channel's NAPI poll explicitly
  stopped execution on a cpu due to a change in affinity.

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 98aefa6eb2669852a64220cf49d4f0a6a3506256..ec7784189dc28432fdca5f407d3416a25a64f32d 100644 (file)
@@ -83,6 +83,9 @@ static const struct counter_desc sw_stats_desc[] = {
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_empty) },
        { 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, ch_poll) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_arm) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_aff_change) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_eq_rearm) },
 };
 
@@ -149,6 +152,9 @@ void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv)
                s->rx_cache_empty += rq_stats->cache_empty;
                s->rx_cache_busy  += rq_stats->cache_busy;
                s->rx_cache_waive += rq_stats->cache_waive;
+               s->ch_poll        += ch_stats->poll;
+               s->ch_arm         += ch_stats->arm;
+               s->ch_aff_change  += ch_stats->aff_change;
                s->ch_eq_rearm += ch_stats->eq_rearm;
 
                for (j = 0; j < priv->max_opened_tc; j++) {
@@ -1153,6 +1159,9 @@ static const struct counter_desc sq_stats_desc[] = {
 };
 
 static const struct counter_desc ch_stats_desc[] = {
+       { 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) },
        { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, eq_rearm) },
 };
 
index b598a21bb4d6334b852783a54ad82b41b1bc119c..0cd08b9f46ffb0f5d6d785b296492badd33df83a 100644 (file)
@@ -94,6 +94,9 @@ struct mlx5e_sw_stats {
        u64 rx_cache_empty;
        u64 rx_cache_busy;
        u64 rx_cache_waive;
+       u64 ch_poll;
+       u64 ch_arm;
+       u64 ch_aff_change;
        u64 ch_eq_rearm;
 
 #ifdef CONFIG_MLX5_EN_TLS
@@ -217,6 +220,9 @@ struct mlx5e_sq_stats {
 };
 
 struct mlx5e_ch_stats {
+       u64 poll;
+       u64 arm;
+       u64 aff_change;
        u64 eq_rearm;
 };
 
index 1b17f682693b90b09300fcf92fd7ed74aa29fef5..9f6e97883cbc90fc5c815421918017955036b788 100644 (file)
@@ -74,10 +74,13 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
 {
        struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
                                               napi);
+       struct mlx5e_ch_stats *ch_stats = c->stats;
        bool busy = false;
        int work_done = 0;
        int i;
 
+       ch_stats->poll++;
+
        for (i = 0; i < c->num_tc; i++)
                busy |= mlx5e_poll_tx_cq(&c->sq[i].cq, budget);
 
@@ -94,6 +97,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        if (busy) {
                if (likely(mlx5e_channel_no_affinity_change(c)))
                        return budget;
+               ch_stats->aff_change++;
                if (budget && work_done == budget)
                        work_done--;
        }
@@ -101,6 +105,8 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        if (unlikely(!napi_complete_done(napi, work_done)))
                return work_done;
 
+       ch_stats->arm++;
+
        for (i = 0; i < c->num_tc; i++) {
                mlx5e_handle_tx_dim(&c->sq[i]);
                mlx5e_cq_arm(&c->sq[i].cq);