Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA29C322A3F for ; Fri, 19 Sep 2025 19:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758311706; cv=none; b=BdL1G9iY3JYdKDQjYBCegdhS/W5OD4HyfDH0wg1qDB079jLhfalubWtOJ/zNX3Kr0jKJRyqiJ0zDs7ojX/ShiLX11il5IHx9n1kfw4k+1jesBLzMAqpmoFAdU6s07Q82+o5HMEZ5YpCC5x9JJwzMEdM/A+DEd/KSYiyhaI4R9nQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758311706; c=relaxed/simple; bh=xK6ZNQiO8q9I6WhUYdmt8kq9K2Rwlm20XmybUxru0hQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tPSf33/X/sSfXfYixKY6zUs345JEYNUCf4Gp+EYSraT8bm5E9B4F6T1+YT28Lt2OKZy9zpGwGv2CQWjoqrNNOFqO+MN6qz18vjevUQcNKXCneSKp0SBKU528NehoV2ODAhornti/PkUU023Jy2kh4JgmyI9t/LJraRKbo+v4OyQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dUaFk1/0; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dUaFk1/0" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1758311701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/TpAPgWJejoNMptW7LvqfFt/hMK/gaHXEvGCOvAL75o=; b=dUaFk1/08rstDnmmiFnSA06m4PQxAtJJRh90UI8OjnJDkVBMmL085XVPoIQ62H2FBi1VsD Florr+IUXm0b1tFOH5Rn+ESX5WGmXGNL0CaFIwh+A13+73FZp6ppZp2uGC0NGuPXu+OoYu ZTTyGiZCnnSHcVFsnAGtuFpsUgkgvRQ= From: Vadim Fedorenko To: Jakub Kicinski , Andrew Lunn , Michael Chan , Pavan Chebbi , Tariq Toukan , Gal Pressman , intel-wired-lan@lists.osuosl.org, Donald Hunter , Carolina Jubran , Aleksandr Loktionov , Vadim Fedorenko Cc: Paolo Abeni , Simon Horman , netdev@vger.kernel.org, Dragos Tatulea , Yael Chemla Subject: [PATCH net-next v4 2/5] net/mlx5e: Don't query FEC statistics when FEC is disabled Date: Fri, 19 Sep 2025 19:46:48 +0000 Message-ID: <20250919194651.2164987-3-vadim.fedorenko@linux.dev> In-Reply-To: <20250919194651.2164987-1-vadim.fedorenko@linux.dev> References: <20250919194651.2164987-1-vadim.fedorenko@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Carolina Jubran Update mlx5e_stats_fec_get() to check the active FEC mode and skip statistics collection when FEC is disabled. Signed-off-by: Carolina Jubran Reviewed-by: Dragos Tatulea Reviewed-by: Yael Chemla Reviewed-by: Aleksandr Loktionov Signed-off-by: Vadim Fedorenko --- 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