From: Shahar Shitrit Date: Thu, 13 Feb 2025 09:46:38 +0000 (+0200) Subject: net/mlx5: Apply rate-limiting to high temperature warning X-Git-Tag: v6.15-rc1~160^2~309^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9dd3d5d258aceb37bdf09c8b91fa448f58ea81f0;p=thirdparty%2Fkernel%2Flinux.git net/mlx5: Apply rate-limiting to high temperature warning 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 Signed-off-by: Tariq Toukan Reviewed-by: Mateusz Polchlopek Link: https://patch.msgid.link/20250213094641.226501-2-tariqt@nvidia.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c index d91ea53eb394d..e8beb6289d018 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/events.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c @@ -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; }