Skip to content

Commit 43ad338

Browse files
cjubrangregkh
authored andcommitted
net/mlx5e: Don't query FEC statistics when FEC is disabled
[ Upstream commit 6b81b8a ] Update mlx5e_stats_fec_get() to check the active FEC mode and skip statistics collection when FEC is disabled. Signed-off-by: Carolina Jubran <[email protected]> Reviewed-by: Dragos Tatulea <[email protected]> Reviewed-by: Yael Chemla <[email protected]> Signed-off-by: Vadim Fedorenko <[email protected]> Reviewed-by: Aleksandr Loktionov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 81236ea commit 43ad338

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,16 +1301,13 @@ static void fec_set_rs_stats(struct ethtool_fec_stats *fec_stats, u32 *ppcnt)
13011301
}
13021302

13031303
static void fec_set_block_stats(struct mlx5e_priv *priv,
1304+
int mode,
13041305
struct ethtool_fec_stats *fec_stats)
13051306
{
13061307
struct mlx5_core_dev *mdev = priv->mdev;
13071308
u32 out[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
13081309
u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
13091310
int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
1310-
int mode = fec_active_mode(mdev);
1311-
1312-
if (mode == MLX5E_FEC_NOFEC)
1313-
return;
13141311

13151312
MLX5_SET(ppcnt_reg, in, local_port, 1);
13161313
MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP);
@@ -1351,11 +1348,14 @@ static void fec_set_corrected_bits_total(struct mlx5e_priv *priv,
13511348
void mlx5e_stats_fec_get(struct mlx5e_priv *priv,
13521349
struct ethtool_fec_stats *fec_stats)
13531350
{
1354-
if (!MLX5_CAP_PCAM_FEATURE(priv->mdev, ppcnt_statistical_group))
1351+
int mode = fec_active_mode(priv->mdev);
1352+
1353+
if (mode == MLX5E_FEC_NOFEC ||
1354+
!MLX5_CAP_PCAM_FEATURE(priv->mdev, ppcnt_statistical_group))
13551355
return;
13561356

13571357
fec_set_corrected_bits_total(priv, fec_stats);
1358-
fec_set_block_stats(priv, fec_stats);
1358+
fec_set_block_stats(priv, mode, fec_stats);
13591359
}
13601360

13611361
#define PPORT_ETH_EXT_OFF(c) \

0 commit comments

Comments
 (0)