mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland Dreier <rolandd@cisco.com>
To: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [PATCH 02/13]  [RFC] ipath debug header
Date: Fri, 16 Dec 2005 15:48:54 -0800	[thread overview]
Message-ID: <200512161548.HbgfRzF2TysjsR2G@cisco.com> (raw)
In-Reply-To: <200512161548.aLjaDpGm5aqk0k0p@cisco.com>

Debugging macros for ipath driver

---

 drivers/infiniband/hw/ipath/ipath_debug.h |  211 +++++++++++++++++++++++++++++
 1 files changed, 211 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/hw/ipath/ipath_debug.h

8f834f72344a3c7e9c5eafdf59b9fc96b4e08e5f
diff --git a/drivers/infiniband/hw/ipath/ipath_debug.h b/drivers/infiniband/hw/ipath/ipath_debug.h
new file mode 100644
index 0000000..c8b7374
--- /dev/null
+++ b/drivers/infiniband/hw/ipath/ipath_debug.h
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2003, 2004, 2005. 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.
+ *
+ * Patent licenses, if any, provided herein do not apply to
+ * combinations of this program with other software, or any other
+ * product whatsoever.
+ *
+ * $Id: ipath_debug.h 4504 2005-12-16 06:15:47Z rjwalsh $
+ */
+
+#ifndef _IPATH_DEBUG_H
+#define _IPATH_DEBUG_H
+
+/*
+ * This file contains tracing code that is lightweight, and can be
+ * called from both user and kernel mode
+ * _IPATH_DBG should have the same calling conventions and semantics
+ * for both user and kernel.
+ */
+#ifndef _IPATH_DEBUGGING	/* tracing enabled or not */
+#define _IPATH_DEBUGGING 1
+#endif
+
+/* This macros should only be used in the trace library code. */
+#define _IPATH_DEBUG_VARS_DECL unsigned infinipath_debug;
+extern unsigned infinipath_debug;
+extern const char *ipath_get_unit_name(int unit);
+
+/*
+ * These are always defined, because _IPATH_ERROR is always defined,
+ * unlike the other debugging calls.  It might make sense to change
+ * to using "fprintf(stderr", for the usermode version, but not now.
+ */
+#ifdef __KERNEL__
+#define __IPPRT printk
+#define __IPATH_UNIT_ERRID(unit) ipath_get_unit_name(unit)
+#define __IPATH_ERRID "infinipath"
+#else
+#define __IPPRT printf
+extern char *__progname;
+#define __IPATH_UNIT_ERRID(unit) __progname
+#define __IPATH_ERRID __progname
+#define KERN_ERR
+#endif
+
+#if _IPATH_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 infinipath.ko infinipath_debug=7
+ */
+#define __IPATH_INFO        0x1	/* generic low verbosity stuff */
+#define __IPATH_DBG         0x2	/* generic debug */
+#define __IPATH_TRSAMPLE    0x8	/* generate trace buffer sample entries */
+/* leave some low verbosity spots open */
+#define __IPATH_VERBDBG     0x40	/* very verbose debug */
+#define __IPATH_PKTDBG      0x80	/* print packet data */
+/* print process startup (init)/exit messages */
+#define __IPATH_PROCDBG     0x100
+/* print mmap/nopage stuff, not using VDBG any more */
+#define __IPATH_MMDBG       0x200
+#define __IPATH_USER_SEND   0x1000	/* use user mode send */
+#define __IPATH_KERNEL_SEND 0x2000	/* use kernel mode send */
+#define __IPATH_EPKTDBG     0x4000	/* print ethernet packet data */
+#define __IPATH_SMADBG      0x8000	/* sma packet debug */
+#define __IPATH_IPATHDBG    0x10000	/* Ethernet (IPATH) general debug on */
+#define __IPATH_IPATHWARN   0x20000	/* Ethernet (IPATH) warnings on */
+#define __IPATH_IPATHERR    0x40000	/* Ethernet (IPATH) errors on */
+#define __IPATH_IPATHPD     0x80000	/* Ethernet (IPATH) packet dump on */
+#define __IPATH_IPATHTABLE  0x100000	/* Ethernet (IPATH) table dump on */
+
+#ifdef __KERNEL__
+#define __IPIDENT
+#define __IPIDENT_ARG
+#define __IP_INFO_TAG __IPATH_ERRID
+#define _Pragma_unlikely
+#else
+#define KERN_INFO
+#define KERN_DEBUG
+#define __IPIDENT "%s"
+#define __IPIDENT_ARG __ipath_mylabel,
+#define __IP_INFO_TAG __func__
+extern char *__ipath_mylabel;
+extern void ipath_set_mylabel(char *);
+#define _Pragma_unlikely _Pragma("mips_frequency_hint never")
+#endif
+
+#define _IPATH_UNIT_ERROR(unit,fmt,...) do { \
+        _Pragma_unlikely \
+        __IPPRT (KERN_ERR  __IPIDENT "%s: " fmt, __IPIDENT_ARG __IPATH_UNIT_ERRID(unit), \
+                ##__VA_ARGS__); \
+        } while(0)
+
+#define _IPATH_ERROR(fmt,...) do { \
+        _Pragma_unlikely \
+        __IPPRT (KERN_ERR  __IPIDENT "%s: " fmt, __IPIDENT_ARG __IPATH_ERRID, \
+                ##__VA_ARGS__); \
+        } while(0)
+
+#define _IPATH_INFO(fmt,...) do { \
+        _Pragma_unlikely \
+        if(unlikely(infinipath_debug&__IPATH_INFO))  \
+            __IPPRT (KERN_INFO __IPIDENT "%s: " fmt,\
+              __IPIDENT_ARG __IP_INFO_TAG,##__VA_ARGS__); \
+        } while(0)
+
+#define  __IPATH_USER_MODE_SEND unlikely(infinipath_debug & __IPATH_USER_SEND)
+#define  __IPATH_KERNEL_MODE_SEND unlikely(infinipath_debug & __IPATH_KERNEL_SEND)
+#define  __IPATH_PKTDBG_ON unlikely(infinipath_debug & __IPATH_PKTDBG)
+
+#define  __IPATH_DBG_WHICH(which,fmt,...) do { \
+        _Pragma_unlikely \
+        if(unlikely(infinipath_debug&(which)))  __IPPRT (KERN_DEBUG __IPIDENT "%s: " fmt,\
+            __IPIDENT_ARG __func__,##__VA_ARGS__); \
+        } while(0)
+#define  _IPATH_DBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_DBG,fmt,##__VA_ARGS__)
+#define  _IPATH_VDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_VERBDBG,fmt,##__VA_ARGS__)
+#define  _IPATH_PDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_PKTDBG,fmt,##__VA_ARGS__)
+#define  _IPATH_EPDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_EPKTDBG,fmt,##__VA_ARGS__)
+#define  _IPATH_PRDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_PROCDBG,fmt,##__VA_ARGS__)
+#define  _IPATH_MMDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_MMDBG,fmt,##__VA_ARGS__)
+#define  _IPATH_SMADBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_SMADBG,fmt,##__VA_ARGS__)
+#define  _IPATH_IPATHDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_IPATHDBG,fmt,##__VA_ARGS__)
+#define  _IPATH_IPATHWARN(fmt,...) __IPATH_DBG_WHICH(__IPATH_IPATHWARN,fmt,##__VA_ARGS__)
+#define  _IPATH_IPATHERR(fmt,...) __IPATH_DBG_WHICH(__IPATH_IPATHERR ,fmt,##__VA_ARGS__)
+#define  _IPATH_IPATHPD(fmt,...) __IPATH_DBG_WHICH(__IPATH_IPATHPD  ,fmt,##__VA_ARGS__)
+#define  _IPATH_IPATHTABLE(fmt,...) __IPATH_DBG_WHICH(__IPATH_IPATHTABLE  ,fmt,##__VA_ARGS__)
+
+#else				/* ! _IPATH_DEBUGGING */
+
+#define _IPATH_UNIT_ERROR(unit,fmt,...) do { \
+        __IPPRT (KERN_ERR  "%s" fmt, "",##__VA_ARGS__); \
+        } while(0)
+
+#define _IPATH_ERROR(fmt,...) do { \
+        __IPPRT (KERN_ERR  "%s" fmt, "",##__VA_ARGS__); \
+        } while(0)
+
+#define _IPATH_INFO(fmt,...)
+#define _IPATH_DBG(fmt,...)
+#define _IPATH_PDBG(fmt,...)
+#define _IPATH_EPDBG(fmt,...)
+#define _IPATH_PRDBG(fmt,...)
+#define _IPATH_VDBG(fmt,...)
+#define _IPATH_MMDBG(fmt,...)
+#define _IPATH_SMADBG(fmt,...)
+#define _IPATH_IPATHDBG(fmt,...)
+#define _IPATH_IPATHWARN(fmt,...)
+#define _IPATH_IPATHERR(fmt,...)
+#define _IPATH_IPATHPD(fmt,...)
+#define _IPATH_IPATHTABLE(fmt,...)
+
+/*
+ * define all of these even with debugging off, for the few places that do
+ * if(infinipath_debug&_IPATH_xyzzy), but in a way that will make the
+ * compiler eliminate the code
+ */
+#define __IPATH_INFO      0x0	/* generic low verbosity stuff */
+#define __IPATH_DBG       0x0	/* generic debug */
+#define __IPATH_CALL      0x0	/* function call entrance/exit */
+#define __IPATH_TRSAMPLE  0x0	/* generate trace buffer sample entries */
+#define __IPATH_VCALL     0x0	/* function call entrance/exit */
+#define __IPATH_VERBDBG   0x0	/* very verbose debug */
+#define __IPATH_PKTDBG    0x0	/* print packet data */
+#define __IPATH_PROCDBG   0x0	/* print process startup (init)/exit messages */
+/* print mmap/nopage stuff, not using VDBG any more */
+#define __IPATH_MMDBG     0x0
+#define __IPATH_EPKTDBG   0x0	/* print ethernet packet data */
+#define __IPATH_SMADBG    0x0	/* print process startup (init)/exit messages */
+#define __IPATH_IPATHDBG  0x0	/* Ethernet (IPATH) table dump on */
+#define __IPATH_IPATHWARN 0x0	/* Ethernet (IPATH) warnings on   */
+#define __IPATH_IPATHERR  0x0	/* Ethernet (IPATH) errors on   */
+#define __IPATH_IPATHPD   0x0	/* Ethernet (IPATH) packet dump on   */
+#define __IPATH_IPATHTABLE 0x0	/* Ethernet (IPATH) packet dump on   */
+#define  __IPATH_USER_MODE_SEND 0
+#define  __IPATH_KERNEL_MODE_SEND 0
+#define  __IPATH_PKTDBG_ON 0
+
+#endif				/* _IPATH_DEBUGGING */
+
+#endif				/* _IPATH_DEBUG_H */
-- 
0.99.9n

  reply	other threads:[~2005-12-16 23:49 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20051031150618.627779f1.akpm@osdl.org>
2005-12-16 23:48 ` [PATCH 00/13] [RFC] IB: PathScale InfiniPath driver Roland Dreier
2005-12-16 23:48   ` [PATCH 01/13] [RFC] ipath basic headers Roland Dreier
2005-12-16 23:48     ` Roland Dreier [this message]
2005-12-16 23:48       ` [PATCH 03/13] [RFC] ipath copy routines Roland Dreier
2005-12-16 23:48         ` [PATCH 04/13] [RFC] ipath LLD core, part 1 Roland Dreier
2005-12-16 23:48           ` [PATCH 05/13] [RFC] ipath LLD core, part 2 Roland Dreier
2005-12-16 23:48             ` [PATCH 06/13] [RFC] ipath LLD core, part 3 Roland Dreier
2005-12-16 23:48               ` [PATCH 07/13] [RFC] ipath core misc files Roland Dreier
2005-12-16 23:48                 ` [PATCH 08/13] [RFC] ipath core last bit Roland Dreier
2005-12-16 23:48                   ` [PATCH 09/13] [RFC] ipath IB driver headers Roland Dreier
2005-12-16 23:48                     ` [PATCH 10/13] [RFC] ipath verbs, part 1 Roland Dreier
2005-12-16 23:48                       ` [PATCH 11/13] [RFC] ipath verbs, part 2 Roland Dreier
2005-12-16 23:48                         ` [PATCH 12/13] [RFC] ipath verbs MAD handling Roland Dreier
2005-12-16 23:48                           ` [PATCH 13/13] [RFC] ipath Kconfig and Makefile Roland Dreier
2005-12-17 21:52                             ` Adrian Bunk
2005-12-17 22:54                               ` [openib-general] " Robert Walsh
2005-12-17 23:55                                 ` Adrian Bunk
2005-12-18  1:17                                   ` Robert Walsh
2005-12-18  0:27                                 ` Alan Cox
2005-12-18 19:23                             ` Sam Ravnborg
2005-12-20  0:32                               ` [openib-general] " Robert Walsh
2005-12-26  2:49                               ` Roland Dreier
2005-12-18 19:59                       ` [PATCH 10/13] [RFC] ipath verbs, part 1 Paul E. McKenney
2005-12-18 20:05                         ` [openib-general] " Robert Walsh
2005-12-19 20:50                         ` Ralph Campbell
2005-12-17 20:38                   ` [PATCH 08/13] [RFC] ipath core last bit Andrew Morton
2005-12-21  0:00                     ` Robert Walsh
2005-12-17 20:38                 ` [PATCH 07/13] [RFC] ipath core misc files Andrew Morton
2005-12-17 21:29                   ` Robert Walsh
2005-12-17 21:33                   ` Robert Walsh
2005-12-18  3:10                     ` Andrew Morton
2005-12-18  3:13                       ` Robert Walsh
2005-12-17 20:38           ` [PATCH 04/13] [RFC] ipath LLD core, part 1 Andrew Morton
2005-12-17 21:34             ` Robert Walsh
2005-12-17 12:38         ` [PATCH 03/13] [RFC] ipath copy routines Pekka Enberg
2005-12-17 21:38           ` Robert Walsh
2005-12-17 13:16         ` Christoph Hellwig
2005-12-17 20:38         ` Andrew Morton
2005-12-17 22:40           ` Robert Walsh
2005-12-18  3:19             ` Andrew Morton
2005-12-18  3:35               ` Adrian Bunk
2005-12-18  5:33               ` Robert Walsh
2005-12-18  9:33               ` David S. Miller
2005-12-18 19:52                 ` Robert Walsh
2005-12-18  3:27             ` Andi Kleen
2005-12-18  5:36               ` Robert Walsh
2005-12-18  5:41                 ` Andi Kleen
2005-12-18 13:25               ` Alan Cox
2005-12-17 12:33     ` [PATCH 01/13] [RFC] ipath basic headers Pekka Enberg
2005-12-17 21:55       ` Robert Walsh
2005-12-17 13:14     ` Christoph Hellwig
2005-12-17 21:51       ` Eric W. Biederman
2005-12-18  3:25         ` Andi Kleen
2005-12-18 15:02           ` Eric W. Biederman
2005-12-17 22:19       ` Robert Walsh
2005-12-17 22:25         ` Arjan van de Ven
2005-12-17 22:47           ` Robert Walsh
2005-12-17 20:38     ` Andrew Morton
2005-12-17 22:39       ` Robert Walsh
2005-12-18  3:14         ` Andrew Morton
2005-12-20  1:43       ` Robert Walsh
2005-12-17 13:16   ` [PATCH 00/13] [RFC] IB: PathScale InfiniPath driver Christoph Hellwig
2005-12-17 15:51     ` Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200512161548.HbgfRzF2TysjsR2G@cisco.com \
    --to=rolandd@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®