1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
4  */
5 
6 #if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
7 
8 #include <linux/tracepoint.h>
9 #include "core.h"
10 
11 #define _TRACE_H_
12 
13 /* create empty functions when tracing is disabled */
14 #if !defined(CONFIG_ATH11K_TRACING)
15 #undef TRACE_EVENT
16 #define TRACE_EVENT(name, proto, ...) \
17 static inline void trace_ ## name(proto) {}
18 #endif /* !CONFIG_ATH11K_TRACING || __CHECKER__ */
19 
20 #undef TRACE_SYSTEM
21 #define TRACE_SYSTEM ath11k
22 
23 TRACE_EVENT(ath11k_htt_pktlog,
24 	    TP_PROTO(struct ath11k *ar, const void *buf, u16 buf_len,
25 		     u32 pktlog_checksum),
26 
27 	TP_ARGS(ar, buf, buf_len, pktlog_checksum),
28 
29 	TP_STRUCT__entry(
30 		__string(device, dev_name(ar->ab->dev))
31 		__string(driver, dev_driver_string(ar->ab->dev))
32 		__field(u16, buf_len)
33 		__field(u32, pktlog_checksum)
34 		__dynamic_array(u8, pktlog, buf_len)
35 	),
36 
37 	TP_fast_assign(
38 		__assign_str(device, dev_name(ar->ab->dev));
39 		__assign_str(driver, dev_driver_string(ar->ab->dev));
40 		__entry->buf_len = buf_len;
41 		__entry->pktlog_checksum = pktlog_checksum;
42 		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
43 	),
44 
45 	TP_printk(
46 		"%s %s size %u pktlog_checksum %d",
47 		__get_str(driver),
48 		__get_str(device),
49 		__entry->buf_len,
50 		__entry->pktlog_checksum
51 	 )
52 );
53 
54 TRACE_EVENT(ath11k_htt_ppdu_stats,
55 	    TP_PROTO(struct ath11k *ar, const void *data, size_t len),
56 
57 	TP_ARGS(ar, data, len),
58 
59 	TP_STRUCT__entry(
60 		__string(device, dev_name(ar->ab->dev))
61 		__string(driver, dev_driver_string(ar->ab->dev))
62 		__field(u16, len)
63 		__dynamic_array(u8, ppdu, len)
64 	),
65 
66 	TP_fast_assign(
67 		__assign_str(device, dev_name(ar->ab->dev));
68 		__assign_str(driver, dev_driver_string(ar->ab->dev));
69 		__entry->len = len;
70 		memcpy(__get_dynamic_array(ppdu), data, len);
71 	),
72 
73 	TP_printk(
74 		"%s %s ppdu len %d",
75 		__get_str(driver),
76 		__get_str(device),
77 		__entry->len
78 	 )
79 );
80 
81 TRACE_EVENT(ath11k_htt_rxdesc,
82 	    TP_PROTO(struct ath11k *ar, const void *data, size_t len),
83 
84 	TP_ARGS(ar, data, len),
85 
86 	TP_STRUCT__entry(
87 		__string(device, dev_name(ar->ab->dev))
88 		__string(driver, dev_driver_string(ar->ab->dev))
89 		__field(u16, len)
90 		__dynamic_array(u8, rxdesc, len)
91 	),
92 
93 	TP_fast_assign(
94 		__assign_str(device, dev_name(ar->ab->dev));
95 		__assign_str(driver, dev_driver_string(ar->ab->dev));
96 		__entry->len = len;
97 		memcpy(__get_dynamic_array(rxdesc), data, len);
98 	),
99 
100 	TP_printk(
101 		"%s %s rxdesc len %d",
102 		__get_str(driver),
103 		__get_str(device),
104 		__entry->len
105 	 )
106 );
107 
108 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
109 
110 /* we don't want to use include/trace/events */
111 #undef TRACE_INCLUDE_PATH
112 #define TRACE_INCLUDE_PATH .
113 #undef TRACE_INCLUDE_FILE
114 #define TRACE_INCLUDE_FILE trace
115 
116 /* This part must be outside protection */
117 #include <trace/define_trace.h>
118