Commit 6ab75516 authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5e: Move phy link down events counter out of SW stats

PHY link down events counter belongs to phy_counters group.
although it has special handling, it doesn't mean it can't be there.

Move it to phy_counters_grp handler.
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 3a2f7033
...@@ -81,7 +81,6 @@ static const struct counter_desc sw_stats_desc[] = { ...@@ -81,7 +81,6 @@ static const struct counter_desc sw_stats_desc[] = {
{ 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_eq_rearm) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_eq_rearm) },
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events_phy) },
}; };
#define NUM_SW_COUNTERS ARRAY_SIZE(sw_stats_desc) #define NUM_SW_COUNTERS ARRAY_SIZE(sw_stats_desc)
...@@ -175,9 +174,6 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) ...@@ -175,9 +174,6 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv)
} }
} }
s->link_down_events_phy = MLX5_GET(ppcnt_reg,
priv->stats.pport.phy_counters,
counter_set.phys_layer_cntrs.link_down_events);
memcpy(&priv->stats.sw, s, sizeof(*s)); memcpy(&priv->stats.sw, s, sizeof(*s));
} }
...@@ -580,12 +576,13 @@ static const struct counter_desc pport_phy_statistical_stats_desc[] = { ...@@ -580,12 +576,13 @@ static const struct counter_desc pport_phy_statistical_stats_desc[] = {
{ "rx_corrected_bits_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits) }, { "rx_corrected_bits_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits) },
}; };
#define NUM_PPORT_PHY_COUNTERS ARRAY_SIZE(pport_phy_statistical_stats_desc) #define NUM_PPORT_PHY_STATISTICAL_COUNTERS ARRAY_SIZE(pport_phy_statistical_stats_desc)
static int mlx5e_grp_phy_get_num_stats(struct mlx5e_priv *priv) static int mlx5e_grp_phy_get_num_stats(struct mlx5e_priv *priv)
{ {
/* "1" for link_down_events special counter */
return MLX5_CAP_PCAM_FEATURE((priv)->mdev, ppcnt_statistical_group) ? return MLX5_CAP_PCAM_FEATURE((priv)->mdev, ppcnt_statistical_group) ?
NUM_PPORT_PHY_COUNTERS : 0; NUM_PPORT_PHY_STATISTICAL_COUNTERS + 1 : 1;
} }
static int mlx5e_grp_phy_fill_strings(struct mlx5e_priv *priv, u8 *data, static int mlx5e_grp_phy_fill_strings(struct mlx5e_priv *priv, u8 *data,
...@@ -593,10 +590,14 @@ static int mlx5e_grp_phy_fill_strings(struct mlx5e_priv *priv, u8 *data, ...@@ -593,10 +590,14 @@ static int mlx5e_grp_phy_fill_strings(struct mlx5e_priv *priv, u8 *data,
{ {
int i; int i;
if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, ppcnt_statistical_group)) strcpy(data + (idx++) * ETH_GSTRING_LEN, "link_down_events_phy");
for (i = 0; i < NUM_PPORT_PHY_COUNTERS; i++)
strcpy(data + (idx++) * ETH_GSTRING_LEN, if (!MLX5_CAP_PCAM_FEATURE((priv)->mdev, ppcnt_statistical_group))
pport_phy_statistical_stats_desc[i].format); return idx;
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
strcpy(data + (idx++) * ETH_GSTRING_LEN,
pport_phy_statistical_stats_desc[i].format);
return idx; return idx;
} }
...@@ -604,11 +605,17 @@ static int mlx5e_grp_phy_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) ...@@ -604,11 +605,17 @@ static int mlx5e_grp_phy_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{ {
int i; int i;
if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, ppcnt_statistical_group)) /* link_down_events_phy has special handling since it is not stored in __be64 format */
for (i = 0; i < NUM_PPORT_PHY_COUNTERS; i++) data[idx++] = MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
data[idx++] = counter_set.phys_layer_cntrs.link_down_events);
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_stats_desc, i); if (!MLX5_CAP_PCAM_FEATURE((priv)->mdev, ppcnt_statistical_group))
return idx;
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_stats_desc, i);
return idx; return idx;
} }
......
...@@ -97,9 +97,6 @@ struct mlx5e_sw_stats { ...@@ -97,9 +97,6 @@ struct mlx5e_sw_stats {
u64 tx_tls_ooo; u64 tx_tls_ooo;
u64 tx_tls_resync_bytes; u64 tx_tls_resync_bytes;
#endif #endif
/* Special handling counters */
u64 link_down_events_phy;
}; };
struct mlx5e_qcounter_stats { struct mlx5e_qcounter_stats {
......
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