]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net/mlx5: Apply rate-limiting to high temperature warning
authorShahar Shitrit <shshitrit@nvidia.com>
Thu, 13 Feb 2025 09:46:38 +0000 (11:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:18 +0000 (11:13 +0200)
[ Upstream commit 9dd3d5d258aceb37bdf09c8b91fa448f58ea81f0 ]

Wrap the high temperature warning in a temperature event with
a call to net_ratelimit() to prevent flooding the kernel log
with repeated warning messages when temperature exceeds the
threshold multiple times within a short duration.

Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
Link: https://patch.msgid.link/20250213094641.226501-2-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/events.c

index cd8d107f7d9e30c451d38ecac61afea141b2b674..fc6e56305cbbc853b25ec6703f823ffc90ae9770 100644 (file)
@@ -169,9 +169,10 @@ static int temp_warn(struct notifier_block *nb, unsigned long type, void *data)
        value_lsb &= 0x1;
        value_msb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb);
 
-       mlx5_core_warn(events->dev,
-                      "High temperature on sensors with bit set %llx %llx",
-                      value_msb, value_lsb);
+       if (net_ratelimit())
+               mlx5_core_warn(events->dev,
+                              "High temperature on sensors with bit set %llx %llx",
+                              value_msb, value_lsb);
 
        return NOTIFY_OK;
 }