From patchwork Thu Nov 19 23:37:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralph Campbell X-Patchwork-Id: 61484 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAJNbWEL010002 for ; Thu, 19 Nov 2009 23:37:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757745AbZKSXhn (ORCPT ); Thu, 19 Nov 2009 18:37:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757931AbZKSXhn (ORCPT ); Thu, 19 Nov 2009 18:37:43 -0500 Received: from vpn.pathscale.com ([198.186.3.75]:36058 "HELO mx.mv.qlogic.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with SMTP id S1757745AbZKSXhm (ORCPT ); Thu, 19 Nov 2009 18:37:42 -0500 Received: from chromite.mv.qlogic.com (chromite.mv.qlogic.com [10.29.2.82]) by mx.mv.qlogic.com (Postfix) with ESMTP id B9D1D547C006; Thu, 19 Nov 2009 15:37:48 -0800 (PST) Received: from chromite.mv.qlogic.com (localhost.localdomain [127.0.0.1]) by chromite.mv.qlogic.com (Postfix) with ESMTP id BA381CC274; Thu, 19 Nov 2009 15:37:48 -0800 (PST) From: Ralph Campbell Subject: [PATCH 10/53] IB/qib: Add qib_debug.h To: Roland Dreier Cc: linux-rdma@vger.kernel.org Date: Thu, 19 Nov 2009 15:37:48 -0800 Message-ID: <20091119233748.30356.292.stgit@chromite.mv.qlogic.com> In-Reply-To: <20091119233655.30356.57433.stgit@chromite.mv.qlogic.com> References: <20091119233655.30356.57433.stgit@chromite.mv.qlogic.com> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/infiniband/hw/qib/qib_debug.h b/drivers/infiniband/hw/qib/qib_debug.h new file mode 100644 index 0000000..8bcd26f --- /dev/null +++ b/drivers/infiniband/hw/qib/qib_debug.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2006, 2007, 2009 QLogic Corporation. All rights reserved. + * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef _QIB_DEBUG_H +#define _QIB_DEBUG_H + +#include "qib_trace.h" + +#ifndef _QIB_DEBUGGING /* debugging enabled or not */ +#define _QIB_DEBUGGING 1 +#endif + +#if _QIB_DEBUGGING + +/* + * Mask values for debugging. The scheme allows us to compile out any + * of the debug tracing stuff, and if compiled in, to enable or disable + * dynamically. This can be set at modprobe time also: + * modprobe qlogic_ib.ko qlogic_ib_debug=7 + */ + +#define __QIB_INFO 0x1 /* logging of dev_info and dev_err */ +#define __QIB_DBG 0x2 /* generic debug */ +/* leave some low verbosity spots open */ +#define __QIB_RVPKTDBG 0x10 /* verbose pktrcv debug */ +#define __QIB_INITDBG 0x20 /* init-level debug */ +#define __QIB_VERBDBG 0x40 /* very verbose debug */ +#define __QIB_PKTDBG 0x80 /* print packet data */ +#define __QIB_PROCDBG 0x100 /* process init/exit debug */ +#define __QIB_MMDBG 0x200 /* mmap, etc debug */ +#define __QIB_ERRPKTDBG 0x400 /* packet error debugging */ +#define __QIB_SDMADBG 0x800 /* Send DMA */ +#define __QIB_VPKTDBG 0x1000 /* Dump IB contents being copied to send buf */ +#define __QIB_LINKVERBDBG 0x200000 /* very verbose linkchange debug */ + +#else /* _QIB_DEBUGGING */ + +/* + * define all of these even with debugging off, for the few places that do + * if(qlogic_ib_debug & _QIB_xyzzy), but in a way that will make the + * compiler eliminate the code + */ + +#define __QIB_DBG 0x0 /* generic debug */ +#define __QIB_VERBDBG 0x0 /* very verbose debug */ +#define __QIB_PKTDBG 0x0 /* print packet data */ +#define __QIB_PROCDBG 0x0 /* process init/exit debug */ +#define __QIB_MMDBG 0x0 /* mmap, etc debug */ +#define __QIB_ERRPKTDBG 0x0 /* packet error debugging */ +#define __QIB_SDMADBG 0x0 /* Send DMA */ +#define __QIB_LINKVERBDBG 0x0 /* very verbose linkchange debug */ + +#endif /* _QIB_DEBUGGING */ + +#define __QIB_VERBOSEDBG __QIB_VERBDBG + +#define qib_log(which, fmt, ...) \ + do { \ + if (qib_trace_buf) { \ + int cpu = smp_processor_id(); \ + cycles_t now = get_cycles(); \ + qib_trace_vputstr(qib_trace_buf, cpu, now, which, \ + "%s " fmt, __func__, ##__VA_ARGS__); \ + } \ + } while (0) + +#endif /* _QIB_DEBUG_H */