Bryan O'Sullivan | aa735ed | 2006-03-29 15:23:33 -0800 | [diff] [blame] | 1 | /* |
Bryan O'Sullivan | 759d576 | 2006-07-01 04:35:49 -0700 | [diff] [blame^] | 2 | * Copyright (c) 2006 QLogic, Inc. All rights reserved. |
Bryan O'Sullivan | aa735ed | 2006-03-29 15:23:33 -0800 | [diff] [blame] | 3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
| 4 | * |
| 5 | * This software is available to you under a choice of one of two |
| 6 | * licenses. You may choose to be licensed under the terms of the GNU |
| 7 | * General Public License (GPL) Version 2, available from the file |
| 8 | * COPYING in the main directory of this source tree, or the |
| 9 | * OpenIB.org BSD license below: |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or |
| 12 | * without modification, are permitted provided that the following |
| 13 | * conditions are met: |
| 14 | * |
| 15 | * - Redistributions of source code must retain the above |
| 16 | * copyright notice, this list of conditions and the following |
| 17 | * disclaimer. |
| 18 | * |
| 19 | * - Redistributions in binary form must reproduce the above |
| 20 | * copyright notice, this list of conditions and the following |
| 21 | * disclaimer in the documentation and/or other materials |
| 22 | * provided with the distribution. |
| 23 | * |
| 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 31 | * SOFTWARE. |
| 32 | */ |
| 33 | |
| 34 | #ifndef _VERBS_DEBUG_H |
| 35 | #define _VERBS_DEBUG_H |
| 36 | |
| 37 | /* |
| 38 | * This file contains tracing code for the ib_ipath kernel module. |
| 39 | */ |
| 40 | #ifndef _VERBS_DEBUGGING /* tracing enabled or not */ |
| 41 | #define _VERBS_DEBUGGING 1 |
| 42 | #endif |
| 43 | |
| 44 | extern unsigned ib_ipath_debug; |
| 45 | |
| 46 | #define _VERBS_ERROR(fmt,...) \ |
| 47 | do { \ |
| 48 | printk(KERN_ERR "%s: " fmt, "ib_ipath", ##__VA_ARGS__); \ |
| 49 | } while(0) |
| 50 | |
| 51 | #define _VERBS_UNIT_ERROR(unit,fmt,...) \ |
| 52 | do { \ |
| 53 | printk(KERN_ERR "%s: " fmt, "ib_ipath", ##__VA_ARGS__); \ |
| 54 | } while(0) |
| 55 | |
| 56 | #if _VERBS_DEBUGGING |
| 57 | |
| 58 | /* |
| 59 | * Mask values for debugging. The scheme allows us to compile out any |
| 60 | * of the debug tracing stuff, and if compiled in, to enable or |
| 61 | * disable dynamically. |
| 62 | * This can be set at modprobe time also: |
| 63 | * modprobe ib_path ib_ipath_debug=3 |
| 64 | */ |
| 65 | |
| 66 | #define __VERBS_INFO 0x1 /* generic low verbosity stuff */ |
| 67 | #define __VERBS_DBG 0x2 /* generic debug */ |
| 68 | #define __VERBS_VDBG 0x4 /* verbose debug */ |
| 69 | #define __VERBS_SMADBG 0x8000 /* sma packet debug */ |
| 70 | |
| 71 | #define _VERBS_INFO(fmt,...) \ |
| 72 | do { \ |
| 73 | if (unlikely(ib_ipath_debug&__VERBS_INFO)) \ |
| 74 | printk(KERN_INFO "%s: " fmt,"ib_ipath", \ |
| 75 | ##__VA_ARGS__); \ |
| 76 | } while(0) |
| 77 | |
| 78 | #define _VERBS_DBG(fmt,...) \ |
| 79 | do { \ |
| 80 | if (unlikely(ib_ipath_debug&__VERBS_DBG)) \ |
| 81 | printk(KERN_DEBUG "%s: " fmt, __func__, \ |
| 82 | ##__VA_ARGS__); \ |
| 83 | } while(0) |
| 84 | |
| 85 | #define _VERBS_VDBG(fmt,...) \ |
| 86 | do { \ |
| 87 | if (unlikely(ib_ipath_debug&__VERBS_VDBG)) \ |
| 88 | printk(KERN_DEBUG "%s: " fmt, __func__, \ |
| 89 | ##__VA_ARGS__); \ |
| 90 | } while(0) |
| 91 | |
| 92 | #define _VERBS_SMADBG(fmt,...) \ |
| 93 | do { \ |
| 94 | if (unlikely(ib_ipath_debug&__VERBS_SMADBG)) \ |
| 95 | printk(KERN_DEBUG "%s: " fmt, __func__, \ |
| 96 | ##__VA_ARGS__); \ |
| 97 | } while(0) |
| 98 | |
| 99 | #else /* ! _VERBS_DEBUGGING */ |
| 100 | |
| 101 | #define _VERBS_INFO(fmt,...) |
| 102 | #define _VERBS_DBG(fmt,...) |
| 103 | #define _VERBS_VDBG(fmt,...) |
| 104 | #define _VERBS_SMADBG(fmt,...) |
| 105 | |
| 106 | #endif /* _VERBS_DEBUGGING */ |
| 107 | |
| 108 | #endif /* _VERBS_DEBUG_H */ |