Skip to content

Commit da4fa5d

Browse files
Yael ChemlaPaolo Abeni
authored andcommitted
net/mlx5e: Access PHY layer counter group as other counter groups
Adjust the way physical layer counters group is accessed to match the generic method used for accessing other PPCNT counter groups. Signed-off-by: Yael Chemla <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 8e6f6e9 commit da4fa5d

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_stats.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,13 @@ void mlx5e_stats_ts_get(struct mlx5e_priv *priv,
12271227
mutex_unlock(&priv->state_lock);
12281228
}
12291229

1230+
#define PPORT_PHY_LAYER_OFF(c) \
1231+
MLX5_BYTE_OFF(ppcnt_reg, \
1232+
counter_set.phys_layer_cntrs.c)
1233+
static const struct counter_desc pport_phy_layer_cntrs_stats_desc[] = {
1234+
{ "link_down_events_phy", PPORT_PHY_LAYER_OFF(link_down_events) }
1235+
};
1236+
12301237
#define PPORT_PHY_STATISTICAL_OFF(c) \
12311238
MLX5_BYTE_OFF(ppcnt_reg, \
12321239
counter_set.phys_layer_statistical_cntrs.c##_high)
@@ -1243,6 +1250,8 @@ pport_phy_statistical_err_lanes_stats_desc[] = {
12431250
{ "rx_err_lane_3_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits_lane3) },
12441251
};
12451252

1253+
#define NUM_PPORT_PHY_LAYER_COUNTERS \
1254+
ARRAY_SIZE(pport_phy_layer_cntrs_stats_desc)
12461255
#define NUM_PPORT_PHY_STATISTICAL_COUNTERS \
12471256
ARRAY_SIZE(pport_phy_statistical_stats_desc)
12481257
#define NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS \
@@ -1253,8 +1262,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(phy)
12531262
struct mlx5_core_dev *mdev = priv->mdev;
12541263
int num_stats;
12551264

1256-
/* "1" for link_down_events special counter */
1257-
num_stats = 1;
1265+
num_stats = NUM_PPORT_PHY_LAYER_COUNTERS;
12581266

12591267
num_stats += MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group) ?
12601268
NUM_PPORT_PHY_STATISTICAL_COUNTERS : 0;
@@ -1270,7 +1278,8 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(phy)
12701278
struct mlx5_core_dev *mdev = priv->mdev;
12711279
int i;
12721280

1273-
ethtool_puts(data, "link_down_events_phy");
1281+
for (i = 0; i < NUM_PPORT_PHY_LAYER_COUNTERS; i++)
1282+
ethtool_puts(data, pport_phy_layer_cntrs_stats_desc[i].format);
12741283

12751284
if (MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
12761285
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
@@ -1287,10 +1296,12 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(phy)
12871296
struct mlx5_core_dev *mdev = priv->mdev;
12881297
int i;
12891298

1290-
/* link_down_events_phy has special handling since it is not stored in __be64 format */
1291-
mlx5e_ethtool_put_stat(
1292-
data, MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
1293-
counter_set.phys_layer_cntrs.link_down_events));
1299+
for (i = 0; i < NUM_PPORT_PHY_LAYER_COUNTERS; i++)
1300+
mlx5e_ethtool_put_stat(
1301+
data,
1302+
MLX5E_READ_CTR32_BE(&priv->stats.pport
1303+
.phy_counters,
1304+
pport_phy_layer_cntrs_stats_desc, i));
12941305

12951306
if (MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
12961307
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)

0 commit comments

Comments
 (0)