[PATCH 1/1] net/mlx5: add dynamic logging for mlx5_dump_err_cqe

From: Aru Kolappan
Date: Wed Oct 12 2022 - 19:50:48 EST


From: Arumugam Kolappan <aru.kolappan@xxxxxxxxxx>

Presently, mlx5 driver dumps error CQE by default for few syndromes. Some
syndromes are expected due to application behavior[Ex: REMOTE_ACCESS_ERR
for revoking rkey before RDMA operation is completed]. There is no option
to disable the log if the application decided to do so. This patch
converts the log into dynamic print and by default, this debug print is
disabled. Users can enable/disable this logging at runtime if needed.

Suggested-by: Manjunath Patil <manjunath.b.patil@xxxxxxxxxx>
Signed-off-by: Arumugam Kolappan <aru.kolappan@xxxxxxxxxx>
---
drivers/infiniband/hw/mlx5/cq.c | 2 +-
include/linux/mlx5/cq.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index be189e0..890cdc3 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -269,7 +269,7 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,

static void dump_cqe(struct mlx5_ib_dev *dev, struct mlx5_err_cqe *cqe)
{
- mlx5_ib_warn(dev, "dump error cqe\n");
+ mlx5_ib_dbg(dev, "dump error cqe\n");
mlx5_dump_err_cqe(dev->mdev, cqe);
}

diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index cb15308..2eae88a 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -198,8 +198,8 @@ int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev,
static inline void mlx5_dump_err_cqe(struct mlx5_core_dev *dev,
struct mlx5_err_cqe *err_cqe)
{
- print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, err_cqe,
- sizeof(*err_cqe), false);
+ print_hex_dump_debug("", DUMP_PREFIX_OFFSET, 16, 1, err_cqe,
+ sizeof(*err_cqe), false);
}
int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
--
1.8.3.1