]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net/mlx5: Add rate limit print macros
authorAya Levin <ayal@mellanox.com>
Fri, 29 Mar 2019 22:38:02 +0000 (15:38 -0700)
committerSaeed Mahameed <saeedm@mellanox.com>
Tue, 2 Apr 2019 19:49:38 +0000 (12:49 -0700)
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>
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

index 1e94ba62892f005d78111b9380f7066062ffb7c3..a67d3d5f651ed6402e7448046c27e200bb7ff0e2 100644 (file)
@@ -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 */