Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753286AbdHBURK (ORCPT ); Wed, 2 Aug 2017 16:17:10 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:50850 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbdHBUMZ (ORCPT ); Wed, 2 Aug 2017 16:12:25 -0400 x-originating-ip: 107.180.71.197 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Cc: Long Li Subject: [[PATCH v1] 03/37] [CIFS] SMBD: Add logging functions for debug Date: Wed, 2 Aug 2017 13:10:14 -0700 Message-Id: <1501704648-20159-4-git-send-email-longli@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfJzJqxxyELfUPnhAhTmldre6xss+33ppDHdXq/FvwBjK8wkc84D4KMXYvHrfoxthBPKf7VQ+U7/8sPIzq1kIaPh+0s4ewgSpQwqdxvaHgQ0wgtBrlR+R jUE1Y7wE1jp6jeOOed350RUhNxkjJURBnwlHo7bElPfPJK1LLIr/kqkydsZi33mh2E+unhTEUDd/qVw9MTedymCu7uzXnyO7Fk6rhKMaV6M88NZ1oGT+1PJx tMXUP/5azO86XiNKy6FhNZQrLHq/V2wtxGc3EleYyYRMgvb6QCR54bfukXk2/NVRQ8MZSx27X8WrC+okltk4dX7mYcWrOrBOZnSfs2NZtZI= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2608 Lines: 71 From: Long Li SMBD transport code will use those logging functions for debug. Signed-off-by: Long Li --- fs/cifs/cifsrdma.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/fs/cifs/cifsrdma.c b/fs/cifs/cifsrdma.c index a2c0478..3c9f478 100644 --- a/fs/cifs/cifsrdma.c +++ b/fs/cifs/cifsrdma.c @@ -54,3 +54,55 @@ #include "cifsrdma.h" +/* Logging functions + * Logging are defined as classes. They can be ORed to define the actual + * logging level via module parameter rdma_logging_class + * e.g. cifs.rdma_logging_class=0x500 will log all log_rdma_recv() and + * log_rdma_event() + */ +#define LOG_CREDIT 0x1 +#define LOG_OUTGOING 0x2 +#define LOG_INCOMING 0x4 +#define LOG_RECEIVE_QUEUE 0x8 +#define LOG_REASSEMBLY_QUEUE 0x10 +#define LOG_CIFS_READ 0x20 +#define LOG_CIFS_WRITE 0x40 +#define LOG_RDMA_SEND 0x80 +#define LOG_RDMA_RECV 0x100 +#define LOG_KEEP_ALIVE 0x200 +#define LOG_RDMA_EVENT 0x400 + +static unsigned int rdma_logging_class = 0; +module_param(rdma_logging_class, uint, 0644); +MODULE_PARM_DESC(rdma_logging_class, + "Logging class for SMBD transport 0 to 512"); + +#define log_rdma(class, fmt, args...) \ +do { \ + if (class & rdma_logging_class) \ + cifs_dbg(VFS, "%s:%d " fmt, __func__, __LINE__, ##args);\ +} while (0) + +#define log_rdma_credit(fmt, args...) log_rdma(LOG_CREDIT, fmt, ##args) +#define log_outgoing(fmt, args...) log_rdma(LOG_OUTGOING, fmt, ##args) +#define log_incoming(fmt, args...) log_rdma(LOG_INCOMING, fmt, ##args) +#define log_receive_queue(fmt, args...) \ + log_rdma(LOG_RECEIVE_QUEUE, fmt, ##args) +#define log_reassembly_queue(fmt, args...) \ + log_rdma(LOG_REASSEMBLY_QUEUE, fmt, ##args) +#define log_cifs_read(fmt, args...) log_rdma(LOG_CIFS_READ, fmt, ##args) +#define log_cifs_write(fmt, args...) log_rdma(LOG_CIFS_WRITE, fmt, ##args) +#define log_rdma_send(fmt, args...) log_rdma(LOG_RDMA_SEND, fmt, ##args) +#define log_rdma_recv(fmt, args...) log_rdma(LOG_RDMA_RECV, fmt, ##args) +#define log_keep_alive(fmt, args...) log_rdma(LOG_KEEP_ALIVE, fmt, ##args) +#define log_rdma_event(fmt, args...) log_rdma(LOG_RDMA_EVENT, fmt, ##args) + +#define log_transport_credit(info) \ +do { \ + log_rdma_credit("receive_credits %d receive_credit_target %d " \ + "send_credits %d send_credit_target %d\n", \ + atomic_read(&info->receive_credits), \ + atomic_read(&info->receive_credit_target), \ + atomic_read(&info->send_credits), \ + info->send_credit_target); \ +} while (0) -- 2.7.4