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)
committerJakub Kicinski <kuba@kernel.org>
Tue, 18 Feb 2025 00:27:37 +0000 (16:27 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/events.c

index d91ea53eb394d10d45d03522203126e48d942ffa..e8beb6289d018b1adce61f948674ce7b1bf8ac29 100644 (file)
@@ -165,9 +165,10 @@ static int temp_warn(struct notifier_block *nb, unsigned long type, void *data)
        value_lsb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb);
        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;
 }