diff options
author | Gal Pressman | 2016-11-17 12:46:02 +0100 |
---|---|---|
committer | Saeed Mahameed | 2017-01-19 22:20:02 +0100 |
commit | 0f7f348192a9ba445463261ecc15a63d0ba48722 (patch) | |
tree | c2c3881662b923db46cbcd1d7444b7d1c19607e1 /drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |
parent | net/mlx5: Add MPCNT register infrastructure (diff) | |
download | kernel-qcow2-linux-0f7f348192a9ba445463261ecc15a63d0ba48722.tar.gz kernel-qcow2-linux-0f7f348192a9ba445463261ecc15a63d0ba48722.tar.xz kernel-qcow2-linux-0f7f348192a9ba445463261ecc15a63d0ba48722.zip |
net/mlx5e: Expose PCIe statistics to ethtool
This patch exposes PCIe performance counters, queried with
ethtool -S <devname>.
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_main.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 3be87a65d750..9aed892cd350 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -297,12 +297,35 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv) &qcnt->rx_out_of_buffer); } +static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv) +{ + struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie; + struct mlx5_core_dev *mdev = priv->mdev; + int sz = MLX5_ST_SZ_BYTES(mpcnt_reg); + void *out; + u32 *in; + + if (!MLX5_CAP_MCAM_FEATURE(mdev, pcie_performance_group)) + return; + + in = mlx5_vzalloc(sz); + if (!in) + return; + + out = pcie_stats->pcie_perf_counters; + MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP); + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0); + + kvfree(in); +} + void mlx5e_update_stats(struct mlx5e_priv *priv) { mlx5e_update_q_counter(priv); mlx5e_update_vport_counters(priv); mlx5e_update_pport_counters(priv); mlx5e_update_sw_counters(priv); + mlx5e_update_pcie_counters(priv); } void mlx5e_update_stats_work(struct work_struct *work) |