Merge tag 'iwlwifi-next-for-kalle-2015-06-03' of https://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / drivers / net / wireless / iwlwifi / iwl-devtrace-iwlwifi.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
4  * Copyright(c) 2015 Intel Mobile Communications GmbH
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18  *
19  * The full GNU General Public License is included in this distribution in the
20  * file called LICENSE.
21  *
22  * Contact Information:
23  *  Intel Linux Wireless <ilw@linux.intel.com>
24  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25  *
26  *****************************************************************************/
27
28 #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI) || defined(TRACE_HEADER_MULTI_READ)
29 #define __IWLWIFI_DEVICE_TRACE_IWLWIFI
30
31 #include <linux/tracepoint.h>
32
33 #undef TRACE_SYSTEM
34 #define TRACE_SYSTEM iwlwifi
35
36 TRACE_EVENT(iwlwifi_dev_hcmd,
37         TP_PROTO(const struct device *dev,
38                  struct iwl_host_cmd *cmd, u16 total_size,
39                  struct iwl_cmd_header *hdr),
40         TP_ARGS(dev, cmd, total_size, hdr),
41         TP_STRUCT__entry(
42                 DEV_ENTRY
43                 __dynamic_array(u8, hcmd, total_size)
44                 __field(u32, flags)
45         ),
46         TP_fast_assign(
47                 int i, offset = sizeof(*hdr);
48
49                 DEV_ASSIGN;
50                 __entry->flags = cmd->flags;
51                 memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr));
52
53                 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
54                         if (!cmd->len[i])
55                                 continue;
56                         memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
57                                cmd->data[i], cmd->len[i]);
58                         offset += cmd->len[i];
59                 }
60         ),
61         TP_printk("[%s] hcmd %#.2x (%ssync)",
62                   __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0],
63                   __entry->flags & CMD_ASYNC ? "a" : "")
64 );
65
66 TRACE_EVENT(iwlwifi_dev_rx,
67         TP_PROTO(const struct device *dev, const struct iwl_trans *trans,
68                  struct iwl_rx_packet *pkt, size_t len),
69         TP_ARGS(dev, trans, pkt, len),
70         TP_STRUCT__entry(
71                 DEV_ENTRY
72                 __field(u8, cmd)
73                 __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, pkt, len))
74         ),
75         TP_fast_assign(
76                 DEV_ASSIGN;
77                 __entry->cmd = pkt->hdr.cmd;
78                 memcpy(__get_dynamic_array(rxbuf), pkt,
79                        iwl_rx_trace_len(trans, pkt, len));
80         ),
81         TP_printk("[%s] RX cmd %#.2x",
82                   __get_str(dev), __entry->cmd)
83 );
84
85 TRACE_EVENT(iwlwifi_dev_tx,
86         TP_PROTO(const struct device *dev, struct sk_buff *skb,
87                  void *tfd, size_t tfdlen,
88                  void *buf0, size_t buf0_len,
89                  void *buf1, size_t buf1_len),
90         TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
91         TP_STRUCT__entry(
92                 DEV_ENTRY
93
94                 __field(size_t, framelen)
95                 __dynamic_array(u8, tfd, tfdlen)
96
97                 /*
98                  * Do not insert between or below these items,
99                  * we want to keep the frame together (except
100                  * for the possible padding).
101                  */
102                 __dynamic_array(u8, buf0, buf0_len)
103                 __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len)
104         ),
105         TP_fast_assign(
106                 DEV_ASSIGN;
107                 __entry->framelen = buf0_len + buf1_len;
108                 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
109                 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
110                 if (!iwl_trace_data(skb))
111                         memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
112         ),
113         TP_printk("[%s] TX %.2x (%zu bytes)",
114                   __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0],
115                   __entry->framelen)
116 );
117
118 TRACE_EVENT(iwlwifi_dev_ucode_error,
119         TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low,
120                  u32 data1, u32 data2, u32 line, u32 blink1,
121                  u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
122                  u32 gp1, u32 gp2, u32 gp3, u32 major, u32 minor, u32 hw_ver,
123                  u32 brd_ver),
124         TP_ARGS(dev, desc, tsf_low, data1, data2, line,
125                 blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
126                 gp3, major, minor, hw_ver, brd_ver),
127         TP_STRUCT__entry(
128                 DEV_ENTRY
129                 __field(u32, desc)
130                 __field(u32, tsf_low)
131                 __field(u32, data1)
132                 __field(u32, data2)
133                 __field(u32, line)
134                 __field(u32, blink1)
135                 __field(u32, blink2)
136                 __field(u32, ilink1)
137                 __field(u32, ilink2)
138                 __field(u32, bcon_time)
139                 __field(u32, gp1)
140                 __field(u32, gp2)
141                 __field(u32, gp3)
142                 __field(u32, major)
143                 __field(u32, minor)
144                 __field(u32, hw_ver)
145                 __field(u32, brd_ver)
146         ),
147         TP_fast_assign(
148                 DEV_ASSIGN;
149                 __entry->desc = desc;
150                 __entry->tsf_low = tsf_low;
151                 __entry->data1 = data1;
152                 __entry->data2 = data2;
153                 __entry->line = line;
154                 __entry->blink1 = blink1;
155                 __entry->blink2 = blink2;
156                 __entry->ilink1 = ilink1;
157                 __entry->ilink2 = ilink2;
158                 __entry->bcon_time = bcon_time;
159                 __entry->gp1 = gp1;
160                 __entry->gp2 = gp2;
161                 __entry->gp3 = gp3;
162                 __entry->major = major;
163                 __entry->minor = minor;
164                 __entry->hw_ver = hw_ver;
165                 __entry->brd_ver = brd_ver;
166         ),
167         TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, "
168                   "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
169                   "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X major 0x%08X "
170                   "minor 0x%08X hw 0x%08X brd 0x%08X",
171                   __get_str(dev), __entry->desc, __entry->tsf_low,
172                   __entry->data1,
173                   __entry->data2, __entry->line, __entry->blink1,
174                   __entry->blink2, __entry->ilink1, __entry->ilink2,
175                   __entry->bcon_time, __entry->gp1, __entry->gp2,
176                   __entry->gp3, __entry->major, __entry->minor,
177                   __entry->hw_ver, __entry->brd_ver)
178 );
179
180 TRACE_EVENT(iwlwifi_dev_ucode_event,
181         TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
182         TP_ARGS(dev, time, data, ev),
183         TP_STRUCT__entry(
184                 DEV_ENTRY
185
186                 __field(u32, time)
187                 __field(u32, data)
188                 __field(u32, ev)
189         ),
190         TP_fast_assign(
191                 DEV_ASSIGN;
192                 __entry->time = time;
193                 __entry->data = data;
194                 __entry->ev = ev;
195         ),
196         TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
197                   __get_str(dev), __entry->time, __entry->data, __entry->ev)
198 );
199 #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */
200
201 #undef TRACE_INCLUDE_PATH
202 #define TRACE_INCLUDE_PATH .
203 #undef TRACE_INCLUDE_FILE
204 #define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi
205 #include <trace/define_trace.h>