Yi Zou | 21b7b2f | 2011-01-28 16:04:45 -0800 | [diff] [blame] | 1 | #ifndef _FCOE_LIBFCOE_H_ |
| 2 | #define _FCOE_LIBFCOE_H_ |
| 3 | |
| 4 | extern unsigned int libfcoe_debug_logging; |
Robert Love | 3993de6 | 2012-11-27 06:53:24 +0000 | [diff] [blame] | 5 | #define LIBFCOE_LOGGING 0x01 /* General logging, not categorized */ |
| 6 | #define LIBFCOE_FIP_LOGGING 0x02 /* FIP logging */ |
| 7 | #define LIBFCOE_TRANSPORT_LOGGING 0x04 /* FCoE transport logging */ |
| 8 | #define LIBFCOE_SYSFS_LOGGING 0x08 /* fcoe_sysfs logging */ |
Yi Zou | 21b7b2f | 2011-01-28 16:04:45 -0800 | [diff] [blame] | 9 | |
| 10 | #define LIBFCOE_CHECK_LOGGING(LEVEL, CMD) \ |
| 11 | do { \ |
| 12 | if (unlikely(libfcoe_debug_logging & LEVEL)) \ |
| 13 | do { \ |
| 14 | CMD; \ |
| 15 | } while (0); \ |
| 16 | } while (0) |
| 17 | |
| 18 | #define LIBFCOE_DBG(fmt, args...) \ |
| 19 | LIBFCOE_CHECK_LOGGING(LIBFCOE_LOGGING, \ |
Robert Love | 8e6c536 | 2012-12-04 02:14:53 +0000 | [diff] [blame] | 20 | pr_info("libfcoe: " fmt, ##args);) |
Yi Zou | 21b7b2f | 2011-01-28 16:04:45 -0800 | [diff] [blame] | 21 | |
| 22 | #define LIBFCOE_FIP_DBG(fip, fmt, args...) \ |
| 23 | LIBFCOE_CHECK_LOGGING(LIBFCOE_FIP_LOGGING, \ |
Robert Love | 8e6c536 | 2012-12-04 02:14:53 +0000 | [diff] [blame] | 24 | pr_info("host%d: fip: " fmt, \ |
| 25 | (fip)->lp->host->host_no, ##args);) |
Yi Zou | 21b7b2f | 2011-01-28 16:04:45 -0800 | [diff] [blame] | 26 | |
Yi Zou | fdecf31 | 2011-01-28 16:04:55 -0800 | [diff] [blame] | 27 | #define LIBFCOE_TRANSPORT_DBG(fmt, args...) \ |
| 28 | LIBFCOE_CHECK_LOGGING(LIBFCOE_TRANSPORT_LOGGING, \ |
Robert Love | 8e6c536 | 2012-12-04 02:14:53 +0000 | [diff] [blame] | 29 | pr_info("%s: " fmt, __func__, ##args);) |
Yi Zou | fdecf31 | 2011-01-28 16:04:55 -0800 | [diff] [blame] | 30 | |
Robert Love | 3993de6 | 2012-11-27 06:53:24 +0000 | [diff] [blame] | 31 | #define LIBFCOE_SYSFS_DBG(cdev, fmt, args...) \ |
| 32 | LIBFCOE_CHECK_LOGGING(LIBFCOE_SYSFS_LOGGING, \ |
| 33 | pr_info("ctlr_%d: " fmt, cdev->id, ##args);) |
| 34 | |
Yi Zou | 21b7b2f | 2011-01-28 16:04:45 -0800 | [diff] [blame] | 35 | #endif /* _FCOE_LIBFCOE_H_ */ |