summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAya Levin <ayal@mellanox.com>2019-03-29 23:38:02 +0100
committerSaeed Mahameed <saeedm@mellanox.com>2019-04-02 21:49:38 +0200
commit3732b9720ffe0fedcadbcb5dc3add1dd0d926bcf (patch)
treedaca4314b75395bfb8041896ff6818dc317ff99f
parentnet/mlx5: Add explicit bar address field (diff)
downloadlinux-3732b9720ffe0fedcadbcb5dc3add1dd0d926bcf.tar.xz
linux-3732b9720ffe0fedcadbcb5dc3add1dd0d926bcf.zip
net/mlx5: Add rate limit print macros
Add rate limited print macros for warning and info level. This protects the system from burst of prints depleting HW resources and spamming dmesg. Signed-off-by: Aya Levin <ayal@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
index 1e94ba62892f..a67d3d5f651e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -83,9 +83,19 @@ do { \
__func__, __LINE__, current->pid, \
##__VA_ARGS__)
+#define mlx5_core_warn_rl(__dev, format, ...) \
+ pr_warn_ratelimited("%s:%s:%d:(pid %d): " format, (__dev)->priv.name, \
+ __func__, __LINE__, current->pid, \
+ ##__VA_ARGS__)
+
#define mlx5_core_info(__dev, format, ...) \
pr_info("%s " format, (__dev)->priv.name, ##__VA_ARGS__)
+#define mlx5_core_info_rl(__dev, format, ...) \
+ pr_info_ratelimited("%s:%s:%d:(pid %d): " format, (__dev)->priv.name, \
+ __func__, __LINE__, current->pid, \
+ ##__VA_ARGS__)
+
enum {
MLX5_CMD_DATA, /* print command payload only */
MLX5_CMD_TIME, /* print command execution time */