verbs_debug.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright (c) 2006 QLogic, Inc. All rights reserved.
  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. #ifndef _VERBS_DEBUG_H
  34. #define _VERBS_DEBUG_H
  35. /*
  36. * This file contains tracing code for the ib_ipath kernel module.
  37. */
  38. #ifndef _VERBS_DEBUGGING /* tracing enabled or not */
  39. #define _VERBS_DEBUGGING 1
  40. #endif
  41. extern unsigned ib_ipath_debug;
  42. #define _VERBS_ERROR(fmt,...) \
  43. do { \
  44. printk(KERN_ERR "%s: " fmt, "ib_ipath", ##__VA_ARGS__); \
  45. } while(0)
  46. #define _VERBS_UNIT_ERROR(unit,fmt,...) \
  47. do { \
  48. printk(KERN_ERR "%s: " fmt, "ib_ipath", ##__VA_ARGS__); \
  49. } while(0)
  50. #if _VERBS_DEBUGGING
  51. /*
  52. * Mask values for debugging. The scheme allows us to compile out any
  53. * of the debug tracing stuff, and if compiled in, to enable or
  54. * disable dynamically.
  55. * This can be set at modprobe time also:
  56. * modprobe ib_path ib_ipath_debug=3
  57. */
  58. #define __VERBS_INFO 0x1 /* generic low verbosity stuff */
  59. #define __VERBS_DBG 0x2 /* generic debug */
  60. #define __VERBS_VDBG 0x4 /* verbose debug */
  61. #define __VERBS_SMADBG 0x8000 /* sma packet debug */
  62. #define _VERBS_INFO(fmt,...) \
  63. do { \
  64. if (unlikely(ib_ipath_debug&__VERBS_INFO)) \
  65. printk(KERN_INFO "%s: " fmt,"ib_ipath", \
  66. ##__VA_ARGS__); \
  67. } while(0)
  68. #define _VERBS_DBG(fmt,...) \
  69. do { \
  70. if (unlikely(ib_ipath_debug&__VERBS_DBG)) \
  71. printk(KERN_DEBUG "%s: " fmt, __func__, \
  72. ##__VA_ARGS__); \
  73. } while(0)
  74. #define _VERBS_VDBG(fmt,...) \
  75. do { \
  76. if (unlikely(ib_ipath_debug&__VERBS_VDBG)) \
  77. printk(KERN_DEBUG "%s: " fmt, __func__, \
  78. ##__VA_ARGS__); \
  79. } while(0)
  80. #define _VERBS_SMADBG(fmt,...) \
  81. do { \
  82. if (unlikely(ib_ipath_debug&__VERBS_SMADBG)) \
  83. printk(KERN_DEBUG "%s: " fmt, __func__, \
  84. ##__VA_ARGS__); \
  85. } while(0)
  86. #else /* ! _VERBS_DEBUGGING */
  87. #define _VERBS_INFO(fmt,...)
  88. #define _VERBS_DBG(fmt,...)
  89. #define _VERBS_VDBG(fmt,...)
  90. #define _VERBS_SMADBG(fmt,...)
  91. #endif /* _VERBS_DEBUGGING */
  92. #endif /* _VERBS_DEBUG_H */