Linux 4.4.145
[linux/fpc-iii.git] / drivers / net / wireless / ath / ath6kl / trace.h
blob1a1ea7881b4dce8ef78b5302f154921829a3ce2a
1 #if !defined(_ATH6KL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
3 #include <net/cfg80211.h>
4 #include <linux/skbuff.h>
5 #include <linux/tracepoint.h>
6 #include "wmi.h"
7 #include "hif.h"
9 #if !defined(_ATH6KL_TRACE_H)
10 static inline unsigned int ath6kl_get_wmi_id(void *buf, size_t buf_len)
12 struct wmi_cmd_hdr *hdr = buf;
14 if (buf_len < sizeof(*hdr))
15 return 0;
17 return le16_to_cpu(hdr->cmd_id);
19 #endif /* __ATH6KL_TRACE_H */
21 #define _ATH6KL_TRACE_H
23 /* create empty functions when tracing is disabled */
24 #if !defined(CONFIG_ATH6KL_TRACING)
25 #undef TRACE_EVENT
26 #define TRACE_EVENT(name, proto, ...) \
27 static inline void trace_ ## name(proto) {}
28 #undef DECLARE_EVENT_CLASS
29 #define DECLARE_EVENT_CLASS(...)
30 #undef DEFINE_EVENT
31 #define DEFINE_EVENT(evt_class, name, proto, ...) \
32 static inline void trace_ ## name(proto) {}
33 #endif /* !CONFIG_ATH6KL_TRACING || __CHECKER__ */
35 #undef TRACE_SYSTEM
36 #define TRACE_SYSTEM ath6kl
38 TRACE_EVENT(ath6kl_wmi_cmd,
39 TP_PROTO(void *buf, size_t buf_len),
41 TP_ARGS(buf, buf_len),
43 TP_STRUCT__entry(
44 __field(unsigned int, id)
45 __field(size_t, buf_len)
46 __dynamic_array(u8, buf, buf_len)
49 TP_fast_assign(
50 __entry->id = ath6kl_get_wmi_id(buf, buf_len);
51 __entry->buf_len = buf_len;
52 memcpy(__get_dynamic_array(buf), buf, buf_len);
55 TP_printk(
56 "id %d len %zd",
57 __entry->id, __entry->buf_len
61 TRACE_EVENT(ath6kl_wmi_event,
62 TP_PROTO(void *buf, size_t buf_len),
64 TP_ARGS(buf, buf_len),
66 TP_STRUCT__entry(
67 __field(unsigned int, id)
68 __field(size_t, buf_len)
69 __dynamic_array(u8, buf, buf_len)
72 TP_fast_assign(
73 __entry->id = ath6kl_get_wmi_id(buf, buf_len);
74 __entry->buf_len = buf_len;
75 memcpy(__get_dynamic_array(buf), buf, buf_len);
78 TP_printk(
79 "id %d len %zd",
80 __entry->id, __entry->buf_len
84 TRACE_EVENT(ath6kl_sdio,
85 TP_PROTO(unsigned int addr, int flags,
86 void *buf, size_t buf_len),
88 TP_ARGS(addr, flags, buf, buf_len),
90 TP_STRUCT__entry(
91 __field(unsigned int, tx)
92 __field(unsigned int, addr)
93 __field(int, flags)
94 __field(size_t, buf_len)
95 __dynamic_array(u8, buf, buf_len)
98 TP_fast_assign(
99 __entry->addr = addr;
100 __entry->flags = flags;
101 __entry->buf_len = buf_len;
102 memcpy(__get_dynamic_array(buf), buf, buf_len);
104 if (flags & HIF_WRITE)
105 __entry->tx = 1;
106 else
107 __entry->tx = 0;
110 TP_printk(
111 "%s addr 0x%x flags 0x%x len %zd\n",
112 __entry->tx ? "tx" : "rx",
113 __entry->addr,
114 __entry->flags,
115 __entry->buf_len
119 TRACE_EVENT(ath6kl_sdio_scat,
120 TP_PROTO(unsigned int addr, int flags, unsigned int total_len,
121 unsigned int entries, struct hif_scatter_item *list),
123 TP_ARGS(addr, flags, total_len, entries, list),
125 TP_STRUCT__entry(
126 __field(unsigned int, tx)
127 __field(unsigned int, addr)
128 __field(int, flags)
129 __field(unsigned int, entries)
130 __field(size_t, total_len)
131 __dynamic_array(unsigned int, len_array, entries)
132 __dynamic_array(u8, data, total_len)
135 TP_fast_assign(
136 unsigned int *len_array;
137 int i, offset = 0;
138 size_t len;
140 __entry->addr = addr;
141 __entry->flags = flags;
142 __entry->entries = entries;
143 __entry->total_len = total_len;
145 if (flags & HIF_WRITE)
146 __entry->tx = 1;
147 else
148 __entry->tx = 0;
150 len_array = __get_dynamic_array(len_array);
152 for (i = 0; i < entries; i++) {
153 len = list[i].len;
155 memcpy((u8 *) __get_dynamic_array(data) + offset,
156 list[i].buf, len);
158 len_array[i] = len;
159 offset += len;
163 TP_printk(
164 "%s addr 0x%x flags 0x%x entries %d total_len %zd\n",
165 __entry->tx ? "tx" : "rx",
166 __entry->addr,
167 __entry->flags,
168 __entry->entries,
169 __entry->total_len
173 TRACE_EVENT(ath6kl_sdio_irq,
174 TP_PROTO(void *buf, size_t buf_len),
176 TP_ARGS(buf, buf_len),
178 TP_STRUCT__entry(
179 __field(size_t, buf_len)
180 __dynamic_array(u8, buf, buf_len)
183 TP_fast_assign(
184 __entry->buf_len = buf_len;
185 memcpy(__get_dynamic_array(buf), buf, buf_len);
188 TP_printk(
189 "irq len %zd\n", __entry->buf_len
193 TRACE_EVENT(ath6kl_htc_rx,
194 TP_PROTO(int status, int endpoint, void *buf,
195 size_t buf_len),
197 TP_ARGS(status, endpoint, buf, buf_len),
199 TP_STRUCT__entry(
200 __field(int, status)
201 __field(int, endpoint)
202 __field(size_t, buf_len)
203 __dynamic_array(u8, buf, buf_len)
206 TP_fast_assign(
207 __entry->status = status;
208 __entry->endpoint = endpoint;
209 __entry->buf_len = buf_len;
210 memcpy(__get_dynamic_array(buf), buf, buf_len);
213 TP_printk(
214 "status %d endpoint %d len %zd\n",
215 __entry->status,
216 __entry->endpoint,
217 __entry->buf_len
221 TRACE_EVENT(ath6kl_htc_tx,
222 TP_PROTO(int status, int endpoint, void *buf,
223 size_t buf_len),
225 TP_ARGS(status, endpoint, buf, buf_len),
227 TP_STRUCT__entry(
228 __field(int, status)
229 __field(int, endpoint)
230 __field(size_t, buf_len)
231 __dynamic_array(u8, buf, buf_len)
234 TP_fast_assign(
235 __entry->status = status;
236 __entry->endpoint = endpoint;
237 __entry->buf_len = buf_len;
238 memcpy(__get_dynamic_array(buf), buf, buf_len);
241 TP_printk(
242 "status %d endpoint %d len %zd\n",
243 __entry->status,
244 __entry->endpoint,
245 __entry->buf_len
249 #define ATH6KL_MSG_MAX 200
251 DECLARE_EVENT_CLASS(ath6kl_log_event,
252 TP_PROTO(struct va_format *vaf),
253 TP_ARGS(vaf),
254 TP_STRUCT__entry(
255 __dynamic_array(char, msg, ATH6KL_MSG_MAX)
257 TP_fast_assign(
258 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
259 ATH6KL_MSG_MAX,
260 vaf->fmt,
261 *vaf->va) >= ATH6KL_MSG_MAX);
263 TP_printk("%s", __get_str(msg))
266 DEFINE_EVENT(ath6kl_log_event, ath6kl_log_err,
267 TP_PROTO(struct va_format *vaf),
268 TP_ARGS(vaf)
271 DEFINE_EVENT(ath6kl_log_event, ath6kl_log_warn,
272 TP_PROTO(struct va_format *vaf),
273 TP_ARGS(vaf)
276 DEFINE_EVENT(ath6kl_log_event, ath6kl_log_info,
277 TP_PROTO(struct va_format *vaf),
278 TP_ARGS(vaf)
281 TRACE_EVENT(ath6kl_log_dbg,
282 TP_PROTO(unsigned int level, struct va_format *vaf),
283 TP_ARGS(level, vaf),
284 TP_STRUCT__entry(
285 __field(unsigned int, level)
286 __dynamic_array(char, msg, ATH6KL_MSG_MAX)
288 TP_fast_assign(
289 __entry->level = level;
290 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
291 ATH6KL_MSG_MAX,
292 vaf->fmt,
293 *vaf->va) >= ATH6KL_MSG_MAX);
295 TP_printk("%s", __get_str(msg))
298 TRACE_EVENT(ath6kl_log_dbg_dump,
299 TP_PROTO(const char *msg, const char *prefix,
300 const void *buf, size_t buf_len),
302 TP_ARGS(msg, prefix, buf, buf_len),
304 TP_STRUCT__entry(
305 __string(msg, msg)
306 __string(prefix, prefix)
307 __field(size_t, buf_len)
308 __dynamic_array(u8, buf, buf_len)
311 TP_fast_assign(
312 __assign_str(msg, msg);
313 __assign_str(prefix, prefix);
314 __entry->buf_len = buf_len;
315 memcpy(__get_dynamic_array(buf), buf, buf_len);
318 TP_printk(
319 "%s/%s\n", __get_str(prefix), __get_str(msg)
323 #endif /* _ ATH6KL_TRACE_H || TRACE_HEADER_MULTI_READ*/
325 /* we don't want to use include/trace/events */
326 #undef TRACE_INCLUDE_PATH
327 #define TRACE_INCLUDE_PATH .
328 #undef TRACE_INCLUDE_FILE
329 #define TRACE_INCLUDE_FILE trace
331 /* This part must be outside protection */
332 #include <trace/define_trace.h>