verbs_debug.h 3.2 KB

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