net/mlx5e: Switch RFC 2863 counters to use stats group API
Switch the RFC 2863 counters to use the new stats group API. Signed-off-by: Kamal Heib <kamalh@mellanox.com> Reviewed-by: Gal Pressman <galp@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
6e6ef814d2
commit
fc8e64a311
|
@ -216,10 +216,6 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, u8 *data)
|
||||||
for (i = 0; i < mlx5e_num_stats_grps; i++)
|
for (i = 0; i < mlx5e_num_stats_grps; i++)
|
||||||
idx = mlx5e_stats_grps[i].fill_strings(priv, data, idx);
|
idx = mlx5e_stats_grps[i].fill_strings(priv, data, idx);
|
||||||
|
|
||||||
for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++)
|
|
||||||
strcpy(data + (idx++) * ETH_GSTRING_LEN,
|
|
||||||
pport_2863_stats_desc[i].format);
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++)
|
for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++)
|
||||||
strcpy(data + (idx++) * ETH_GSTRING_LEN,
|
strcpy(data + (idx++) * ETH_GSTRING_LEN,
|
||||||
pport_2819_stats_desc[i].format);
|
pport_2819_stats_desc[i].format);
|
||||||
|
@ -344,10 +340,6 @@ void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
|
||||||
for (i = 0; i < mlx5e_num_stats_grps; i++)
|
for (i = 0; i < mlx5e_num_stats_grps; i++)
|
||||||
idx = mlx5e_stats_grps[i].fill_stats(priv, data, idx);
|
idx = mlx5e_stats_grps[i].fill_stats(priv, data, idx);
|
||||||
|
|
||||||
for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++)
|
|
||||||
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2863_counters,
|
|
||||||
pport_2863_stats_desc, i);
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++)
|
for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++)
|
||||||
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
|
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
|
||||||
pport_2819_stats_desc, i);
|
pport_2819_stats_desc, i);
|
||||||
|
|
|
@ -249,6 +249,43 @@ static int mlx5e_grp_802_3_fill_stats(struct mlx5e_priv *priv, u64 *data,
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PPORT_2863_OFF(c) \
|
||||||
|
MLX5_BYTE_OFF(ppcnt_reg, \
|
||||||
|
counter_set.eth_2863_cntrs_grp_data_layout.c##_high)
|
||||||
|
static const struct counter_desc pport_2863_stats_desc[] = {
|
||||||
|
{ "rx_discards_phy", PPORT_2863_OFF(if_in_discards) },
|
||||||
|
{ "tx_discards_phy", PPORT_2863_OFF(if_out_discards) },
|
||||||
|
{ "tx_errors_phy", PPORT_2863_OFF(if_out_errors) },
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc)
|
||||||
|
|
||||||
|
static int mlx5e_grp_2863_get_num_stats(struct mlx5e_priv *priv)
|
||||||
|
{
|
||||||
|
return NUM_PPORT_2863_COUNTERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5e_grp_2863_fill_strings(struct mlx5e_priv *priv, u8 *data,
|
||||||
|
int idx)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++)
|
||||||
|
strcpy(data + (idx++) * ETH_GSTRING_LEN, pport_2863_stats_desc[i].format);
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5e_grp_2863_fill_stats(struct mlx5e_priv *priv, u64 *data,
|
||||||
|
int idx)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++)
|
||||||
|
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2863_counters,
|
||||||
|
pport_2863_stats_desc, i);
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
const struct mlx5e_stats_grp mlx5e_stats_grps[] = {
|
const struct mlx5e_stats_grp mlx5e_stats_grps[] = {
|
||||||
{
|
{
|
||||||
.get_num_stats = mlx5e_grp_sw_get_num_stats,
|
.get_num_stats = mlx5e_grp_sw_get_num_stats,
|
||||||
|
@ -270,6 +307,11 @@ const struct mlx5e_stats_grp mlx5e_stats_grps[] = {
|
||||||
.fill_strings = mlx5e_grp_802_3_fill_strings,
|
.fill_strings = mlx5e_grp_802_3_fill_strings,
|
||||||
.fill_stats = mlx5e_grp_802_3_fill_stats,
|
.fill_stats = mlx5e_grp_802_3_fill_stats,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.get_num_stats = mlx5e_grp_2863_get_num_stats,
|
||||||
|
.fill_strings = mlx5e_grp_2863_fill_strings,
|
||||||
|
.fill_stats = mlx5e_grp_2863_fill_stats,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const int mlx5e_num_stats_grps = ARRAY_SIZE(mlx5e_stats_grps);
|
const int mlx5e_num_stats_grps = ARRAY_SIZE(mlx5e_stats_grps);
|
||||||
|
|
|
@ -105,9 +105,6 @@ struct mlx5e_vport_stats {
|
||||||
#define PPORT_802_3_GET(pstats, c) \
|
#define PPORT_802_3_GET(pstats, c) \
|
||||||
MLX5_GET64(ppcnt_reg, pstats->IEEE_802_3_counters, \
|
MLX5_GET64(ppcnt_reg, pstats->IEEE_802_3_counters, \
|
||||||
counter_set.eth_802_3_cntrs_grp_data_layout.c##_high)
|
counter_set.eth_802_3_cntrs_grp_data_layout.c##_high)
|
||||||
#define PPORT_2863_OFF(c) \
|
|
||||||
MLX5_BYTE_OFF(ppcnt_reg, \
|
|
||||||
counter_set.eth_2863_cntrs_grp_data_layout.c##_high)
|
|
||||||
#define PPORT_2863_GET(pstats, c) \
|
#define PPORT_2863_GET(pstats, c) \
|
||||||
MLX5_GET64(ppcnt_reg, pstats->RFC_2863_counters, \
|
MLX5_GET64(ppcnt_reg, pstats->RFC_2863_counters, \
|
||||||
counter_set.eth_2863_cntrs_grp_data_layout.c##_high)
|
counter_set.eth_2863_cntrs_grp_data_layout.c##_high)
|
||||||
|
@ -147,12 +144,6 @@ struct mlx5e_pport_stats {
|
||||||
__be64 eth_ext_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
|
__be64 eth_ext_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct counter_desc pport_2863_stats_desc[] = {
|
|
||||||
{ "rx_discards_phy", PPORT_2863_OFF(if_in_discards) },
|
|
||||||
{ "tx_discards_phy", PPORT_2863_OFF(if_out_discards) },
|
|
||||||
{ "tx_errors_phy", PPORT_2863_OFF(if_out_errors) },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct counter_desc pport_2819_stats_desc[] = {
|
static const struct counter_desc pport_2819_stats_desc[] = {
|
||||||
{ "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) },
|
{ "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) },
|
||||||
{ "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) },
|
{ "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) },
|
||||||
|
@ -312,7 +303,6 @@ static const struct counter_desc sq_stats_desc[] = {
|
||||||
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
|
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc)
|
|
||||||
#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc)
|
#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc)
|
||||||
#define NUM_PPORT_PHY_STATISTICAL_COUNTERS(priv) \
|
#define NUM_PPORT_PHY_STATISTICAL_COUNTERS(priv) \
|
||||||
(ARRAY_SIZE(pport_phy_statistical_stats_desc) * \
|
(ARRAY_SIZE(pport_phy_statistical_stats_desc) * \
|
||||||
|
@ -333,8 +323,7 @@ static const struct counter_desc sq_stats_desc[] = {
|
||||||
#define NUM_PPORT_ETH_EXT_COUNTERS(priv) \
|
#define NUM_PPORT_ETH_EXT_COUNTERS(priv) \
|
||||||
(ARRAY_SIZE(pport_eth_ext_stats_desc) * \
|
(ARRAY_SIZE(pport_eth_ext_stats_desc) * \
|
||||||
MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
|
MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
|
||||||
#define NUM_PPORT_COUNTERS(priv) (NUM_PPORT_2863_COUNTERS + \
|
#define NUM_PPORT_COUNTERS(priv) (NUM_PPORT_2819_COUNTERS + \
|
||||||
NUM_PPORT_2819_COUNTERS + \
|
|
||||||
NUM_PPORT_PHY_STATISTICAL_COUNTERS(priv) + \
|
NUM_PPORT_PHY_STATISTICAL_COUNTERS(priv) + \
|
||||||
NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
|
NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
|
||||||
NUM_PPORT_PRIO + \
|
NUM_PPORT_PRIO + \
|
||||||
|
|
Loading…
Reference in New Issue