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