aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debug.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-02-01 00:08:37 -0500
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-17 12:49:27 -0500
commit2655e314c4b204966008689eaf3e87ba1f38d55c (patch)
tree2d0dc33216e97e764133c7165b7ebcf4b5f16347 /drivers/net/wireless/iwlwifi/iwl-debug.h
parentcdfef6c224f9490215cadd91b34c579757a6e59d (diff)
iwlwifi: trace debug messages
Make iwlwifi record all debug messages into tracing, even if debug_level is not enabled. Due to the lack of APIs, the debug messages are now recorded up to a max length of 100, the only one above that is the RXON which is not needed if you trace the commands as well as it only dumps the command contents. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debug.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h83
1 files changed, 42 insertions, 41 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 351b41d7f4fd..bfc08494ed22 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -31,14 +31,33 @@
31 31
32#include "iwl-bus.h" 32#include "iwl-bus.h"
33#include "iwl-shared.h" 33#include "iwl-shared.h"
34#include "iwl-devtrace.h"
34 35
35struct iwl_priv; 36struct iwl_priv;
36 37
37/*No matter what is m (priv, bus, trans), this will work */ 38void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
38#define IWL_ERR(m, f, a...) dev_err(trans(m)->dev, f, ## a) 39 const char *fmt, ...);
39#define IWL_WARN(m, f, a...) dev_warn(trans(m)->dev, f, ## a) 40void __iwl_warn(struct device *dev, const char *fmt, ...);
40#define IWL_INFO(m, f, a...) dev_info(trans(m)->dev, f, ## a) 41void __iwl_info(struct device *dev, const char *fmt, ...);
41#define IWL_CRIT(m, f, a...) dev_crit(trans(m)->dev, f, ## a) 42void __iwl_crit(struct device *dev, const char *fmt, ...);
43
44/* No matter what is m (priv, bus, trans), this will work */
45#define IWL_ERR(m, f, a...) __iwl_err(trans(m)->dev, false, false, f, ## a)
46#define IWL_WARN(m, f, a...) __iwl_warn(trans(m)->dev, f, ## a)
47#define IWL_INFO(m, f, a...) __iwl_info(trans(m)->dev, f, ## a)
48#define IWL_CRIT(m, f, a...) __iwl_crit(trans(m)->dev, f, ## a)
49
50#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
51void __iwl_dbg(struct iwl_shared *shared, struct device *dev,
52 u32 level, bool limit, const char *function,
53 const char *fmt, ...);
54#else
55static inline void
56__iwl_dbg(struct iwl_shared *shared, struct device *dev,
57 u32 level, bool limit, const char *function,
58 const char *fmt, ...)
59{}
60#endif
42 61
43#define iwl_print_hex_error(m, p, len) \ 62#define iwl_print_hex_error(m, p, len) \
44do { \ 63do { \
@@ -46,53 +65,35 @@ do { \
46 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 65 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
47} while (0) 66} while (0)
48 67
49#ifdef CONFIG_IWLWIFI_DEBUG 68#define IWL_DEBUG(m, level, fmt, args...) \
50#define IWL_DEBUG(m, level, fmt, ...) \ 69 __iwl_dbg((m)->shrd, trans(m)->dev, level, false, __func__, fmt, ##args)
51do { \ 70#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
52 if (iwl_get_debug_level((m)->shrd) & (level)) \ 71 __iwl_dbg((m)->shrd, trans(m)->dev, level, true, __func__, fmt, ##args)
53 dev_err(trans(m)->dev, "%c %s " fmt, \
54 in_interrupt() ? 'I' : 'U', __func__, \
55 ##__VA_ARGS__); \
56} while (0)
57
58#define IWL_DEBUG_LIMIT(m, level, fmt, ...) \
59do { \
60 if (iwl_get_debug_level((m)->shrd) & (level) && \
61 net_ratelimit()) \
62 dev_err(trans(m)->dev, "%c %s " fmt, \
63 in_interrupt() ? 'I' : 'U', __func__, \
64 ##__VA_ARGS__); \
65} while (0)
66 72
73#ifdef CONFIG_IWLWIFI_DEBUG
67#define iwl_print_hex_dump(m, level, p, len) \ 74#define iwl_print_hex_dump(m, level, p, len) \
68do { \ 75do { \
69 if (iwl_get_debug_level((m)->shrd) & level) \ 76 if (iwl_get_debug_level((m)->shrd) & level) \
70 print_hex_dump(KERN_DEBUG, "iwl data: ", \ 77 print_hex_dump(KERN_DEBUG, "iwl data: ", \
71 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 78 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
72} while (0) 79} while (0)
73 80#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
74#define IWL_DEBUG_QUIET_RFKILL(p, fmt, ...) \
75do { \ 81do { \
76 if (!iwl_is_rfkill(p->shrd)) \ 82 if (!iwl_is_rfkill((m)->shrd)) \
77 dev_err(trans(p)->dev, "%s%c %s " fmt, \ 83 IWL_ERR(m, fmt, ##args); \
78 "", \ 84 else \
79 in_interrupt() ? 'I' : 'U', __func__, \ 85 __iwl_err(trans(m)->dev, true, \
80 ##__VA_ARGS__); \ 86 !(iwl_get_debug_level((m)->shrd) & IWL_DL_RADIO),\
81 else if (iwl_get_debug_level(p->shrd) & IWL_DL_RADIO) \ 87 fmt, ##args); \
82 dev_err(trans(p)->dev, "%s%c %s " fmt, \
83 "(RFKILL) ", \
84 in_interrupt() ? 'I' : 'U', __func__, \
85 ##__VA_ARGS__); \
86} while (0) 88} while (0)
87
88#else 89#else
89#define IWL_DEBUG(m, level, fmt, args...)
90#define IWL_DEBUG_LIMIT(m, level, fmt, args...)
91#define iwl_print_hex_dump(m, level, p, len) 90#define iwl_print_hex_dump(m, level, p, len)
92#define IWL_DEBUG_QUIET_RFKILL(p, fmt, args...) \ 91#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
93do { \ 92do { \
94 if (!iwl_is_rfkill(p->shrd)) \ 93 if (!iwl_is_rfkill((m)->shrd)) \
95 IWL_ERR(p, fmt, ##args); \ 94 IWL_ERR(m, fmt, ##args); \
95 else \
96 __iwl_err(trans(m)->dev, true, true, fmt, ##args); \
96} while (0) 97} while (0)
97#endif /* CONFIG_IWLWIFI_DEBUG */ 98#endif /* CONFIG_IWLWIFI_DEBUG */
98 99