blob: 4491c1c72cc7d6e00ade51930342b16233172690 [file] [log] [blame]
Reinette Chatrebb5d2db2010-01-15 13:42:59 -08001/******************************************************************************
2 *
Johannes Berg128e63e2013-01-21 21:39:26 +01003 * Copyright(c) 2009 - 2013 Intel Corporation. All rights reserved.
Reinette Chatrebb5d2db2010-01-15 13:42:59 -08004 *
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
Johannes Bergbe1a71a2009-10-02 13:44:02 -070027#if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
Johannes Bergf042c2e2012-09-05 22:34:44 +020028#include <linux/skbuff.h>
29#include <linux/ieee80211.h>
30#include <net/cfg80211.h>
31#include "iwl-trans.h"
32#if !defined(__IWLWIFI_DEVICE_TRACE)
33static inline bool iwl_trace_data(struct sk_buff *skb)
34{
35 struct ieee80211_hdr *hdr = (void *)skb->data;
36
37 if (ieee80211_is_data(hdr->frame_control))
38 return skb->protocol != cpu_to_be16(ETH_P_PAE);
39 return false;
40}
41
42static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans,
43 void *rxbuf, size_t len)
44{
45 struct iwl_cmd_header *cmd = (void *)((u8 *)rxbuf + sizeof(__le32));
46 struct ieee80211_hdr *hdr;
47
48 if (cmd->cmd != trans->rx_mpdu_cmd)
49 return len;
50
51 hdr = (void *)((u8 *)cmd + sizeof(struct iwl_cmd_header) +
52 trans->rx_mpdu_cmd_hdr_size);
53 if (!ieee80211_is_data(hdr->frame_control))
54 return len;
55 /* maybe try to identify EAPOL frames? */
56 return sizeof(__le32) + sizeof(*cmd) + trans->rx_mpdu_cmd_hdr_size +
57 ieee80211_hdrlen(hdr->frame_control);
58}
59#endif
60
Johannes Bergbe1a71a2009-10-02 13:44:02 -070061#define __IWLWIFI_DEVICE_TRACE
62
63#include <linux/tracepoint.h>
Johannes Berg1023fdc2012-05-15 12:16:34 +020064#include <linux/device.h>
Johannes Berg45eab7c2012-09-05 00:33:53 +020065#include "iwl-trans.h"
Johannes Bergbe1a71a2009-10-02 13:44:02 -070066
Emmanuel Grumbach83ed9012011-08-25 23:11:14 -070067
Johannes Bergbe1a71a2009-10-02 13:44:02 -070068#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
69#undef TRACE_EVENT
70#define TRACE_EVENT(name, proto, ...) \
71static inline void trace_ ## name(proto) {}
Johannes Berg2655e312012-01-31 21:08:37 -080072#undef DECLARE_EVENT_CLASS
73#define DECLARE_EVENT_CLASS(...)
74#undef DEFINE_EVENT
75#define DEFINE_EVENT(evt_class, name, proto, ...) \
76static inline void trace_ ## name(proto) {}
Johannes Bergbe1a71a2009-10-02 13:44:02 -070077#endif
78
Johannes Berg6c1011e2012-03-06 13:30:48 -080079#define DEV_ENTRY __string(dev, dev_name(dev))
80#define DEV_ASSIGN __assign_str(dev, dev_name(dev))
Johannes Bergbe1a71a2009-10-02 13:44:02 -070081
82#undef TRACE_SYSTEM
Johannes Berg0fd95af2009-11-20 12:05:02 -080083#define TRACE_SYSTEM iwlwifi_io
Johannes Bergbe1a71a2009-10-02 13:44:02 -070084
85TRACE_EVENT(iwlwifi_dev_ioread32,
Johannes Berg6c1011e2012-03-06 13:30:48 -080086 TP_PROTO(const struct device *dev, u32 offs, u32 val),
87 TP_ARGS(dev, offs, val),
Johannes Bergbe1a71a2009-10-02 13:44:02 -070088 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -080089 DEV_ENTRY
Johannes Bergbe1a71a2009-10-02 13:44:02 -070090 __field(u32, offs)
91 __field(u32, val)
92 ),
93 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -080094 DEV_ASSIGN;
Johannes Bergbe1a71a2009-10-02 13:44:02 -070095 __entry->offs = offs;
96 __entry->val = val;
97 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -080098 TP_printk("[%s] read io[%#x] = %#x",
99 __get_str(dev), __entry->offs, __entry->val)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700100);
101
Ben Cahill4e031852009-11-20 12:04:52 -0800102TRACE_EVENT(iwlwifi_dev_iowrite8,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800103 TP_PROTO(const struct device *dev, u32 offs, u8 val),
104 TP_ARGS(dev, offs, val),
Ben Cahill4e031852009-11-20 12:04:52 -0800105 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800106 DEV_ENTRY
Ben Cahill4e031852009-11-20 12:04:52 -0800107 __field(u32, offs)
108 __field(u8, val)
109 ),
110 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800111 DEV_ASSIGN;
Ben Cahill4e031852009-11-20 12:04:52 -0800112 __entry->offs = offs;
113 __entry->val = val;
114 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800115 TP_printk("[%s] write io[%#x] = %#x)",
116 __get_str(dev), __entry->offs, __entry->val)
Ben Cahill4e031852009-11-20 12:04:52 -0800117);
118
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700119TRACE_EVENT(iwlwifi_dev_iowrite32,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800120 TP_PROTO(const struct device *dev, u32 offs, u32 val),
121 TP_ARGS(dev, offs, val),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700122 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800123 DEV_ENTRY
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700124 __field(u32, offs)
125 __field(u32, val)
126 ),
127 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800128 DEV_ASSIGN;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700129 __entry->offs = offs;
130 __entry->val = val;
131 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800132 TP_printk("[%s] write io[%#x] = %#x)",
133 __get_str(dev), __entry->offs, __entry->val)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700134);
135
Emmanuel Grumbach6a06b6c2012-12-02 13:07:30 +0200136TRACE_EVENT(iwlwifi_dev_iowrite_prph32,
137 TP_PROTO(const struct device *dev, u32 offs, u32 val),
138 TP_ARGS(dev, offs, val),
139 TP_STRUCT__entry(
140 DEV_ENTRY
141 __field(u32, offs)
142 __field(u32, val)
143 ),
144 TP_fast_assign(
145 DEV_ASSIGN;
146 __entry->offs = offs;
147 __entry->val = val;
148 ),
149 TP_printk("[%s] write PRPH[%#x] = %#x)",
150 __get_str(dev), __entry->offs, __entry->val)
151);
152
153TRACE_EVENT(iwlwifi_dev_ioread_prph32,
154 TP_PROTO(const struct device *dev, u32 offs, u32 val),
155 TP_ARGS(dev, offs, val),
156 TP_STRUCT__entry(
157 DEV_ENTRY
158 __field(u32, offs)
159 __field(u32, val)
160 ),
161 TP_fast_assign(
162 DEV_ASSIGN;
163 __entry->offs = offs;
164 __entry->val = val;
165 ),
166 TP_printk("[%s] read PRPH[%#x] = %#x",
167 __get_str(dev), __entry->offs, __entry->val)
168);
169
Johannes Bergb80667e2011-12-09 07:26:13 -0800170TRACE_EVENT(iwlwifi_dev_irq,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800171 TP_PROTO(const struct device *dev),
172 TP_ARGS(dev),
Johannes Bergb80667e2011-12-09 07:26:13 -0800173 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800174 DEV_ENTRY
Johannes Bergb80667e2011-12-09 07:26:13 -0800175 ),
176 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800177 DEV_ASSIGN;
Johannes Bergb80667e2011-12-09 07:26:13 -0800178 ),
179 /* TP_printk("") doesn't compile */
180 TP_printk("%d", 0)
181);
182
183TRACE_EVENT(iwlwifi_dev_ict_read,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800184 TP_PROTO(const struct device *dev, u32 index, u32 value),
185 TP_ARGS(dev, index, value),
Johannes Bergb80667e2011-12-09 07:26:13 -0800186 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800187 DEV_ENTRY
Johannes Bergb80667e2011-12-09 07:26:13 -0800188 __field(u32, index)
189 __field(u32, value)
190 ),
191 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800192 DEV_ASSIGN;
Johannes Bergb80667e2011-12-09 07:26:13 -0800193 __entry->index = index;
194 __entry->value = value;
195 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800196 TP_printk("[%s] read ict[%d] = %#.8x",
197 __get_str(dev), __entry->index, __entry->value)
Johannes Bergb80667e2011-12-09 07:26:13 -0800198);
199
Johannes Berg0fd95af2009-11-20 12:05:02 -0800200#undef TRACE_SYSTEM
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800201#define TRACE_SYSTEM iwlwifi_ucode
202
203TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800204 TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
205 TP_ARGS(dev, time, data, ev),
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800206 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800207 DEV_ENTRY
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800208
209 __field(u32, time)
210 __field(u32, data)
211 __field(u32, ev)
212 ),
213 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800214 DEV_ASSIGN;
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800215 __entry->time = time;
216 __entry->data = data;
217 __entry->ev = ev;
218 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800219 TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
220 __get_str(dev), __entry->time, __entry->data, __entry->ev)
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800221);
222
223TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800224 TP_PROTO(const struct device *dev, u32 wraps, u32 n_entry, u32 p_entry),
225 TP_ARGS(dev, wraps, n_entry, p_entry),
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800226 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800227 DEV_ENTRY
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800228
229 __field(u32, wraps)
230 __field(u32, n_entry)
231 __field(u32, p_entry)
232 ),
233 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800234 DEV_ASSIGN;
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800235 __entry->wraps = wraps;
236 __entry->n_entry = n_entry;
237 __entry->p_entry = p_entry;
238 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800239 TP_printk("[%s] wraps=#%02d n=0x%X p=0x%X",
240 __get_str(dev), __entry->wraps, __entry->n_entry,
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800241 __entry->p_entry)
242);
243
244#undef TRACE_SYSTEM
Johannes Berg2655e312012-01-31 21:08:37 -0800245#define TRACE_SYSTEM iwlwifi_msg
246
Johannes Bergeecf21a2012-06-22 15:21:02 +0200247#define MAX_MSG_LEN 110
Johannes Berg2655e312012-01-31 21:08:37 -0800248
249DECLARE_EVENT_CLASS(iwlwifi_msg_event,
250 TP_PROTO(struct va_format *vaf),
251 TP_ARGS(vaf),
252 TP_STRUCT__entry(
253 __dynamic_array(char, msg, MAX_MSG_LEN)
254 ),
255 TP_fast_assign(
256 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
257 MAX_MSG_LEN, vaf->fmt,
258 *vaf->va) >= MAX_MSG_LEN);
259 ),
Johannes Berg94bfa4a2012-06-22 19:39:23 +0200260 TP_printk("%s", __get_str(msg))
Johannes Berg2655e312012-01-31 21:08:37 -0800261);
262
263DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err,
264 TP_PROTO(struct va_format *vaf),
265 TP_ARGS(vaf)
266);
267
268DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn,
269 TP_PROTO(struct va_format *vaf),
270 TP_ARGS(vaf)
271);
272
273DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info,
274 TP_PROTO(struct va_format *vaf),
275 TP_ARGS(vaf)
276);
277
278DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit,
279 TP_PROTO(struct va_format *vaf),
280 TP_ARGS(vaf)
281);
282
283TRACE_EVENT(iwlwifi_dbg,
284 TP_PROTO(u32 level, bool in_interrupt, const char *function,
285 struct va_format *vaf),
286 TP_ARGS(level, in_interrupt, function, vaf),
287 TP_STRUCT__entry(
288 __field(u32, level)
289 __field(u8, in_interrupt)
290 __string(function, function)
291 __dynamic_array(char, msg, MAX_MSG_LEN)
292 ),
293 TP_fast_assign(
294 __entry->level = level;
295 __entry->in_interrupt = in_interrupt;
296 __assign_str(function, function);
297 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
298 MAX_MSG_LEN, vaf->fmt,
299 *vaf->va) >= MAX_MSG_LEN);
300 ),
Johannes Berg9047e4a2013-02-20 16:29:37 +0100301 TP_printk("%s", __get_str(msg))
Johannes Berg2655e312012-01-31 21:08:37 -0800302);
303
304#undef TRACE_SYSTEM
Johannes Bergf042c2e2012-09-05 22:34:44 +0200305#define TRACE_SYSTEM iwlwifi_data
306
307TRACE_EVENT(iwlwifi_dev_tx_data,
308 TP_PROTO(const struct device *dev,
309 struct sk_buff *skb,
310 void *data, size_t data_len),
311 TP_ARGS(dev, skb, data, data_len),
312 TP_STRUCT__entry(
313 DEV_ENTRY
314
315 __dynamic_array(u8, data, iwl_trace_data(skb) ? data_len : 0)
316 ),
317 TP_fast_assign(
318 DEV_ASSIGN;
319 if (iwl_trace_data(skb))
320 memcpy(__get_dynamic_array(data), data, data_len);
321 ),
322 TP_printk("[%s] TX frame data", __get_str(dev))
323);
324
325TRACE_EVENT(iwlwifi_dev_rx_data,
326 TP_PROTO(const struct device *dev,
327 const struct iwl_trans *trans,
328 void *rxbuf, size_t len),
329 TP_ARGS(dev, trans, rxbuf, len),
330 TP_STRUCT__entry(
331 DEV_ENTRY
332
333 __dynamic_array(u8, data,
334 len - iwl_rx_trace_len(trans, rxbuf, len))
335 ),
336 TP_fast_assign(
337 size_t offs = iwl_rx_trace_len(trans, rxbuf, len);
338 DEV_ASSIGN;
339 if (offs < len)
340 memcpy(__get_dynamic_array(data),
341 ((u8 *)rxbuf) + offs, len - offs);
342 ),
Johannes Berg2e6e6b12012-11-06 12:37:21 +0100343 TP_printk("[%s] RX frame data", __get_str(dev))
Johannes Bergf042c2e2012-09-05 22:34:44 +0200344);
345
346#undef TRACE_SYSTEM
Johannes Berg0fd95af2009-11-20 12:05:02 -0800347#define TRACE_SYSTEM iwlwifi
348
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700349TRACE_EVENT(iwlwifi_dev_hcmd,
Johannes Berg45eab7c2012-09-05 00:33:53 +0200350 TP_PROTO(const struct device *dev,
351 struct iwl_host_cmd *cmd, u16 total_size,
Johannes Berg8a964f42013-02-25 16:01:34 +0100352 struct iwl_cmd_header *hdr),
353 TP_ARGS(dev, cmd, total_size, hdr),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700354 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800355 DEV_ENTRY
Johannes Berg45eab7c2012-09-05 00:33:53 +0200356 __dynamic_array(u8, hcmd, total_size)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700357 __field(u32, flags)
358 ),
359 TP_fast_assign(
Johannes Berg8a964f42013-02-25 16:01:34 +0100360 int i, offset = sizeof(*hdr);
Johannes Berg45eab7c2012-09-05 00:33:53 +0200361
Johannes Berg6c1011e2012-03-06 13:30:48 -0800362 DEV_ASSIGN;
Johannes Berg45eab7c2012-09-05 00:33:53 +0200363 __entry->flags = cmd->flags;
Johannes Berg8a964f42013-02-25 16:01:34 +0100364 memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr));
Johannes Berg45eab7c2012-09-05 00:33:53 +0200365
Johannes Berg1afbfb62013-02-26 11:32:26 +0100366 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
Johannes Berg45eab7c2012-09-05 00:33:53 +0200367 if (!cmd->len[i])
368 continue;
Johannes Berg45eab7c2012-09-05 00:33:53 +0200369 memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
370 cmd->data[i], cmd->len[i]);
371 offset += cmd->len[i];
372 }
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700373 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800374 TP_printk("[%s] hcmd %#.2x (%ssync)",
Johannes Berg45eab7c2012-09-05 00:33:53 +0200375 __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0],
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700376 __entry->flags & CMD_ASYNC ? "a" : "")
377);
378
379TRACE_EVENT(iwlwifi_dev_rx,
Johannes Bergf042c2e2012-09-05 22:34:44 +0200380 TP_PROTO(const struct device *dev, const struct iwl_trans *trans,
381 void *rxbuf, size_t len),
382 TP_ARGS(dev, trans, rxbuf, len),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700383 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800384 DEV_ENTRY
Johannes Bergf042c2e2012-09-05 22:34:44 +0200385 __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, rxbuf, len))
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700386 ),
387 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800388 DEV_ASSIGN;
Johannes Bergf042c2e2012-09-05 22:34:44 +0200389 memcpy(__get_dynamic_array(rxbuf), rxbuf,
390 iwl_rx_trace_len(trans, rxbuf, len));
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700391 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800392 TP_printk("[%s] RX cmd %#.2x",
393 __get_str(dev), ((u8 *)__get_dynamic_array(rxbuf))[4])
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700394);
395
396TRACE_EVENT(iwlwifi_dev_tx,
Johannes Bergf042c2e2012-09-05 22:34:44 +0200397 TP_PROTO(const struct device *dev, struct sk_buff *skb,
398 void *tfd, size_t tfdlen,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700399 void *buf0, size_t buf0_len,
400 void *buf1, size_t buf1_len),
Johannes Bergf042c2e2012-09-05 22:34:44 +0200401 TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700402 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800403 DEV_ENTRY
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700404
405 __field(size_t, framelen)
406 __dynamic_array(u8, tfd, tfdlen)
407
408 /*
409 * Do not insert between or below these items,
410 * we want to keep the frame together (except
411 * for the possible padding).
412 */
413 __dynamic_array(u8, buf0, buf0_len)
Johannes Bergf042c2e2012-09-05 22:34:44 +0200414 __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700415 ),
416 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800417 DEV_ASSIGN;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700418 __entry->framelen = buf0_len + buf1_len;
419 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
420 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
Johannes Bergf042c2e2012-09-05 22:34:44 +0200421 if (!iwl_trace_data(skb))
422 memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700423 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800424 TP_printk("[%s] TX %.2x (%zu bytes)",
425 __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0],
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700426 __entry->framelen)
427);
428
429TRACE_EVENT(iwlwifi_dev_ucode_error,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800430 TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700431 u32 data1, u32 data2, u32 line, u32 blink1,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700432 u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
433 u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver,
434 u32 brd_ver),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800435 TP_ARGS(dev, desc, tsf_low, data1, data2, line,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700436 blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
437 gp3, ucode_ver, hw_ver, brd_ver),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700438 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800439 DEV_ENTRY
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700440 __field(u32, desc)
Wey-Yi Guy50650542011-05-04 16:56:52 -0700441 __field(u32, tsf_low)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700442 __field(u32, data1)
443 __field(u32, data2)
444 __field(u32, line)
445 __field(u32, blink1)
446 __field(u32, blink2)
447 __field(u32, ilink1)
448 __field(u32, ilink2)
Wey-Yi Guy50650542011-05-04 16:56:52 -0700449 __field(u32, bcon_time)
450 __field(u32, gp1)
451 __field(u32, gp2)
452 __field(u32, gp3)
453 __field(u32, ucode_ver)
454 __field(u32, hw_ver)
455 __field(u32, brd_ver)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700456 ),
457 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800458 DEV_ASSIGN;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700459 __entry->desc = desc;
Wey-Yi Guy50650542011-05-04 16:56:52 -0700460 __entry->tsf_low = tsf_low;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700461 __entry->data1 = data1;
462 __entry->data2 = data2;
463 __entry->line = line;
464 __entry->blink1 = blink1;
465 __entry->blink2 = blink2;
466 __entry->ilink1 = ilink1;
467 __entry->ilink2 = ilink2;
Wey-Yi Guy50650542011-05-04 16:56:52 -0700468 __entry->bcon_time = bcon_time;
469 __entry->gp1 = gp1;
470 __entry->gp2 = gp2;
471 __entry->gp3 = gp3;
472 __entry->ucode_ver = ucode_ver;
473 __entry->hw_ver = hw_ver;
474 __entry->brd_ver = brd_ver;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700475 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800476 TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, "
Wey-Yi Guy50650542011-05-04 16:56:52 -0700477 "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
478 "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X "
479 "hw 0x%08X brd 0x%08X",
Johannes Berg6c1011e2012-03-06 13:30:48 -0800480 __get_str(dev), __entry->desc, __entry->tsf_low,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700481 __entry->data1,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700482 __entry->data2, __entry->line, __entry->blink1,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700483 __entry->blink2, __entry->ilink1, __entry->ilink2,
484 __entry->bcon_time, __entry->gp1, __entry->gp2,
485 __entry->gp3, __entry->ucode_ver, __entry->hw_ver,
486 __entry->brd_ver)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700487);
488
489TRACE_EVENT(iwlwifi_dev_ucode_event,
Johannes Berg6c1011e2012-03-06 13:30:48 -0800490 TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
491 TP_ARGS(dev, time, data, ev),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700492 TP_STRUCT__entry(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800493 DEV_ENTRY
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700494
495 __field(u32, time)
496 __field(u32, data)
497 __field(u32, ev)
498 ),
499 TP_fast_assign(
Johannes Berg6c1011e2012-03-06 13:30:48 -0800500 DEV_ASSIGN;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700501 __entry->time = time;
502 __entry->data = data;
503 __entry->ev = ev;
504 ),
Johannes Berg6c1011e2012-03-06 13:30:48 -0800505 TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
506 __get_str(dev), __entry->time, __entry->data, __entry->ev)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700507);
508#endif /* __IWLWIFI_DEVICE_TRACE */
509
510#undef TRACE_INCLUDE_PATH
511#define TRACE_INCLUDE_PATH .
512#undef TRACE_INCLUDE_FILE
513#define TRACE_INCLUDE_FILE iwl-devtrace
514#include <trace/define_trace.h>