Commit 2d7103c8 authored by Tariq Toukan's avatar Tariq Toukan Committed by Saeed Mahameed

net/mlx5e: Add NAPI statistics

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: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent cbe73aae
...@@ -83,6 +83,9 @@ static const struct counter_desc sw_stats_desc[] = { ...@@ -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_empty) },
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_busy) }, { 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_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) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_eq_rearm) },
}; };
...@@ -149,6 +152,9 @@ void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) ...@@ -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_empty += rq_stats->cache_empty;
s->rx_cache_busy += rq_stats->cache_busy; s->rx_cache_busy += rq_stats->cache_busy;
s->rx_cache_waive += rq_stats->cache_waive; 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; s->ch_eq_rearm += ch_stats->eq_rearm;
for (j = 0; j < priv->max_opened_tc; j++) { for (j = 0; j < priv->max_opened_tc; j++) {
...@@ -1153,6 +1159,9 @@ static const struct counter_desc sq_stats_desc[] = { ...@@ -1153,6 +1159,9 @@ static const struct counter_desc sq_stats_desc[] = {
}; };
static const struct counter_desc ch_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) }, { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, eq_rearm) },
}; };
......
...@@ -94,6 +94,9 @@ struct mlx5e_sw_stats { ...@@ -94,6 +94,9 @@ struct mlx5e_sw_stats {
u64 rx_cache_empty; u64 rx_cache_empty;
u64 rx_cache_busy; u64 rx_cache_busy;
u64 rx_cache_waive; u64 rx_cache_waive;
u64 ch_poll;
u64 ch_arm;
u64 ch_aff_change;
u64 ch_eq_rearm; u64 ch_eq_rearm;
#ifdef CONFIG_MLX5_EN_TLS #ifdef CONFIG_MLX5_EN_TLS
...@@ -217,6 +220,9 @@ struct mlx5e_sq_stats { ...@@ -217,6 +220,9 @@ struct mlx5e_sq_stats {
}; };
struct mlx5e_ch_stats { struct mlx5e_ch_stats {
u64 poll;
u64 arm;
u64 aff_change;
u64 eq_rearm; u64 eq_rearm;
}; };
......
...@@ -74,10 +74,13 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) ...@@ -74,10 +74,13 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
{ {
struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel, struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
napi); napi);
struct mlx5e_ch_stats *ch_stats = c->stats;
bool busy = false; bool busy = false;
int work_done = 0; int work_done = 0;
int i; int i;
ch_stats->poll++;
for (i = 0; i < c->num_tc; i++) for (i = 0; i < c->num_tc; i++)
busy |= mlx5e_poll_tx_cq(&c->sq[i].cq, budget); busy |= mlx5e_poll_tx_cq(&c->sq[i].cq, budget);
...@@ -94,6 +97,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) ...@@ -94,6 +97,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
if (busy) { if (busy) {
if (likely(mlx5e_channel_no_affinity_change(c))) if (likely(mlx5e_channel_no_affinity_change(c)))
return budget; return budget;
ch_stats->aff_change++;
if (budget && work_done == budget) if (budget && work_done == budget)
work_done--; work_done--;
} }
...@@ -101,6 +105,8 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) ...@@ -101,6 +105,8 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
if (unlikely(!napi_complete_done(napi, work_done))) if (unlikely(!napi_complete_done(napi, work_done)))
return work_done; return work_done;
ch_stats->arm++;
for (i = 0; i < c->num_tc; i++) { for (i = 0; i < c->num_tc; i++) {
mlx5e_handle_tx_dim(&c->sq[i]); mlx5e_handle_tx_dim(&c->sq[i]);
mlx5e_cq_arm(&c->sq[i].cq); mlx5e_cq_arm(&c->sq[i].cq);
......
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