diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-10-02 16:44:02 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:44 -0400 |
commit | be1a71a128ed91372d4ad8d54d8fd972a1a356eb (patch) | |
tree | 9c8ac5551069c0d4352d6cc06e7194acce3aca9d /drivers/net/wireless/iwlwifi/iwl-devtrace.h | |
parent | 4d80d7210bb5a36a18978d1305b44375ecb857d9 (diff) |
iwlwifi: device tracing
In order to have an easier way to debug issues, create
trace events (using the ftrace framework) that will
allow us to follow exactly what the driver is doing
with the device.
The text format isn't all that useful, but the binary
format can also be obtained easily via debugfs and
then analysed on the fly or offline with debugging
tools.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-devtrace.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-devtrace.h | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h new file mode 100644 index 000000000000..8c7159208da1 --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h | |||
@@ -0,0 +1,178 @@ | |||
1 | #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) | ||
2 | #define __IWLWIFI_DEVICE_TRACE | ||
3 | |||
4 | #include <linux/tracepoint.h> | ||
5 | #include "iwl-dev.h" | ||
6 | |||
7 | #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) | ||
8 | #undef TRACE_EVENT | ||
9 | #define TRACE_EVENT(name, proto, ...) \ | ||
10 | static inline void trace_ ## name(proto) {} | ||
11 | #endif | ||
12 | |||
13 | #define PRIV_ENTRY __field(struct iwl_priv *, priv) | ||
14 | #define PRIV_ASSIGN __entry->priv = priv | ||
15 | |||
16 | #undef TRACE_SYSTEM | ||
17 | #define TRACE_SYSTEM iwlwifi | ||
18 | |||
19 | TRACE_EVENT(iwlwifi_dev_ioread32, | ||
20 | TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val), | ||
21 | TP_ARGS(priv, offs, val), | ||
22 | TP_STRUCT__entry( | ||
23 | PRIV_ENTRY | ||
24 | __field(u32, offs) | ||
25 | __field(u32, val) | ||
26 | ), | ||
27 | TP_fast_assign( | ||
28 | PRIV_ASSIGN; | ||
29 | __entry->offs = offs; | ||
30 | __entry->val = val; | ||
31 | ), | ||
32 | TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val) | ||
33 | ); | ||
34 | |||
35 | TRACE_EVENT(iwlwifi_dev_iowrite32, | ||
36 | TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val), | ||
37 | TP_ARGS(priv, offs, val), | ||
38 | TP_STRUCT__entry( | ||
39 | PRIV_ENTRY | ||
40 | __field(u32, offs) | ||
41 | __field(u32, val) | ||
42 | ), | ||
43 | TP_fast_assign( | ||
44 | PRIV_ASSIGN; | ||
45 | __entry->offs = offs; | ||
46 | __entry->val = val; | ||
47 | ), | ||
48 | TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val) | ||
49 | ); | ||
50 | |||
51 | TRACE_EVENT(iwlwifi_dev_hcmd, | ||
52 | TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags), | ||
53 | TP_ARGS(priv, hcmd, len, flags), | ||
54 | TP_STRUCT__entry( | ||
55 | PRIV_ENTRY | ||
56 | __dynamic_array(u8, hcmd, len) | ||
57 | __field(u32, flags) | ||
58 | ), | ||
59 | TP_fast_assign( | ||
60 | PRIV_ASSIGN; | ||
61 | memcpy(__get_dynamic_array(hcmd), hcmd, len); | ||
62 | __entry->flags = flags; | ||
63 | ), | ||
64 | TP_printk("[%p] hcmd %#.2x (%ssync)", | ||
65 | __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0], | ||
66 | __entry->flags & CMD_ASYNC ? "a" : "") | ||
67 | ); | ||
68 | |||
69 | TRACE_EVENT(iwlwifi_dev_rx, | ||
70 | TP_PROTO(struct iwl_priv *priv, void *rxbuf, size_t len), | ||
71 | TP_ARGS(priv, rxbuf, len), | ||
72 | TP_STRUCT__entry( | ||
73 | PRIV_ENTRY | ||
74 | __dynamic_array(u8, rxbuf, len) | ||
75 | ), | ||
76 | TP_fast_assign( | ||
77 | PRIV_ASSIGN; | ||
78 | memcpy(__get_dynamic_array(rxbuf), rxbuf, len); | ||
79 | ), | ||
80 | TP_printk("[%p] RX cmd %#.2x", | ||
81 | __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4]) | ||
82 | ); | ||
83 | |||
84 | TRACE_EVENT(iwlwifi_dev_tx, | ||
85 | TP_PROTO(struct iwl_priv *priv, void *tfd, size_t tfdlen, | ||
86 | void *buf0, size_t buf0_len, | ||
87 | void *buf1, size_t buf1_len), | ||
88 | TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len), | ||
89 | TP_STRUCT__entry( | ||
90 | PRIV_ENTRY | ||
91 | |||
92 | __field(size_t, framelen) | ||
93 | __dynamic_array(u8, tfd, tfdlen) | ||
94 | |||
95 | /* | ||
96 | * Do not insert between or below these items, | ||
97 | * we want to keep the frame together (except | ||
98 | * for the possible padding). | ||
99 | */ | ||
100 | __dynamic_array(u8, buf0, buf0_len) | ||
101 | __dynamic_array(u8, buf1, buf1_len) | ||
102 | ), | ||
103 | TP_fast_assign( | ||
104 | PRIV_ASSIGN; | ||
105 | __entry->framelen = buf0_len + buf1_len; | ||
106 | memcpy(__get_dynamic_array(tfd), tfd, tfdlen); | ||
107 | memcpy(__get_dynamic_array(buf0), buf0, buf0_len); | ||
108 | memcpy(__get_dynamic_array(buf1), buf1, buf0_len); | ||
109 | ), | ||
110 | TP_printk("[%p] TX %.2x (%zu bytes)", | ||
111 | __entry->priv, | ||
112 | ((u8 *)__get_dynamic_array(buf0))[0], | ||
113 | __entry->framelen) | ||
114 | ); | ||
115 | |||
116 | TRACE_EVENT(iwlwifi_dev_ucode_error, | ||
117 | TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time, | ||
118 | u32 data1, u32 data2, u32 line, u32 blink1, | ||
119 | u32 blink2, u32 ilink1, u32 ilink2), | ||
120 | TP_ARGS(priv, desc, time, data1, data2, line, | ||
121 | blink1, blink2, ilink1, ilink2), | ||
122 | TP_STRUCT__entry( | ||
123 | PRIV_ENTRY | ||
124 | __field(u32, desc) | ||
125 | __field(u32, time) | ||
126 | __field(u32, data1) | ||
127 | __field(u32, data2) | ||
128 | __field(u32, line) | ||
129 | __field(u32, blink1) | ||
130 | __field(u32, blink2) | ||
131 | __field(u32, ilink1) | ||
132 | __field(u32, ilink2) | ||
133 | ), | ||
134 | TP_fast_assign( | ||
135 | PRIV_ASSIGN; | ||
136 | __entry->desc = desc; | ||
137 | __entry->time = time; | ||
138 | __entry->data1 = data1; | ||
139 | __entry->data2 = data2; | ||
140 | __entry->line = line; | ||
141 | __entry->blink1 = blink1; | ||
142 | __entry->blink2 = blink2; | ||
143 | __entry->ilink1 = ilink1; | ||
144 | __entry->ilink2 = ilink2; | ||
145 | ), | ||
146 | TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, " | ||
147 | "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X", | ||
148 | __entry->priv, __entry->desc, __entry->time, __entry->data1, | ||
149 | __entry->data2, __entry->line, __entry->blink1, | ||
150 | __entry->blink2, __entry->ilink1, __entry->ilink2) | ||
151 | ); | ||
152 | |||
153 | TRACE_EVENT(iwlwifi_dev_ucode_event, | ||
154 | TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev), | ||
155 | TP_ARGS(priv, time, data, ev), | ||
156 | TP_STRUCT__entry( | ||
157 | PRIV_ENTRY | ||
158 | |||
159 | __field(u32, time) | ||
160 | __field(u32, data) | ||
161 | __field(u32, ev) | ||
162 | ), | ||
163 | TP_fast_assign( | ||
164 | PRIV_ASSIGN; | ||
165 | __entry->time = time; | ||
166 | __entry->data = data; | ||
167 | __entry->ev = ev; | ||
168 | ), | ||
169 | TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u", | ||
170 | __entry->priv, __entry->time, __entry->data, __entry->ev) | ||
171 | ); | ||
172 | #endif /* __IWLWIFI_DEVICE_TRACE */ | ||
173 | |||
174 | #undef TRACE_INCLUDE_PATH | ||
175 | #define TRACE_INCLUDE_PATH . | ||
176 | #undef TRACE_INCLUDE_FILE | ||
177 | #define TRACE_INCLUDE_FILE iwl-devtrace | ||
178 | #include <trace/define_trace.h> | ||