WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / wireless / ath / ath10k / trace.h
blob842e42ec814f4b40794ec5231cd4fbef87246cc4
1 /* SPDX-License-Identifier: ISC */
2 /*
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
5 */
7 #if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
9 #include <linux/tracepoint.h>
10 #include "core.h"
12 #if !defined(_TRACE_H_)
13 static inline u32 ath10k_frm_hdr_len(const void *buf, size_t len)
15 const struct ieee80211_hdr *hdr = buf;
17 /* In some rare cases (e.g. fcs error) device reports frame buffer
18 * shorter than what frame header implies (e.g. len = 0). The buffer
19 * can still be accessed so do a simple min() to guarantee caller
20 * doesn't get value greater than len.
22 return min_t(u32, len, ieee80211_hdrlen(hdr->frame_control));
24 #endif
26 #define _TRACE_H_
28 /* create empty functions when tracing is disabled */
29 #if !defined(CONFIG_ATH10K_TRACING)
30 #undef TRACE_EVENT
31 #define TRACE_EVENT(name, proto, ...) \
32 static inline void trace_ ## name(proto) {} \
33 static inline bool trace_##name##_enabled(void) \
34 { \
35 return false; \
37 #undef DECLARE_EVENT_CLASS
38 #define DECLARE_EVENT_CLASS(...)
39 #undef DEFINE_EVENT
40 #define DEFINE_EVENT(evt_class, name, proto, ...) \
41 static inline void trace_ ## name(proto) {}
42 #endif /* !CONFIG_ATH10K_TRACING || __CHECKER__ */
44 #undef TRACE_SYSTEM
45 #define TRACE_SYSTEM ath10k
47 #define ATH10K_MSG_MAX 400
49 DECLARE_EVENT_CLASS(ath10k_log_event,
50 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
51 TP_ARGS(ar, vaf),
52 TP_STRUCT__entry(
53 __string(device, dev_name(ar->dev))
54 __string(driver, dev_driver_string(ar->dev))
55 __dynamic_array(char, msg, ATH10K_MSG_MAX)
57 TP_fast_assign(
58 __assign_str(device, dev_name(ar->dev));
59 __assign_str(driver, dev_driver_string(ar->dev));
60 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
61 ATH10K_MSG_MAX,
62 vaf->fmt,
63 *vaf->va) >= ATH10K_MSG_MAX);
65 TP_printk(
66 "%s %s %s",
67 __get_str(driver),
68 __get_str(device),
69 __get_str(msg)
73 DEFINE_EVENT(ath10k_log_event, ath10k_log_err,
74 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
75 TP_ARGS(ar, vaf)
78 DEFINE_EVENT(ath10k_log_event, ath10k_log_warn,
79 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
80 TP_ARGS(ar, vaf)
83 DEFINE_EVENT(ath10k_log_event, ath10k_log_info,
84 TP_PROTO(struct ath10k *ar, struct va_format *vaf),
85 TP_ARGS(ar, vaf)
88 TRACE_EVENT(ath10k_log_dbg,
89 TP_PROTO(struct ath10k *ar, unsigned int level, struct va_format *vaf),
90 TP_ARGS(ar, level, vaf),
91 TP_STRUCT__entry(
92 __string(device, dev_name(ar->dev))
93 __string(driver, dev_driver_string(ar->dev))
94 __field(unsigned int, level)
95 __dynamic_array(char, msg, ATH10K_MSG_MAX)
97 TP_fast_assign(
98 __assign_str(device, dev_name(ar->dev));
99 __assign_str(driver, dev_driver_string(ar->dev));
100 __entry->level = level;
101 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
102 ATH10K_MSG_MAX,
103 vaf->fmt,
104 *vaf->va) >= ATH10K_MSG_MAX);
106 TP_printk(
107 "%s %s %s",
108 __get_str(driver),
109 __get_str(device),
110 __get_str(msg)
114 TRACE_EVENT(ath10k_log_dbg_dump,
115 TP_PROTO(struct ath10k *ar, const char *msg, const char *prefix,
116 const void *buf, size_t buf_len),
118 TP_ARGS(ar, msg, prefix, buf, buf_len),
120 TP_STRUCT__entry(
121 __string(device, dev_name(ar->dev))
122 __string(driver, dev_driver_string(ar->dev))
123 __string(msg, msg)
124 __string(prefix, prefix)
125 __field(size_t, buf_len)
126 __dynamic_array(u8, buf, buf_len)
129 TP_fast_assign(
130 __assign_str(device, dev_name(ar->dev));
131 __assign_str(driver, dev_driver_string(ar->dev));
132 __assign_str(msg, msg);
133 __assign_str(prefix, prefix);
134 __entry->buf_len = buf_len;
135 memcpy(__get_dynamic_array(buf), buf, buf_len);
138 TP_printk(
139 "%s %s %s/%s\n",
140 __get_str(driver),
141 __get_str(device),
142 __get_str(prefix),
143 __get_str(msg)
147 TRACE_EVENT(ath10k_wmi_cmd,
148 TP_PROTO(struct ath10k *ar, int id, const void *buf, size_t buf_len),
150 TP_ARGS(ar, id, buf, buf_len),
152 TP_STRUCT__entry(
153 __string(device, dev_name(ar->dev))
154 __string(driver, dev_driver_string(ar->dev))
155 __field(unsigned int, id)
156 __field(size_t, buf_len)
157 __dynamic_array(u8, buf, buf_len)
160 TP_fast_assign(
161 __assign_str(device, dev_name(ar->dev));
162 __assign_str(driver, dev_driver_string(ar->dev));
163 __entry->id = id;
164 __entry->buf_len = buf_len;
165 memcpy(__get_dynamic_array(buf), buf, buf_len);
168 TP_printk(
169 "%s %s id %d len %zu",
170 __get_str(driver),
171 __get_str(device),
172 __entry->id,
173 __entry->buf_len
177 TRACE_EVENT(ath10k_wmi_event,
178 TP_PROTO(struct ath10k *ar, int id, const void *buf, size_t buf_len),
180 TP_ARGS(ar, id, buf, buf_len),
182 TP_STRUCT__entry(
183 __string(device, dev_name(ar->dev))
184 __string(driver, dev_driver_string(ar->dev))
185 __field(unsigned int, id)
186 __field(size_t, buf_len)
187 __dynamic_array(u8, buf, buf_len)
190 TP_fast_assign(
191 __assign_str(device, dev_name(ar->dev));
192 __assign_str(driver, dev_driver_string(ar->dev));
193 __entry->id = id;
194 __entry->buf_len = buf_len;
195 memcpy(__get_dynamic_array(buf), buf, buf_len);
198 TP_printk(
199 "%s %s id %d len %zu",
200 __get_str(driver),
201 __get_str(device),
202 __entry->id,
203 __entry->buf_len
207 TRACE_EVENT(ath10k_htt_stats,
208 TP_PROTO(struct ath10k *ar, const void *buf, size_t buf_len),
210 TP_ARGS(ar, buf, buf_len),
212 TP_STRUCT__entry(
213 __string(device, dev_name(ar->dev))
214 __string(driver, dev_driver_string(ar->dev))
215 __field(size_t, buf_len)
216 __dynamic_array(u8, buf, buf_len)
219 TP_fast_assign(
220 __assign_str(device, dev_name(ar->dev));
221 __assign_str(driver, dev_driver_string(ar->dev));
222 __entry->buf_len = buf_len;
223 memcpy(__get_dynamic_array(buf), buf, buf_len);
226 TP_printk(
227 "%s %s len %zu",
228 __get_str(driver),
229 __get_str(device),
230 __entry->buf_len
234 TRACE_EVENT(ath10k_wmi_dbglog,
235 TP_PROTO(struct ath10k *ar, const void *buf, size_t buf_len),
237 TP_ARGS(ar, buf, buf_len),
239 TP_STRUCT__entry(
240 __string(device, dev_name(ar->dev))
241 __string(driver, dev_driver_string(ar->dev))
242 __field(u8, hw_type)
243 __field(size_t, buf_len)
244 __dynamic_array(u8, buf, buf_len)
247 TP_fast_assign(
248 __assign_str(device, dev_name(ar->dev));
249 __assign_str(driver, dev_driver_string(ar->dev));
250 __entry->hw_type = ar->hw_rev;
251 __entry->buf_len = buf_len;
252 memcpy(__get_dynamic_array(buf), buf, buf_len);
255 TP_printk(
256 "%s %s %d len %zu",
257 __get_str(driver),
258 __get_str(device),
259 __entry->hw_type,
260 __entry->buf_len
264 TRACE_EVENT(ath10k_htt_pktlog,
265 TP_PROTO(struct ath10k *ar, const void *buf, u16 buf_len),
267 TP_ARGS(ar, buf, buf_len),
269 TP_STRUCT__entry(
270 __string(device, dev_name(ar->dev))
271 __string(driver, dev_driver_string(ar->dev))
272 __field(u8, hw_type)
273 __field(u16, buf_len)
274 __dynamic_array(u8, pktlog, buf_len)
277 TP_fast_assign(
278 __assign_str(device, dev_name(ar->dev));
279 __assign_str(driver, dev_driver_string(ar->dev));
280 __entry->hw_type = ar->hw_rev;
281 __entry->buf_len = buf_len;
282 memcpy(__get_dynamic_array(pktlog), buf, buf_len);
285 TP_printk(
286 "%s %s %d size %hu",
287 __get_str(driver),
288 __get_str(device),
289 __entry->hw_type,
290 __entry->buf_len
294 TRACE_EVENT(ath10k_htt_tx,
295 TP_PROTO(struct ath10k *ar, u16 msdu_id, u16 msdu_len,
296 u8 vdev_id, u8 tid),
298 TP_ARGS(ar, msdu_id, msdu_len, vdev_id, tid),
300 TP_STRUCT__entry(
301 __string(device, dev_name(ar->dev))
302 __string(driver, dev_driver_string(ar->dev))
303 __field(u16, msdu_id)
304 __field(u16, msdu_len)
305 __field(u8, vdev_id)
306 __field(u8, tid)
309 TP_fast_assign(
310 __assign_str(device, dev_name(ar->dev));
311 __assign_str(driver, dev_driver_string(ar->dev));
312 __entry->msdu_id = msdu_id;
313 __entry->msdu_len = msdu_len;
314 __entry->vdev_id = vdev_id;
315 __entry->tid = tid;
318 TP_printk(
319 "%s %s msdu_id %d msdu_len %d vdev_id %d tid %d",
320 __get_str(driver),
321 __get_str(device),
322 __entry->msdu_id,
323 __entry->msdu_len,
324 __entry->vdev_id,
325 __entry->tid
329 TRACE_EVENT(ath10k_txrx_tx_unref,
330 TP_PROTO(struct ath10k *ar, u16 msdu_id),
332 TP_ARGS(ar, msdu_id),
334 TP_STRUCT__entry(
335 __string(device, dev_name(ar->dev))
336 __string(driver, dev_driver_string(ar->dev))
337 __field(u16, msdu_id)
340 TP_fast_assign(
341 __assign_str(device, dev_name(ar->dev));
342 __assign_str(driver, dev_driver_string(ar->dev));
343 __entry->msdu_id = msdu_id;
346 TP_printk(
347 "%s %s msdu_id %d",
348 __get_str(driver),
349 __get_str(device),
350 __entry->msdu_id
354 DECLARE_EVENT_CLASS(ath10k_hdr_event,
355 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
357 TP_ARGS(ar, data, len),
359 TP_STRUCT__entry(
360 __string(device, dev_name(ar->dev))
361 __string(driver, dev_driver_string(ar->dev))
362 __field(size_t, len)
363 __dynamic_array(u8, data, ath10k_frm_hdr_len(data, len))
366 TP_fast_assign(
367 __assign_str(device, dev_name(ar->dev));
368 __assign_str(driver, dev_driver_string(ar->dev));
369 __entry->len = ath10k_frm_hdr_len(data, len);
370 memcpy(__get_dynamic_array(data), data, __entry->len);
373 TP_printk(
374 "%s %s len %zu\n",
375 __get_str(driver),
376 __get_str(device),
377 __entry->len
381 DECLARE_EVENT_CLASS(ath10k_payload_event,
382 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
384 TP_ARGS(ar, data, len),
386 TP_STRUCT__entry(
387 __string(device, dev_name(ar->dev))
388 __string(driver, dev_driver_string(ar->dev))
389 __field(size_t, len)
390 __dynamic_array(u8, payload, (len -
391 ath10k_frm_hdr_len(data, len)))
394 TP_fast_assign(
395 __assign_str(device, dev_name(ar->dev));
396 __assign_str(driver, dev_driver_string(ar->dev));
397 __entry->len = len - ath10k_frm_hdr_len(data, len);
398 memcpy(__get_dynamic_array(payload),
399 data + ath10k_frm_hdr_len(data, len), __entry->len);
402 TP_printk(
403 "%s %s len %zu\n",
404 __get_str(driver),
405 __get_str(device),
406 __entry->len
410 DEFINE_EVENT(ath10k_hdr_event, ath10k_tx_hdr,
411 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
412 TP_ARGS(ar, data, len)
415 DEFINE_EVENT(ath10k_payload_event, ath10k_tx_payload,
416 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
417 TP_ARGS(ar, data, len)
420 DEFINE_EVENT(ath10k_hdr_event, ath10k_rx_hdr,
421 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
422 TP_ARGS(ar, data, len)
425 DEFINE_EVENT(ath10k_payload_event, ath10k_rx_payload,
426 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
427 TP_ARGS(ar, data, len)
430 TRACE_EVENT(ath10k_htt_rx_desc,
431 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
433 TP_ARGS(ar, data, len),
435 TP_STRUCT__entry(
436 __string(device, dev_name(ar->dev))
437 __string(driver, dev_driver_string(ar->dev))
438 __field(u8, hw_type)
439 __field(u16, len)
440 __dynamic_array(u8, rxdesc, len)
443 TP_fast_assign(
444 __assign_str(device, dev_name(ar->dev));
445 __assign_str(driver, dev_driver_string(ar->dev));
446 __entry->hw_type = ar->hw_rev;
447 __entry->len = len;
448 memcpy(__get_dynamic_array(rxdesc), data, len);
451 TP_printk(
452 "%s %s %d rxdesc len %d",
453 __get_str(driver),
454 __get_str(device),
455 __entry->hw_type,
456 __entry->len
460 TRACE_EVENT(ath10k_wmi_diag_container,
461 TP_PROTO(struct ath10k *ar,
462 u8 type,
463 u32 timestamp,
464 u32 code,
465 u16 len,
466 const void *data),
468 TP_ARGS(ar, type, timestamp, code, len, data),
470 TP_STRUCT__entry(
471 __string(device, dev_name(ar->dev))
472 __string(driver, dev_driver_string(ar->dev))
473 __field(u8, type)
474 __field(u32, timestamp)
475 __field(u32, code)
476 __field(u16, len)
477 __dynamic_array(u8, data, len)
480 TP_fast_assign(
481 __assign_str(device, dev_name(ar->dev));
482 __assign_str(driver, dev_driver_string(ar->dev));
483 __entry->type = type;
484 __entry->timestamp = timestamp;
485 __entry->code = code;
486 __entry->len = len;
487 memcpy(__get_dynamic_array(data), data, len);
490 TP_printk(
491 "%s %s diag container type %hhu timestamp %u code %u len %d",
492 __get_str(driver),
493 __get_str(device),
494 __entry->type,
495 __entry->timestamp,
496 __entry->code,
497 __entry->len
501 TRACE_EVENT(ath10k_wmi_diag,
502 TP_PROTO(struct ath10k *ar, const void *data, size_t len),
504 TP_ARGS(ar, data, len),
506 TP_STRUCT__entry(
507 __string(device, dev_name(ar->dev))
508 __string(driver, dev_driver_string(ar->dev))
509 __field(u16, len)
510 __dynamic_array(u8, data, len)
513 TP_fast_assign(
514 __assign_str(device, dev_name(ar->dev));
515 __assign_str(driver, dev_driver_string(ar->dev));
516 __entry->len = len;
517 memcpy(__get_dynamic_array(data), data, len);
520 TP_printk(
521 "%s %s tlv diag len %d",
522 __get_str(driver),
523 __get_str(device),
524 __entry->len
528 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
530 /* we don't want to use include/trace/events */
531 #undef TRACE_INCLUDE_PATH
532 #define TRACE_INCLUDE_PATH .
533 #undef TRACE_INCLUDE_FILE
534 #define TRACE_INCLUDE_FILE trace
536 /* This part must be outside protection */
537 #include <trace/define_trace.h>