Skip to content

Commit 8e6f6e9

Browse files
Yael ChemlaPaolo Abeni
authored andcommitted
net/mlx5e: Ensure each counter group uses its PCAM bit
The code was incorrectly relying on PCAM bit of ppcnt_statistical_group for accessing per_lane_error_counters. If ppcnt_statistical_group PCAM bit was not set, we would not read per_lane_error_counters, even when its PCAM bit is set. Given the existing device capabilities, it seems to cause no harm, so this change primarily serves as cleanup. 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]> Reviewed-by: Kalesh AP <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent e2f4ac7 commit 8e6f6e9

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,11 +1272,9 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(phy)
12721272

12731273
ethtool_puts(data, "link_down_events_phy");
12741274

1275-
if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
1276-
return;
1277-
1278-
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
1279-
ethtool_puts(data, pport_phy_statistical_stats_desc[i].format);
1275+
if (MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
1276+
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
1277+
ethtool_puts(data, pport_phy_statistical_stats_desc[i].format);
12801278

12811279
if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
12821280
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)
@@ -1294,15 +1292,13 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(phy)
12941292
data, MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
12951293
counter_set.phys_layer_cntrs.link_down_events));
12961294

1297-
if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
1298-
return;
1299-
1300-
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
1301-
mlx5e_ethtool_put_stat(
1302-
data,
1303-
MLX5E_READ_CTR64_BE(
1304-
&priv->stats.pport.phy_statistical_counters,
1305-
pport_phy_statistical_stats_desc, i));
1295+
if (MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
1296+
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
1297+
mlx5e_ethtool_put_stat(
1298+
data,
1299+
MLX5E_READ_CTR64_BE(
1300+
&priv->stats.pport.phy_statistical_counters,
1301+
pport_phy_statistical_stats_desc, i));
13061302

13071303
if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
13081304
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)

0 commit comments

Comments
 (0)