From patchwork Fri Mar 29 22:38:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 10877897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D411C1575 for ; Fri, 29 Mar 2019 22:39:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEEFB29082 for ; Fri, 29 Mar 2019 22:39:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B38C5291C5; Fri, 29 Mar 2019 22:39:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5751429082 for ; Fri, 29 Mar 2019 22:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730641AbfC2WjC (ORCPT ); Fri, 29 Mar 2019 18:39:02 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:50615 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730638AbfC2WjB (ORCPT ); Fri, 29 Mar 2019 18:39:01 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from saeedm@mellanox.com) with ESMTPS (AES256-SHA encrypted); 30 Mar 2019 01:38:55 +0300 Received: from sx1.mtl.com ([172.16.5.10]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x2TMcJ3s012644; Sat, 30 Mar 2019 01:38:54 +0300 From: Saeed Mahameed To: saeed@mellanox.com, Leon Romanovsky Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Aya Levin , Saeed Mahameed Subject: [PATCH mlx5-next 12/14] net/mlx5: Add rate limit print macros Date: Fri, 29 Mar 2019 15:38:02 -0700 Message-Id: <20190329223804.8954-13-saeedm@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329223804.8954-1-saeedm@mellanox.com> References: <20190329223804.8954-1-saeedm@mellanox.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Aya Levin 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 Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index 052e81974c3b..d66f4f082ef7 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 */