]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net/mlx5e: Add TX completions statistics
authorTariq Toukan <tariqt@mellanox.com>
Wed, 18 Apr 2018 10:33:15 +0000 (13:33 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 28 Jun 2018 21:44:16 +0000 (14:44 -0700)
Add per-ring and global ethtool counters for TX completions.
This helps us monitor and analyze TX flow performance.

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_tx.c

index 7e7155b4e0f06dd12c35959a34ed0d97d21ddc61..d35361b1b3fe29f607ff27d6d1a78f76a26e6aea 100644 (file)
@@ -67,6 +67,7 @@ static const struct counter_desc sw_stats_desc[] = {
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xmit_more) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_recover) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_cqes) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_udp_seg_rem) },
        { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_cqe_err) },
@@ -172,6 +173,7 @@ void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv)
                        s->tx_tls_ooo           += sq_stats->tls_ooo;
                        s->tx_tls_resync_bytes  += sq_stats->tls_resync_bytes;
 #endif
+                       s->tx_cqes              += sq_stats->cqes;
                }
        }
 
@@ -1142,6 +1144,7 @@ static const struct counter_desc sq_stats_desc[] = {
        { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) },
        { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
        { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, recover) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, cqes) },
        { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) },
        { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, cqe_err) },
 };
index d416bb86e74790daa2a7cbc0033f79713566bbc2..8f2dfe56fdef090a911ef7178c50e0940851fc86 100644 (file)
@@ -78,6 +78,7 @@ struct mlx5e_sw_stats {
        u64 tx_queue_dropped;
        u64 tx_xmit_more;
        u64 tx_recover;
+       u64 tx_cqes;
        u64 tx_queue_wake;
        u64 tx_udp_seg_rem;
        u64 tx_cqe_err;
@@ -208,7 +209,8 @@ struct mlx5e_sq_stats {
        u64 dropped;
        u64 recover;
        /* dirtied @completion */
-       u64 wake ____cacheline_aligned_in_smp;
+       u64 cqes ____cacheline_aligned_in_smp;
+       u64 wake;
        u64 cqe_err;
 };
 
index f450d9ca31fb9c972bad95165890ced8fbd08f6c..f0739dae7b56961313f59bfd1c83c94a083b31aa 100644 (file)
@@ -468,6 +468,7 @@ static void mlx5e_dump_error_cqe(struct mlx5e_txqsq *sq,
 
 bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
 {
+       struct mlx5e_sq_stats *stats;
        struct mlx5e_txqsq *sq;
        struct mlx5_cqe64 *cqe;
        u32 dma_fifo_cc;
@@ -485,6 +486,8 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
        if (!cqe)
                return false;
 
+       stats = sq->stats;
+
        npkts = 0;
        nbytes = 0;
 
@@ -513,7 +516,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
                                queue_work(cq->channel->priv->wq,
                                           &sq->recover.recover_work);
                        }
-                       sq->stats->cqe_err++;
+                       stats->cqe_err++;
                }
 
                do {
@@ -558,6 +561,8 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
 
        } while ((++i < MLX5E_TX_CQ_POLL_BUDGET) && (cqe = mlx5_cqwq_get_cqe(&cq->wq)));
 
+       stats->cqes += i;
+
        mlx5_cqwq_update_db_record(&cq->wq);
 
        /* ensure cq space is freed before enabling more cqes */
@@ -573,7 +578,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
                                   MLX5E_SQ_STOP_ROOM) &&
            !test_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) {
                netif_tx_wake_queue(sq->txq);
-               sq->stats->wake++;
+               stats->wake++;
        }
 
        return (i == MLX5E_TX_CQ_POLL_BUDGET);