1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 * 21 * Copyright (c) 2002-2006 Neterion, Inc. 22 */ 23 24 #ifndef XGE_DEBUG_H 25 #define XGE_DEBUG_H 26 27 #include "xge-os-pal.h" 28 29 __EXTERN_BEGIN_DECLS 30 31 /* to make some gcc versions happier */ 32 #ifndef __func__ 33 #define __func__ __FUNCTION__ 34 #endif 35 36 #ifdef XGE_DEBUG_FP 37 #define XGE_DEBUG_FP_DEVICE 0x1 38 #define XGE_DEBUG_FP_CHANNEL 0x2 39 #define XGE_DEBUG_FP_FIFO 0x4 40 #define XGE_DEBUG_FP_RING 0x8 41 #endif 42 43 /** 44 * enum xge_debug_level_e 45 * @XGE_NONE: debug disabled 46 * @XGE_ERR: all errors going to be logged out 47 * @XGE_TRACE: all errors plus all kind of verbose tracing print outs 48 * going to be logged out. Very noisy. 49 * 50 * This enumeration going to be used to switch between different 51 * debug levels during runtime if DEBUG macro defined during 52 * compilation. If DEBUG macro not defined than code will be 53 * compiled out. 54 */ 55 typedef enum xge_debug_level_e { 56 XGE_NONE = 0, 57 XGE_TRACE = 1, 58 XGE_ERR = 2, 59 } xge_debug_level_e; 60 61 #define XGE_DEBUG_MODULE_MASK_DEF 0x00003030 62 #define XGE_DEBUG_LEVEL_DEF XGE_ERR 63 64 #if defined(XGE_DEBUG_TRACE_MASK) || defined(XGE_DEBUG_ERR_MASK) 65 66 extern unsigned int *g_module_mask; 67 extern int *g_level; 68 69 #ifndef XGE_DEBUG_TRACE_MASK 70 #define XGE_DEBUG_TRACE_MASK 0 71 #endif 72 73 #ifndef XGE_DEBUG_ERR_MASK 74 #define XGE_DEBUG_ERR_MASK 0 75 #endif 76 77 /* 78 * @XGE_COMPONENT_HAL_CONFIG: do debug for xge core config module 79 * @XGE_COMPONENT_HAL_FIFO: do debug for xge core fifo module 80 * @XGE_COMPONENT_HAL_RING: do debug for xge core ring module 81 * @XGE_COMPONENT_HAL_CHANNEL: do debug for xge core channel module 82 * @XGE_COMPONENT_HAL_DEVICE: do debug for xge core device module 83 * @XGE_COMPONENT_HAL_DMQ: do debug for xge core DMQ module 84 * @XGE_COMPONENT_HAL_UMQ: do debug for xge core UMQ module 85 * @XGE_COMPONENT_HAL_SQ: do debug for xge core SQ module 86 * @XGE_COMPONENT_HAL_SRQ: do debug for xge core SRQ module 87 * @XGE_COMPONENT_HAL_CRQ: do debug for xge core CRQ module 88 * @XGE_COMPONENT_HAL_LRQ: do debug for xge core LRQ module 89 * @XGE_COMPONENT_HAL_LCQ: do debug for xge core LCQ module 90 * @XGE_COMPONENT_CORE: do debug for xge KMA core module 91 * @XGE_COMPONENT_OSDEP: do debug for xge KMA os dependent parts 92 * @XGE_COMPONENT_LL: do debug for xge link layer module 93 * @XGE_COMPONENT_ALL: activate debug for all modules with no exceptions 94 * 95 * This enumeration going to be used to distinguish modules 96 * or libraries during compilation and runtime. Makefile must declare 97 * XGE_DEBUG_MODULE_MASK macro and set it to proper value. 98 */ 99 #define XGE_COMPONENT_HAL_CONFIG 0x00000001 100 #define XGE_COMPONENT_HAL_FIFO 0x00000002 101 #define XGE_COMPONENT_HAL_RING 0x00000004 102 #define XGE_COMPONENT_HAL_CHANNEL 0x00000008 103 #define XGE_COMPONENT_HAL_DEVICE 0x00000010 104 #define XGE_COMPONENT_HAL_MM 0x00000020 105 #define XGE_COMPONENT_HAL_QUEUE 0x00000040 106 #define XGE_COMPONENT_HAL_STATS 0x00000100 107 #ifdef XGEHAL_RNIC 108 #define XGE_COMPONENT_HAL_DMQ 0x00000200 109 #define XGE_COMPONENT_HAL_UMQ 0x00000400 110 #define XGE_COMPONENT_HAL_SQ 0x00000800 111 #define XGE_COMPONENT_HAL_SRQ 0x00001000 112 #define XGE_COMPONENT_HAL_CQRQ 0x00002000 113 #define XGE_COMPONENT_HAL_LRQ 0x00004000 114 #define XGE_COMPONENT_HAL_LCQ 0x00008000 115 #define XGE_COMPONENT_HAL_POOL 0x00010000 116 #endif 117 118 /* space for CORE_XXX */ 119 #define XGE_COMPONENT_OSDEP 0x10000000 120 #define XGE_COMPONENT_LL 0x20000000 121 #define XGE_COMPONENT_ALL 0xffffffff 122 123 #ifndef XGE_DEBUG_MODULE_MASK 124 #error "XGE_DEBUG_MODULE_MASK macro must be defined for DEBUG mode..." 125 #endif 126 127 #ifndef __GNUC__ 128 #ifdef XGE_TRACE_INTO_CIRCULAR_ARR 129 #define xge_trace_aux(fmt) xge_os_vatrace(g_xge_os_tracebuf, fmt) 130 #else 131 #define xge_trace_aux(fmt) xge_os_vaprintf(fmt) 132 #endif 133 134 /** 135 * xge_debug 136 * @level: level of debug verbosity. 137 * @fmt: printf like format string 138 * 139 * Provides logging facilities. Can be customized on per-module 140 * basis or/and with debug levels. Input parameters, except 141 * module and level, are the same as posix printf. This function 142 * may be compiled out if DEBUG macro was never defined. 143 * See also: xge_debug_level_e{}. 144 */ 145 #define xge_debug(module, level, fmt) { \ 146 if (((level >= XGE_TRACE && ((module & XGE_DEBUG_TRACE_MASK) == module)) || \ 147 (level >= XGE_ERR && ((module & XGE_DEBUG_ERR_MASK) == module))) && \ 148 level >= *g_level && module & *g_module_mask) { \ 149 xge_trace_aux(fmt); \ 150 } \ 151 } 152 #else /* __GNUC__ */ 153 154 #ifdef XGE_TRACE_INTO_CIRCULAR_ARR 155 #define xge_trace_aux(fmt...) xge_os_trace(g_xge_os_tracebuf, fmt) 156 #else 157 #define xge_trace_aux(fmt...) xge_os_printf(fmt) 158 #endif 159 160 #define xge_debug(module, level, fmt...) { \ 161 if (((level >= XGE_TRACE && ((module & XGE_DEBUG_TRACE_MASK) == module)) || \ 162 (level >= XGE_ERR && ((module & XGE_DEBUG_ERR_MASK) == module))) && \ 163 level >= *g_level && module & *g_module_mask) { \ 164 xge_trace_aux(fmt); \ 165 } \ 166 } 167 #endif /* __GNUC__ */ 168 169 #if (XGE_COMPONENT_HAL_STATS & XGE_DEBUG_MODULE_MASK) 170 #ifndef __GNUC__ 171 static inline void xge_debug_stats(xge_debug_level_e level, char *fmt, ...) { 172 u32 module = XGE_COMPONENT_HAL_STATS; 173 xge_debug(module, level, fmt); 174 } 175 #else /* __GNUC__ */ 176 #define xge_debug_stats(level, fmt...) \ 177 xge_debug(XGE_COMPONENT_HAL_STATS, level, fmt) 178 #endif /* __GNUC__ */ 179 #else 180 #ifndef __GNUC__ 181 static inline void xge_debug_stats(xge_debug_level_e level, char *fmt, ...) {} 182 #else /* __GNUC__ */ 183 #define xge_debug_stats(level, fmt...) 184 #endif /* __GNUC__ */ 185 #endif 186 187 #if (XGE_COMPONENT_HAL_QUEUE & XGE_DEBUG_MODULE_MASK) 188 #ifndef __GNUC__ 189 static inline void xge_debug_queue(xge_debug_level_e level, char *fmt, ...) { 190 u32 module = XGE_COMPONENT_HAL_QUEUE; 191 xge_debug(module, level, fmt); 192 } 193 #else /* __GNUC__ */ 194 #define xge_debug_queue(level, fmt...) \ 195 xge_debug(XGE_COMPONENT_HAL_QUEUE, level, fmt) 196 #endif /* __GNUC__ */ 197 #else 198 #ifndef __GNUC__ 199 static inline void xge_debug_queue(xge_debug_level_e level, char *fmt, 200 ...) {} 201 #else /* __GNUC__ */ 202 #define xge_debug_queue(level, fmt...) 203 #endif /* __GNUC__ */ 204 #endif 205 206 #if (XGE_COMPONENT_HAL_MM & XGE_DEBUG_MODULE_MASK) 207 #ifndef __GNUC__ 208 static inline void xge_debug_mm(xge_debug_level_e level, char *fmt, ...) 209 { 210 u32 module = XGE_COMPONENT_HAL_MM; 211 xge_debug(module, level, fmt); 212 } 213 #else /* __GNUC__ */ 214 #define xge_debug_mm(level, fmt...) \ 215 xge_debug(XGE_COMPONENT_HAL_MM, level, fmt) 216 #endif /* __GNUC__ */ 217 #else 218 #ifndef __GNUC__ 219 static inline void xge_debug_mm(xge_debug_level_e level, char *fmt, ...) 220 {} 221 #else /* __GNUC__ */ 222 #define xge_debug_mm(level, fmt...) 223 #endif /* __GNUC__ */ 224 #endif 225 226 #if (XGE_COMPONENT_HAL_CONFIG & XGE_DEBUG_MODULE_MASK) 227 #ifndef __GNUC__ 228 static inline void xge_debug_config(xge_debug_level_e level, char *fmt, ...) { 229 u32 module = XGE_COMPONENT_HAL_CONFIG; 230 xge_debug(module, level, fmt); 231 } 232 #else /* __GNUC__ */ 233 #define xge_debug_config(level, fmt...) \ 234 xge_debug(XGE_COMPONENT_HAL_CONFIG, level, fmt) 235 #endif /* __GNUC__ */ 236 #else 237 #ifndef __GNUC__ 238 static inline void xge_debug_config(xge_debug_level_e level, char *fmt, 239 ...) {} 240 #else /* __GNUC__ */ 241 #define xge_debug_config(level, fmt...) 242 #endif /* __GNUC__ */ 243 #endif 244 245 #if (XGE_COMPONENT_HAL_FIFO & XGE_DEBUG_MODULE_MASK) 246 #ifndef __GNUC__ 247 static inline void xge_debug_fifo(xge_debug_level_e level, char *fmt, ...) { 248 u32 module = XGE_COMPONENT_HAL_FIFO; 249 xge_debug(module, level, fmt); 250 } 251 #else /* __GNUC__ */ 252 #define xge_debug_fifo(level, fmt...) \ 253 xge_debug(XGE_COMPONENT_HAL_FIFO, level, fmt) 254 #endif /* __GNUC__ */ 255 #else 256 #ifndef __GNUC__ 257 static inline void xge_debug_fifo(xge_debug_level_e level, char *fmt, ...) {} 258 #else /* __GNUC__ */ 259 #define xge_debug_fifo(level, fmt...) 260 #endif /* __GNUC__ */ 261 #endif 262 263 #if (XGE_COMPONENT_HAL_RING & XGE_DEBUG_MODULE_MASK) 264 #ifndef __GNUC__ 265 static inline void xge_debug_ring(xge_debug_level_e level, char *fmt, ...) { 266 u32 module = XGE_COMPONENT_HAL_RING; 267 xge_debug(module, level, fmt); 268 } 269 #else /* __GNUC__ */ 270 #define xge_debug_ring(level, fmt...) \ 271 xge_debug(XGE_COMPONENT_HAL_RING, level, fmt) 272 #endif /* __GNUC__ */ 273 #else 274 #ifndef __GNUC__ 275 static inline void xge_debug_ring(xge_debug_level_e level, char *fmt, ...) {} 276 #else /* __GNUC__ */ 277 #define xge_debug_ring(level, fmt...) 278 #endif /* __GNUC__ */ 279 #endif 280 281 #if (XGE_COMPONENT_HAL_CHANNEL & XGE_DEBUG_MODULE_MASK) 282 #ifndef __GNUC__ 283 static inline void xge_debug_channel(xge_debug_level_e level, char *fmt, ...) { 284 u32 module = XGE_COMPONENT_HAL_CHANNEL; 285 xge_debug(module, level, fmt); 286 } 287 #else /* __GNUC__ */ 288 #define xge_debug_channel(level, fmt...) \ 289 xge_debug(XGE_COMPONENT_HAL_CHANNEL, level, fmt) 290 #endif /* __GNUC__ */ 291 #else 292 #ifndef __GNUC__ 293 static inline void xge_debug_channel(xge_debug_level_e level, char *fmt, ...) {} 294 #else /* __GNUC__ */ 295 #define xge_debug_channel(level, fmt...) 296 #endif /* __GNUC__ */ 297 #endif 298 299 #if (XGE_COMPONENT_HAL_DEVICE & XGE_DEBUG_MODULE_MASK) 300 #ifndef __GNUC__ 301 static inline void xge_debug_device(xge_debug_level_e level, char *fmt, ...) { 302 u32 module = XGE_COMPONENT_HAL_DEVICE; 303 xge_debug(module, level, fmt); 304 } 305 #else /* __GNUC__ */ 306 #define xge_debug_device(level, fmt...) \ 307 xge_debug(XGE_COMPONENT_HAL_DEVICE, level, fmt) 308 #endif /* __GNUC__ */ 309 #else 310 #ifndef __GNUC__ 311 static inline void xge_debug_device(xge_debug_level_e level, char *fmt, ...) {} 312 #else /* __GNUC__ */ 313 #define xge_debug_device(level, fmt...) 314 #endif /* __GNUC__ */ 315 #endif 316 317 #ifdef XGEHAL_RNIC 318 319 #if (XGE_COMPONENT_HAL_DMQ & XGE_DEBUG_MODULE_MASK) 320 #ifndef __GNUC__ 321 static inline void xge_debug_dmq(xge_debug_level_e level, char *fmt, ...) { 322 u32 module = XGE_COMPONENT_HAL_DMQ; 323 xge_debug(module, level, fmt); 324 } 325 #else /* __GNUC__ */ 326 #define xge_debug_dmq(level, fmt...) \ 327 xge_debug(XGE_COMPONENT_HAL_DMQ, level, fmt) 328 #endif /* __GNUC__ */ 329 #else 330 #ifndef __GNUC__ 331 static inline void xge_debug_dmq(xge_debug_level_e level, char *fmt, ...) {} 332 #else /* __GNUC__ */ 333 #define xge_debug_dmq(level, fmt...) 334 #endif /* __GNUC__ */ 335 #endif 336 337 #if (XGE_COMPONENT_HAL_UMQ & XGE_DEBUG_MODULE_MASK) 338 #ifndef __GNUC__ 339 static inline void xge_debug_umq(xge_debug_level_e level, char *fmt, ...) { 340 u32 module = XGE_COMPONENT_HAL_UMQ; 341 xge_debug(module, level, fmt); 342 } 343 #else /* __GNUC__ */ 344 #define xge_debug_umq(level, fmt...) \ 345 xge_debug(XGE_COMPONENT_HAL_UMQ, level, fmt) 346 #endif /* __GNUC__ */ 347 #else 348 #ifndef __GNUC__ 349 static inline void xge_debug_umq(xge_debug_level_e level, char *fmt, ...) {} 350 #else /* __GNUC__ */ 351 #define xge_debug_umq(level, fmt...) 352 #endif /* __GNUC__ */ 353 #endif 354 355 #if (XGE_COMPONENT_HAL_SQ & XGE_DEBUG_MODULE_MASK) 356 #ifndef __GNUC__ 357 static inline void xge_debug_sq(xge_debug_level_e level, char *fmt, ...) { 358 u32 module = XGE_COMPONENT_HAL_SQ; 359 xge_debug(module, level, fmt); 360 } 361 #else /* __GNUC__ */ 362 #define xge_debug_sq(level, fmt...) \ 363 xge_debug(XGE_COMPONENT_HAL_SQ, level, fmt) 364 #endif /* __GNUC__ */ 365 #else 366 #ifndef __GNUC__ 367 static inline void xge_debug_sq(xge_debug_level_e level, char *fmt, ...) {} 368 #else /* __GNUC__ */ 369 #define xge_debug_sq(level, fmt...) 370 #endif /* __GNUC__ */ 371 #endif 372 373 #if (XGE_COMPONENT_HAL_SRQ & XGE_DEBUG_MODULE_MASK) 374 #ifndef __GNUC__ 375 static inline void xge_debug_srq(xge_debug_level_e level, char *fmt, ...) { 376 u32 module = XGE_COMPONENT_HAL_SRQ; 377 xge_debug(module, level, fmt); 378 } 379 #else /* __GNUC__ */ 380 #define xge_debug_srq(level, fmt...) \ 381 xge_debug(XGE_COMPONENT_HAL_SRQ, level, fmt) 382 #endif /* __GNUC__ */ 383 #else 384 #ifndef __GNUC__ 385 static inline void xge_debug_srq(xge_debug_level_e level, char *fmt, ...) {} 386 #else /* __GNUC__ */ 387 #define xge_debug_srq(level, fmt...) 388 #endif /* __GNUC__ */ 389 #endif 390 391 #if (XGE_COMPONENT_HAL_CQRQ & XGE_DEBUG_MODULE_MASK) 392 #ifndef __GNUC__ 393 static inline void xge_debug_cqrq(xge_debug_level_e level, char *fmt, ...) { 394 u32 module = XGE_COMPONENT_HAL_CQRQ; 395 xge_debug(module, level, fmt); 396 } 397 #else /* __GNUC__ */ 398 #define xge_debug_cqrq(level, fmt...) \ 399 xge_debug(XGE_COMPONENT_HAL_CQRQ, level, fmt) 400 #endif /* __GNUC__ */ 401 #else 402 #ifndef __GNUC__ 403 static inline void xge_debug_cqrq(xge_debug_level_e level, char *fmt, ...) {} 404 #else /* __GNUC__ */ 405 #define xge_debug_cqrq(level, fmt...) 406 #endif /* __GNUC__ */ 407 #endif 408 409 #if (XGE_COMPONENT_HAL_LRQ & XGE_DEBUG_MODULE_MASK) 410 #ifndef __GNUC__ 411 static inline void xge_debug_lrq(xge_debug_level_e level, char *fmt, ...) { 412 u32 module = XGE_COMPONENT_HAL_LRQ; 413 xge_debug(module, level, fmt); 414 } 415 #else /* __GNUC__ */ 416 #define xge_debug_lrq(level, fmt...) \ 417 xge_debug(XGE_COMPONENT_HAL_LRQ, level, fmt) 418 #endif /* __GNUC__ */ 419 #else 420 #ifndef __GNUC__ 421 static inline void xge_debug_lrq(xge_debug_level_e level, char *fmt, ...) {} 422 #else /* __GNUC__ */ 423 #define xge_debug_lrq(level, fmt...) 424 #endif /* __GNUC__ */ 425 #endif 426 427 #if (XGE_COMPONENT_HAL_LCQ & XGE_DEBUG_MODULE_MASK) 428 #ifndef __GNUC__ 429 static inline void xge_debug_lcq(xge_debug_level_e level, char *fmt, ...) { 430 u32 module = XGE_COMPONENT_HAL_LCQ; 431 xge_debug(module, level, fmt); 432 } 433 #else /* __GNUC__ */ 434 #define xge_debug_lcq(level, fmt...) \ 435 xge_debug(XGE_COMPONENT_HAL_LCQ, level, fmt) 436 #endif /* __GNUC__ */ 437 #else 438 #ifndef __GNUC__ 439 static inline void xge_debug_lcq(xge_debug_level_e level, char *fmt, ...) {} 440 #else /* __GNUC__ */ 441 #define xge_debug_lcq(level, fmt...) 442 #endif /* __GNUC__ */ 443 #endif 444 445 #if (XGE_COMPONENT_HAL_POOL & XGE_DEBUG_MODULE_MASK) 446 #ifndef __GNUC__ 447 static inline void xge_debug_pool(xge_debug_level_e level, char *fmt, ...) { 448 u32 module = XGE_COMPONENT_HAL_POOL; 449 xge_debug(module, level, fmt); 450 } 451 #else /* __GNUC__ */ 452 #define xge_debug_pool(level, fmt...) \ 453 xge_debug(XGE_COMPONENT_HAL_POOL, level, fmt) 454 #endif /* __GNUC__ */ 455 #else 456 #ifndef __GNUC__ 457 static inline void xge_debug_pool(xge_debug_level_e level, char *fmt, ...) {} 458 #else /* __GNUC__ */ 459 #define xge_debug_pool(level, fmt...) 460 #endif /* __GNUC__ */ 461 #endif 462 463 #endif 464 465 #if (XGE_COMPONENT_OSDEP & XGE_DEBUG_MODULE_MASK) 466 #ifndef __GNUC__ 467 static inline void xge_debug_osdep(xge_debug_level_e level, char *fmt, ...) { 468 u32 module = XGE_COMPONENT_OSDEP; 469 xge_debug(module, level, fmt); 470 } 471 #else /* __GNUC__ */ 472 #define xge_debug_osdep(level, fmt...) \ 473 xge_debug(XGE_COMPONENT_OSDEP, level, fmt) 474 #endif /* __GNUC__ */ 475 #else 476 #ifndef __GNUC__ 477 static inline void xge_debug_osdep(xge_debug_level_e level, char *fmt, ...) {} 478 #else /* __GNUC__ */ 479 #define xge_debug_osdep(level, fmt...) 480 #endif /* __GNUC__ */ 481 #endif 482 483 #if (XGE_COMPONENT_LL & XGE_DEBUG_MODULE_MASK) 484 #ifndef __GNUC__ 485 static inline void xge_debug_ll(xge_debug_level_e level, char *fmt, ...) 486 { 487 u32 module = XGE_COMPONENT_LL; 488 xge_debug(module, level, fmt); 489 } 490 #else /* __GNUC__ */ 491 #define xge_debug_ll(level, fmt...) \ 492 xge_debug(XGE_COMPONENT_LL, level, fmt) 493 #endif /* __GNUC__ */ 494 #else 495 #ifndef __GNUC__ 496 static inline void xge_debug_ll(xge_debug_level_e level, char *fmt, ...) {} 497 #else /* __GNUC__ */ 498 #define xge_debug_ll(level, fmt...) 499 #endif /* __GNUC__ */ 500 #endif 501 502 #else 503 504 static inline void xge_debug_stats(xge_debug_level_e level, char *fmt, ...) {} 505 static inline void xge_debug_queue(xge_debug_level_e level, char *fmt, ...) {} 506 static inline void xge_debug_mm(xge_debug_level_e level, char *fmt, ...) {} 507 static inline void xge_debug_config(xge_debug_level_e level, char *fmt, ...) {} 508 static inline void xge_debug_fifo(xge_debug_level_e level, char *fmt, ...) {} 509 static inline void xge_debug_ring(xge_debug_level_e level, char *fmt, ...) {} 510 static inline void xge_debug_channel(xge_debug_level_e level, char *fmt, ...) {} 511 static inline void xge_debug_device(xge_debug_level_e level, char *fmt, ...) {} 512 static inline void xge_debug_dmq(xge_debug_level_e level, char *fmt, ...) {} 513 static inline void xge_debug_umq(xge_debug_level_e level, char *fmt, ...) {} 514 static inline void xge_debug_sq(xge_debug_level_e level, char *fmt, ...) {} 515 static inline void xge_debug_srq(xge_debug_level_e level, char *fmt, ...) {} 516 static inline void xge_debug_cqrq(xge_debug_level_e level, char *fmt, ...) {} 517 static inline void xge_debug_lrq(xge_debug_level_e level, char *fmt, ...) {} 518 static inline void xge_debug_lcq(xge_debug_level_e level, char *fmt, ...) {} 519 static inline void xge_debug_pool(xge_debug_level_e level, char *fmt, ...) {} 520 static inline void xge_debug_hal(xge_debug_level_e level, char *fmt, ...) {} 521 static inline void xge_debug_osdep(xge_debug_level_e level, char *fmt, ...) {} 522 static inline void xge_debug_ll(xge_debug_level_e level, char *fmt, ...) {} 523 524 #endif /* end of XGE_DEBUG_*_MASK */ 525 526 #ifdef XGE_DEBUG_ASSERT 527 528 /** 529 * xge_assert 530 * @test: C-condition to check 531 * @fmt: printf like format string 532 * 533 * This function implements traditional assert. By default assertions 534 * are enabled. It can be disabled by defining XGE_DEBUG_ASSERT macro in 535 * compilation 536 * time. 537 */ 538 #define xge_assert(test) { \ 539 if (!(test)) xge_os_bug("bad cond: "#test" at %s:%d\n", \ 540 __FILE__, __LINE__); } 541 #else 542 #define xge_assert(test) 543 #endif /* end of XGE_DEBUG_ASSERT */ 544 545 __EXTERN_END_DECLS 546 547 #endif /* XGE_DEBUG_H */ 548