RE: [PATCH net-next v6 2/5] net/mlx5e: Don't query FEC statistics when FEC is disabled

From
Loktionov, Aleksandr <hidden>
Date
2025-09-24 13:39:30
Also in
intel-wired-lan
Reply to
Vadim Fedorenko, 2025-09-24
quoted hunk ↗ jump to hunk
-----Original Message-----
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Sent: Wednesday, September 24, 2025 2:41 PM
To: Jakub Kicinski <kuba@kernel.org>; Andrew Lunn <andrew@lunn.ch>;
Michael Chan [off-list ref]; Pavan Chebbi
[off-list ref]; Tariq Toukan [off-list ref]; Gal
Pressman [off-list ref]; intel-wired-lan@lists.osuosl.org; Donald
Hunter [off-list ref]; Carolina Jubran
[off-list ref]; Loktionov, Aleksandr
[off-list ref]; Vadim Fedorenko
[off-list ref]
Cc: Paolo Abeni <pabeni@redhat.com>; Simon Horman <horms@kernel.org>;
netdev@vger.kernel.org; Dragos Tatulea [off-list ref]; Yael
Chemla [off-list ref]
Subject: [PATCH net-next v6 2/5] net/mlx5e: Don't query FEC statistics
when FEC is disabled

From: Carolina Jubran <redacted>

Update mlx5e_stats_fec_get() to check the active FEC mode and skip
statistics collection when FEC is disabled.

Signed-off-by: Carolina Jubran <redacted>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Yael Chemla <redacted>
Reviewed-by: Aleksandr Loktionov <redacted>
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
index 87536f158d07..aae0022e8736 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
@@ -1446,16 +1446,13 @@ static void fec_set_rs_stats(struct
ethtool_fec_stats *fec_stats, u32 *ppcnt)  }

 static void fec_set_block_stats(struct mlx5e_priv *priv,
+				int mode,
 				struct ethtool_fec_stats *fec_stats)  {
 	struct mlx5_core_dev *mdev = priv->mdev;
 	u32 out[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
 	u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
 	int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
-	int mode = fec_active_mode(mdev);
-
-	if (mode == MLX5E_FEC_NOFEC)
-		return;

 	MLX5_SET(ppcnt_reg, in, local_port, 1);
 	MLX5_SET(ppcnt_reg, in, grp,
MLX5_PHYSICAL_LAYER_COUNTERS_GROUP);
@@ -1496,11 +1493,14 @@ static void
fec_set_corrected_bits_total(struct mlx5e_priv *priv,  void
mlx5e_stats_fec_get(struct mlx5e_priv *priv,
 			 struct ethtool_fec_stats *fec_stats)  {
-	if (!MLX5_CAP_PCAM_FEATURE(priv->mdev,
ppcnt_statistical_group))
+	int mode = fec_active_mode(priv->mdev);
+
+	if (mode == MLX5E_FEC_NOFEC ||
+	    !MLX5_CAP_PCAM_FEATURE(priv->mdev,
ppcnt_statistical_group))
 		return;

 	fec_set_corrected_bits_total(priv, fec_stats);
-	fec_set_block_stats(priv, fec_stats);
+	fec_set_block_stats(priv, mode, fec_stats);
 }

 #define PPORT_ETH_EXT_OFF(c) \
--
2.47.3
Reviewed-by: Aleksandr Loktionov <redacted>
Thread (11 messages) 11 messages, 3 authors, last reply 2025-09-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help