Linux 4.4.145
[linux/fpc-iii.git] / drivers / net / wireless / ath / ath10k / trace.h
blob71bdb368813de3af8ba8c062d49a27000392cf98
1 /*
2 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
20 #include <linux/tracepoint.h>
21 #include "core.h"
23 #if !defined(_TRACE_H_)
24 static inline u32 ath10k_frm_hdr_len(const void *buf, size_t len)
26 const struct ieee80211_hdr *hdr = buf;
28 /* In some rare cases (e.g. fcs error) device reports frame buffer
29 * shorter than what frame header implies (e.g. len = 0). The buffer
30 * can still be accessed so do a simple min() to guarantee caller
31 * doesn't get value greater than len.
33 return min_t(u32, len, ieee80211_hdrlen(hdr->frame_control));
35 #endif
37 #define _TRACE_H_
39 /* create empty functions when tracing is disabled */
40 #if !defined(CONFIG_ATH10K_TRACING)
41 #undef TRACE_EVENT
42 #define TRACE_EVENT(name, proto, ...) \
43 static inline void trace_ ## name(proto) {}
44 #undef DECLARE_EVENT_CLASS
45 #define DECLARE_EVENT_CLASS(...)
46 #undef DEFINE_EVENT
47 #define DEFINE_EVENT(evt_class, name, proto, ...) \
48 static inline void trace_ ## name(proto) {}
49 #endif /* !CONFIG_ATH10K_TRACING || __CHECKER__ */
51 #undef TRACE_SYSTEM
52 #define TRACE_SYSTEM ath10k
54 #define ATH10K_MSG_MAX 400
56 DECLARE_EVENT_CLASS(ath10k_log_event,
57 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
58 TP_ARGS(ar, vaf),
59 TP_STRUCT__entry(
60 __string(device, dev_name(ar->dev))
61 __string(driver, dev_driver_string(ar->dev))
62 __dynamic_array(char, msg, ATH10K_MSG_MAX)
64 TP_fast_assign(
65 __assign_str(device, dev_name(ar->dev));
66 __assign_str(driver, dev_driver_string(ar->dev));
67 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
68 ATH10K_MSG_MAX,
69 vaf->fmt,
70 *vaf->va) >= ATH10K_MSG_MAX);
72 TP_printk(
73 "%s %s %s",
74 __get_str(driver),
75 __get_str(device),
76 __get_str(msg)
80 DEFINE_EVENT(ath10k_log_event, ath10k_log_err,
81 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
82 TP_ARGS(ar, vaf)
85 DEFINE_EVENT(ath10k_log_event, ath10k_log_warn,
86 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
87 TP_ARGS(ar, vaf)
90 DEFINE_EVENT(ath10k_log_event, ath10k_log_info,
91 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
92 TP_ARGS(ar, vaf)
95 TRACE_EVENT(ath10k_log_dbg,
96 TP_PROTO(struct ath10k *ar, unsigned int level, struct va_format *vaf),
97 TP_ARGS(ar, level, vaf),
98 TP_STRUCT__entry(
99 __string(device, dev_name(ar->dev))
100 __string(driver, dev_driver_string(ar->dev))
101 __field(unsigned int, level)
102 __dynamic_array(char, msg, ATH10K_MSG_MAX)
104 TP_fast_assign(
105 __assign_str(device, dev_name(ar->dev));
106 __assign_str(driver, dev_driver_string(ar->dev));
107 __entry->level = level;
108 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
109 ATH10K_MSG_MAX,
110 vaf->fmt,
111 *vaf->va) >= ATH10K_MSG_MAX);
113 TP_printk(
114 "%s %s %s",
115 __get_str(driver),
116 __get_str(device),
117 __get_str(msg)
121 TRACE_EVENT(ath10k_log_dbg_dump,
122 TP_PROTO(struct ath10k *ar, const char *msg, const char *prefix,
123 const void *buf, size_t buf_len),
125 TP_ARGS(ar, msg, prefix, buf, buf_len),
127 TP_STRUCT__entry(
128 __string(device, dev_name(ar->dev))
129 __string(driver, dev_driver_string(ar->dev))
130 __string(msg, msg)
131 __string(prefix, prefix)
132 __field(size_t, buf_len)
133 __dynamic_array(u8, buf, buf_len)
136 TP_fast_assign(
137 __assign_str(device, dev_name(ar->dev));
138 __assign_str(driver, dev_driver_string(ar->dev));
139 __assign_str(msg, msg);
140 __assign_str(prefix, prefix);
141 __entry->buf_len = buf_len;
142 memcpy(__get_dynamic_array(buf), buf, buf_len);
145 TP_printk(
146 "%s %s %s/%s\n",
147 __get_str(driver),
148 __get_str(device),
149 __get_str(prefix),
150 __get_str(msg)
154 TRACE_EVENT(ath10k_wmi_cmd,
155 TP_PROTO(struct ath10k *ar, int id, const void *buf, size_t buf_len,
156 int ret),
158 TP_ARGS(ar, id, buf, buf_len, ret),
160 TP_STRUCT__entry(
161 __string(device, dev_name(ar->dev))
162 __string(driver, dev_driver_string(ar->dev))
163 __field(unsigned int, id)
164 __field(size_t, buf_len)
165 __dynamic_array(u8, buf, buf_len)
166 __field(int, ret)
169 TP_fast_assign(
170 __assign_str(device, dev_name(ar->dev));
171 __assign_str(driver, dev_driver_string(ar->dev));
172 __entry->id = id;
173 __entry->buf_len = buf_len;
174 __entry->ret = ret;
175 memcpy(__get_dynamic_array(buf), buf, buf_len);
178 TP_printk(
179 "%s %s id %d len %zu ret %d",
180 __get_str(driver),
181 __get_str(device),
182 __entry->id,
183 __entry->buf_len,
184 __entry->ret
188 TRACE_EVENT(ath10k_wmi_event,
189 TP_PROTO(struct ath10k *ar, int id, const void *buf, size_t buf_len),
191 TP_ARGS(ar, id, buf, buf_len),
193 TP_STRUCT__entry(
194 __string(device, dev_name(ar->dev))
195 __string(driver, dev_driver_string(ar->dev))
196 __field(unsigned int, id)
197 __field(size_t, buf_len)
198 __dynamic_array(u8, buf, buf_len)
201 TP_fast_assign(
202 __assign_str(device, dev_name(ar->dev));
203 __assign_str(driver, dev_driver_string(ar->dev));
204 __entry->id = id;
205 __entry->buf_len = buf_len;
206 memcpy(__get_dynamic_array(buf), buf, buf_len);
209 TP_printk(
210 "%s %s id %d len %zu",
211 __get_str(driver),
212 __get_str(device),
213 __entry->id,
214 __entry->buf_len
218 TRACE_EVENT(ath10k_htt_stats,
219 TP_PROTO(struct ath10k *ar, const void *buf, size_t buf_len),
221 TP_ARGS(ar, buf, buf_len),
223 TP_STRUCT__entry(
224 __string(device, dev_name(ar->dev))
225 __string(driver, dev_driver_string(ar->dev))
226 __field(size_t, buf_len)
227 __dynamic_array(u8, buf, buf_len)
230 TP_fast_assign(
231 __assign_str(device, dev_name(ar->dev));
232 __assign_str(driver, dev_driver_string(ar->dev));
233 __entry->buf_len = buf_len;
234 memcpy(__get_dynamic_array(buf), buf, buf_len);
237 TP_printk(
238 "%s %s len %zu",
239 __get_str(driver),
240 __get_str(device),
241 __entry->buf_len
245 TRACE_EVENT(ath10k_wmi_dbglog,
246 TP_PROTO(struct ath10k *ar, const void *buf, size_t buf_len),
248 TP_ARGS(ar, buf, buf_len),
250 TP_STRUCT__entry(
251 __string(device, dev_name(ar->dev))
252 __string(driver, dev_driver_string(ar->dev))
253 __field(size_t, buf_len)
254 __dynamic_array(u8, buf, buf_len)
257 TP_fast_assign(
258 __assign_str(device, dev_name(ar->dev));
259 __assign_str(driver, dev_driver_string(ar->dev));
260 __entry->buf_len = buf_len;
261 memcpy(__get_dynamic_array(buf), buf, buf_len);
264 TP_printk(
265 "%s %s len %zu",
266 __get_str(driver),
267 __get_str(device),
268 __entry->buf_len
272 TRACE_EVENT(ath10k_htt_pktlog,
273 TP_PROTO(struct ath10k *ar, const void *buf, u16 buf_len),
275 TP_ARGS(ar, buf, buf_len),
277 TP_STRUCT__entry(
278 __string(device, dev_name(ar->dev))
279 __string(driver, dev_driver_string(ar->dev))
280 __field(u16, buf_len)
281 __dynamic_array(u8, pktlog, buf_len)
284 TP_fast_assign(
285 __assign_str(device, dev_name(ar->dev));
286 __assign_str(driver, dev_driver_string(ar->dev));
287 __entry->buf_len = buf_len;
288 memcpy(__get_dynamic_array(pktlog), buf, buf_len);
291 TP_printk(
292 "%s %s size %hu",
293 __get_str(driver),
294 __get_str(device),
295 __entry->buf_len
299 TRACE_EVENT(ath10k_htt_tx,
300 TP_PROTO(struct ath10k *ar, u16 msdu_id, u16 msdu_len,
301 u8 vdev_id, u8 tid),
303 TP_ARGS(ar, msdu_id, msdu_len, vdev_id, tid),
305 TP_STRUCT__entry(
306 __string(device, dev_name(ar->dev))
307 __string(driver, dev_driver_string(ar->dev))
308 __field(u16, msdu_id)
309 __field(u16, msdu_len)
310 __field(u8, vdev_id)
311 __field(u8, tid)
314 TP_fast_assign(
315 __assign_str(device, dev_name(ar->dev));
316 __assign_str(driver, dev_driver_string(ar->dev));
317 __entry->msdu_id = msdu_id;
318 __entry->msdu_len = msdu_len;
319 __entry->vdev_id = vdev_id;
320 __entry->tid = tid;
323 TP_printk(
324 "%s %s msdu_id %d msdu_len %d vdev_id %d tid %d",
325 __get_str(driver),
326 __get_str(device),
327 __entry->msdu_id,
328 __entry->msdu_len,
329 __entry->vdev_id,
330 __entry->tid
334 TRACE_EVENT(ath10k_txrx_tx_unref,
335 TP_PROTO(struct ath10k *ar, u16 msdu_id),
337 TP_ARGS(ar, msdu_id),
339 TP_STRUCT__entry(
340 __string(device, dev_name(ar->dev))
341 __string(driver, dev_driver_string(ar->dev))
342 __field(u16, msdu_id)
345 TP_fast_assign(
346 __assign_str(device, dev_name(ar->dev));
347 __assign_str(driver, dev_driver_string(ar->dev));
348 __entry->msdu_id = msdu_id;
351 TP_printk(
352 "%s %s msdu_id %d",
353 __get_str(driver),
354 __get_str(device),
355 __entry->msdu_id
359 DECLARE_EVENT_CLASS(ath10k_hdr_event,
360 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
362 TP_ARGS(ar, data, len),
364 TP_STRUCT__entry(
365 __string(device, dev_name(ar->dev))
366 __string(driver, dev_driver_string(ar->dev))
367 __field(size_t, len)
368 __dynamic_array(u8, data, ath10k_frm_hdr_len(data, len))
371 TP_fast_assign(
372 __assign_str(device, dev_name(ar->dev));
373 __assign_str(driver, dev_driver_string(ar->dev));
374 __entry->len = ath10k_frm_hdr_len(data, len);
375 memcpy(__get_dynamic_array(data), data, __entry->len);
378 TP_printk(
379 "%s %s len %zu\n",
380 __get_str(driver),
381 __get_str(device),
382 __entry->len
386 DECLARE_EVENT_CLASS(ath10k_payload_event,
387 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
389 TP_ARGS(ar, data, len),
391 TP_STRUCT__entry(
392 __string(device, dev_name(ar->dev))
393 __string(driver, dev_driver_string(ar->dev))
394 __field(size_t, len)
395 __dynamic_array(u8, payload, (len -
396 ath10k_frm_hdr_len(data, len)))
399 TP_fast_assign(
400 __assign_str(device, dev_name(ar->dev));
401 __assign_str(driver, dev_driver_string(ar->dev));
402 __entry->len = len - ath10k_frm_hdr_len(data, len);
403 memcpy(__get_dynamic_array(payload),
404 data + ath10k_frm_hdr_len(data, len), __entry->len);
407 TP_printk(
408 "%s %s len %zu\n",
409 __get_str(driver),
410 __get_str(device),
411 __entry->len
415 DEFINE_EVENT(ath10k_hdr_event, ath10k_tx_hdr,
416 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
417 TP_ARGS(ar, data, len)
420 DEFINE_EVENT(ath10k_payload_event, ath10k_tx_payload,
421 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
422 TP_ARGS(ar, data, len)
425 DEFINE_EVENT(ath10k_hdr_event, ath10k_rx_hdr,
426 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
427 TP_ARGS(ar, data, len)
430 DEFINE_EVENT(ath10k_payload_event, ath10k_rx_payload,
431 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
432 TP_ARGS(ar, data, len)
435 TRACE_EVENT(ath10k_htt_rx_desc,
436 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
438 TP_ARGS(ar, data, len),
440 TP_STRUCT__entry(
441 __string(device, dev_name(ar->dev))
442 __string(driver, dev_driver_string(ar->dev))
443 __field(u16, len)
444 __dynamic_array(u8, rxdesc, len)
447 TP_fast_assign(
448 __assign_str(device, dev_name(ar->dev));
449 __assign_str(driver, dev_driver_string(ar->dev));
450 __entry->len = len;
451 memcpy(__get_dynamic_array(rxdesc), data, len);
454 TP_printk(
455 "%s %s rxdesc len %d",
456 __get_str(driver),
457 __get_str(device),
458 __entry->len
462 TRACE_EVENT(ath10k_wmi_diag_container,
463 TP_PROTO(struct ath10k *ar,
464 u8 type,
465 u32 timestamp,
466 u32 code,
467 u16 len,
468 const void *data),
470 TP_ARGS(ar, type, timestamp, code, len, data),
472 TP_STRUCT__entry(
473 __string(device, dev_name(ar->dev))
474 __string(driver, dev_driver_string(ar->dev))
475 __field(u8, type)
476 __field(u32, timestamp)
477 __field(u32, code)
478 __field(u16, len)
479 __dynamic_array(u8, data, len)
482 TP_fast_assign(
483 __assign_str(device, dev_name(ar->dev));
484 __assign_str(driver, dev_driver_string(ar->dev));
485 __entry->type = type;
486 __entry->timestamp = timestamp;
487 __entry->code = code;
488 __entry->len = len;
489 memcpy(__get_dynamic_array(data), data, len);
492 TP_printk(
493 "%s %s diag container type %hhu timestamp %u code %u len %d",
494 __get_str(driver),
495 __get_str(device),
496 __entry->type,
497 __entry->timestamp,
498 __entry->code,
499 __entry->len
503 TRACE_EVENT(ath10k_wmi_diag,
504 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
506 TP_ARGS(ar, data, len),
508 TP_STRUCT__entry(
509 __string(device, dev_name(ar->dev))
510 __string(driver, dev_driver_string(ar->dev))
511 __field(u16, len)
512 __dynamic_array(u8, data, len)
515 TP_fast_assign(
516 __assign_str(device, dev_name(ar->dev));
517 __assign_str(driver, dev_driver_string(ar->dev));
518 __entry->len = len;
519 memcpy(__get_dynamic_array(data), data, len);
522 TP_printk(
523 "%s %s tlv diag len %d",
524 __get_str(driver),
525 __get_str(device),
526 __entry->len
530 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
532 /* we don't want to use include/trace/events */
533 #undef TRACE_INCLUDE_PATH
534 #define TRACE_INCLUDE_PATH .
535 #undef TRACE_INCLUDE_FILE
536 #define TRACE_INCLUDE_FILE trace
538 /* This part must be outside protection */
539 #include <trace/define_trace.h>