diff mbox series

[net-next,3/4] net/mlx5: Modify LSB bitmask in temperature event to include only the first bit

Message ID 20250213094641.226501-4-tariqt@nvidia.com (mailing list archive)
State Accepted
Commit 633f16d7e07c129a36b882c05379e01ce5bdb542
Delegated to: Netdev Maintainers
Headers show
Series mlx5: Add sensor name in temperature message | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-15--03-00 (tests: 891)

Commit Message

Tariq Toukan Feb. 13, 2025, 9:46 a.m. UTC
From: Shahar Shitrit <shshitrit@nvidia.com>

In the sensor_count field of the MTEWE register, bits 1-62 are
supported only for unmanaged switches, not for NICs, and bit 63
is reserved for internal use.

To prevent confusing output that may include set bits that are
not relevant to NIC sensors, we update the bitmask to retain only
the first bit, which corresponds to the sensor ASIC.

Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/events.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mateusz Polchlopek Feb. 13, 2025, 12:11 p.m. UTC | #1
On 2/13/2025 10:46 AM, Tariq Toukan wrote:
> From: Shahar Shitrit <shshitrit@nvidia.com>
> 
> In the sensor_count field of the MTEWE register, bits 1-62 are
> supported only for unmanaged switches, not for NICs, and bit 63
> is reserved for internal use.
> 
> To prevent confusing output that may include set bits that are
> not relevant to NIC sensors, we update the bitmask to retain only
> the first bit, which corresponds to the sensor ASIC.
> 
> Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/events.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c
> index a661aa522a9a..e85a9042e3c2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/events.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c
> @@ -163,6 +163,10 @@ static int temp_warn(struct notifier_block *nb, unsigned long type, void *data)
>   	u64 value_msb;
>   
>   	value_lsb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb);
> +	/* bit 1-63 are not supported for NICs,
> +	 * hence read only bit 0 (asic) from lsb.
> +	 */
> +	value_lsb &= 0x1;
>   	value_msb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb);
>   
>   	if (net_ratelimit())

Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c
index a661aa522a9a..e85a9042e3c2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/events.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c
@@ -163,6 +163,10 @@  static int temp_warn(struct notifier_block *nb, unsigned long type, void *data)
 	u64 value_msb;
 
 	value_lsb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb);
+	/* bit 1-63 are not supported for NICs,
+	 * hence read only bit 0 (asic) from lsb.
+	 */
+	value_lsb &= 0x1;
 	value_msb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb);
 
 	if (net_ratelimit())