Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6.git] / drivers / net / wireless / iwlwifi / iwl-devtrace.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2009 - 2010 Intel Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  * The full GNU General Public License is included in this distribution in the
19  * file called LICENSE.
20  *
21  * Contact Information:
22  *  Intel Linux Wireless <ilw@linux.intel.com>
23  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24  *
25  *****************************************************************************/
26
27 #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
28 #define __IWLWIFI_DEVICE_TRACE
29
30 #include <linux/tracepoint.h>
31 #include "iwl-dev.h"
32
33 #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
34 #undef TRACE_EVENT
35 #define TRACE_EVENT(name, proto, ...) \
36 static inline void trace_ ## name(proto) {}
37 #endif
38
39 #define PRIV_ENTRY      __field(struct iwl_priv *, priv)
40 #define PRIV_ASSIGN     __entry->priv = priv
41
42 #undef TRACE_SYSTEM
43 #define TRACE_SYSTEM iwlwifi_io
44
45 TRACE_EVENT(iwlwifi_dev_ioread32,
46         TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
47         TP_ARGS(priv, offs, val),
48         TP_STRUCT__entry(
49                 PRIV_ENTRY
50                 __field(u32, offs)
51                 __field(u32, val)
52         ),
53         TP_fast_assign(
54                 PRIV_ASSIGN;
55                 __entry->offs = offs;
56                 __entry->val = val;
57         ),
58         TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val)
59 );
60
61 TRACE_EVENT(iwlwifi_dev_iowrite8,
62         TP_PROTO(struct iwl_priv *priv, u32 offs, u8 val),
63         TP_ARGS(priv, offs, val),
64         TP_STRUCT__entry(
65                 PRIV_ENTRY
66                 __field(u32, offs)
67                 __field(u8, val)
68         ),
69         TP_fast_assign(
70                 PRIV_ASSIGN;
71                 __entry->offs = offs;
72                 __entry->val = val;
73         ),
74         TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
75 );
76
77 TRACE_EVENT(iwlwifi_dev_iowrite32,
78         TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
79         TP_ARGS(priv, offs, val),
80         TP_STRUCT__entry(
81                 PRIV_ENTRY
82                 __field(u32, offs)
83                 __field(u32, val)
84         ),
85         TP_fast_assign(
86                 PRIV_ASSIGN;
87                 __entry->offs = offs;
88                 __entry->val = val;
89         ),
90         TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
91 );
92
93 #undef TRACE_SYSTEM
94 #define TRACE_SYSTEM iwlwifi_ucode
95
96 TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
97         TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
98         TP_ARGS(priv, time, data, ev),
99         TP_STRUCT__entry(
100                 PRIV_ENTRY
101
102                 __field(u32, time)
103                 __field(u32, data)
104                 __field(u32, ev)
105         ),
106         TP_fast_assign(
107                 PRIV_ASSIGN;
108                 __entry->time = time;
109                 __entry->data = data;
110                 __entry->ev = ev;
111         ),
112         TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
113                   __entry->priv, __entry->time, __entry->data, __entry->ev)
114 );
115
116 TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
117         TP_PROTO(struct iwl_priv *priv, u32 wraps, u32 n_entry, u32 p_entry),
118         TP_ARGS(priv, wraps, n_entry, p_entry),
119         TP_STRUCT__entry(
120                 PRIV_ENTRY
121
122                 __field(u32, wraps)
123                 __field(u32, n_entry)
124                 __field(u32, p_entry)
125         ),
126         TP_fast_assign(
127                 PRIV_ASSIGN;
128                 __entry->wraps = wraps;
129                 __entry->n_entry = n_entry;
130                 __entry->p_entry = p_entry;
131         ),
132         TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X",
133                   __entry->priv, __entry->wraps, __entry->n_entry,
134                   __entry->p_entry)
135 );
136
137 #undef TRACE_SYSTEM
138 #define TRACE_SYSTEM iwlwifi
139
140 TRACE_EVENT(iwlwifi_dev_hcmd,
141         TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags),
142         TP_ARGS(priv, hcmd, len, flags),
143         TP_STRUCT__entry(
144                 PRIV_ENTRY
145                 __dynamic_array(u8, hcmd, len)
146                 __field(u32, flags)
147         ),
148         TP_fast_assign(
149                 PRIV_ASSIGN;
150                 memcpy(__get_dynamic_array(hcmd), hcmd, len);
151                 __entry->flags = flags;
152         ),
153         TP_printk("[%p] hcmd %#.2x (%ssync)",
154                   __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0],
155                   __entry->flags & CMD_ASYNC ? "a" : "")
156 );
157
158 TRACE_EVENT(iwlwifi_dev_rx,
159         TP_PROTO(struct iwl_priv *priv, void *rxbuf, size_t len),
160         TP_ARGS(priv, rxbuf, len),
161         TP_STRUCT__entry(
162                 PRIV_ENTRY
163                 __dynamic_array(u8, rxbuf, len)
164         ),
165         TP_fast_assign(
166                 PRIV_ASSIGN;
167                 memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
168         ),
169         TP_printk("[%p] RX cmd %#.2x",
170                   __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
171 );
172
173 TRACE_EVENT(iwlwifi_dev_tx,
174         TP_PROTO(struct iwl_priv *priv, void *tfd, size_t tfdlen,
175                  void *buf0, size_t buf0_len,
176                  void *buf1, size_t buf1_len),
177         TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
178         TP_STRUCT__entry(
179                 PRIV_ENTRY
180
181                 __field(size_t, framelen)
182                 __dynamic_array(u8, tfd, tfdlen)
183
184                 /*
185                  * Do not insert between or below these items,
186                  * we want to keep the frame together (except
187                  * for the possible padding).
188                  */
189                 __dynamic_array(u8, buf0, buf0_len)
190                 __dynamic_array(u8, buf1, buf1_len)
191         ),
192         TP_fast_assign(
193                 PRIV_ASSIGN;
194                 __entry->framelen = buf0_len + buf1_len;
195                 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
196                 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
197                 memcpy(__get_dynamic_array(buf1), buf1, buf0_len);
198         ),
199         TP_printk("[%p] TX %.2x (%zu bytes)",
200                   __entry->priv,
201                   ((u8 *)__get_dynamic_array(buf0))[0],
202                   __entry->framelen)
203 );
204
205 TRACE_EVENT(iwlwifi_dev_ucode_error,
206         TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time,
207                  u32 data1, u32 data2, u32 line, u32 blink1,
208                  u32 blink2, u32 ilink1, u32 ilink2),
209         TP_ARGS(priv, desc, time, data1, data2, line,
210                 blink1, blink2, ilink1, ilink2),
211         TP_STRUCT__entry(
212                 PRIV_ENTRY
213                 __field(u32, desc)
214                 __field(u32, time)
215                 __field(u32, data1)
216                 __field(u32, data2)
217                 __field(u32, line)
218                 __field(u32, blink1)
219                 __field(u32, blink2)
220                 __field(u32, ilink1)
221                 __field(u32, ilink2)
222         ),
223         TP_fast_assign(
224                 PRIV_ASSIGN;
225                 __entry->desc = desc;
226                 __entry->time = time;
227                 __entry->data1 = data1;
228                 __entry->data2 = data2;
229                 __entry->line = line;
230                 __entry->blink1 = blink1;
231                 __entry->blink2 = blink2;
232                 __entry->ilink1 = ilink1;
233                 __entry->ilink2 = ilink2;
234         ),
235         TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
236                   "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X",
237                   __entry->priv, __entry->desc, __entry->time, __entry->data1,
238                   __entry->data2, __entry->line, __entry->blink1,
239                   __entry->blink2, __entry->ilink1, __entry->ilink2)
240 );
241
242 TRACE_EVENT(iwlwifi_dev_ucode_event,
243         TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
244         TP_ARGS(priv, time, data, ev),
245         TP_STRUCT__entry(
246                 PRIV_ENTRY
247
248                 __field(u32, time)
249                 __field(u32, data)
250                 __field(u32, ev)
251         ),
252         TP_fast_assign(
253                 PRIV_ASSIGN;
254                 __entry->time = time;
255                 __entry->data = data;
256                 __entry->ev = ev;
257         ),
258         TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
259                   __entry->priv, __entry->time, __entry->data, __entry->ev)
260 );
261 #endif /* __IWLWIFI_DEVICE_TRACE */
262
263 #undef TRACE_INCLUDE_PATH
264 #define TRACE_INCLUDE_PATH .
265 #undef TRACE_INCLUDE_FILE
266 #define TRACE_INCLUDE_FILE iwl-devtrace
267 #include <trace/define_trace.h>