Commit 121fcdc8 authored by Gal Pressman's avatar Gal Pressman Committed by David S. Miller

net/mlx5e: Add link down events counter

Expose link_down_events counter through ethtool -S.
This counter is read from PPort statistics, then proccessed and stored as
a special handling software counter.
This counter is stored along software counters since it is the only PPort
counter that it's size is not 64 bits.
Signed-off-by: default avatarGal Pressman <galp@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf678570
...@@ -135,6 +135,10 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv) ...@@ -135,6 +135,10 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
s->tx_csum_offload = s->tx_packets - tx_offload_none - s->tx_csum_inner; s->tx_csum_offload = s->tx_packets - tx_offload_none - s->tx_csum_inner;
s->rx_csum_good = s->rx_packets - s->rx_csum_none - s->rx_csum_good = s->rx_packets - s->rx_csum_none -
s->rx_csum_sw; s->rx_csum_sw;
s->link_down_events = MLX5_GET(ppcnt_reg,
priv->stats.pport.phy_counters,
counter_set.phys_layer_cntrs.link_down_events);
} }
static void mlx5e_update_vport_counters(struct mlx5e_priv *priv) static void mlx5e_update_vport_counters(struct mlx5e_priv *priv)
...@@ -183,6 +187,10 @@ static void mlx5e_update_pport_counters(struct mlx5e_priv *priv) ...@@ -183,6 +187,10 @@ static void mlx5e_update_pport_counters(struct mlx5e_priv *priv)
MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2819_COUNTERS_GROUP); MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2819_COUNTERS_GROUP);
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
out = pstats->phy_counters;
MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP);
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP); MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP);
for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
out = pstats->per_prio_counters[prio]; out = pstats->per_prio_counters[prio];
...@@ -208,10 +216,10 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv) ...@@ -208,10 +216,10 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv)
void mlx5e_update_stats(struct mlx5e_priv *priv) void mlx5e_update_stats(struct mlx5e_priv *priv)
{ {
mlx5e_update_sw_counters(priv);
mlx5e_update_q_counter(priv); mlx5e_update_q_counter(priv);
mlx5e_update_vport_counters(priv); mlx5e_update_vport_counters(priv);
mlx5e_update_pport_counters(priv); mlx5e_update_pport_counters(priv);
mlx5e_update_sw_counters(priv);
} }
static void mlx5e_update_stats_work(struct work_struct *work) static void mlx5e_update_stats_work(struct work_struct *work)
......
...@@ -71,6 +71,9 @@ struct mlx5e_sw_stats { ...@@ -71,6 +71,9 @@ struct mlx5e_sw_stats {
u64 rx_mpwqe_filler; u64 rx_mpwqe_filler;
u64 rx_mpwqe_frag; u64 rx_mpwqe_frag;
u64 rx_buff_alloc_err; u64 rx_buff_alloc_err;
/* Special handling counters */
u64 link_down_events;
}; };
static const struct counter_desc sw_stats_desc[] = { static const struct counter_desc sw_stats_desc[] = {
...@@ -96,6 +99,7 @@ static const struct counter_desc sw_stats_desc[] = { ...@@ -96,6 +99,7 @@ static const struct counter_desc sw_stats_desc[] = {
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) },
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_frag) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_frag) },
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) },
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events) },
}; };
struct mlx5e_qcounter_stats { struct mlx5e_qcounter_stats {
...@@ -178,6 +182,7 @@ struct mlx5e_pport_stats { ...@@ -178,6 +182,7 @@ struct mlx5e_pport_stats {
__be64 RFC_2863_counters[MLX5_ST_SZ_QW(ppcnt_reg)]; __be64 RFC_2863_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
__be64 RFC_2819_counters[MLX5_ST_SZ_QW(ppcnt_reg)]; __be64 RFC_2819_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
__be64 per_prio_counters[NUM_PPORT_PRIO][MLX5_ST_SZ_QW(ppcnt_reg)]; __be64 per_prio_counters[NUM_PPORT_PRIO][MLX5_ST_SZ_QW(ppcnt_reg)];
__be64 phy_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
}; };
static const struct counter_desc pport_802_3_stats_desc[] = { static const struct counter_desc pport_802_3_stats_desc[] = {
......
...@@ -1369,6 +1369,7 @@ enum { ...@@ -1369,6 +1369,7 @@ enum {
MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP = 0x5, MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP = 0x5,
MLX5_PER_PRIORITY_COUNTERS_GROUP = 0x10, MLX5_PER_PRIORITY_COUNTERS_GROUP = 0x10,
MLX5_PER_TRAFFIC_CLASS_COUNTERS_GROUP = 0x11, MLX5_PER_TRAFFIC_CLASS_COUNTERS_GROUP = 0x11,
MLX5_PHYSICAL_LAYER_COUNTERS_GROUP = 0x12,
MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20, MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20,
}; };
......
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