xref: /linux/drivers/net/wireless/ath/ath12k/trace.h (revision 71dfa617ea9f18e4585fe78364217cd32b1fc382)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
4  * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
5  */
6 
7 #if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
8 
9 #include <linux/tracepoint.h>
10 #include "core.h"
11 
12 #define _TRACE_H_
13 
14 /* create empty functions when tracing is disabled */
15 #if !defined(CONFIG_ATH12K_TRACING)
16 #undef TRACE_EVENT
17 #define TRACE_EVENT(name, proto, ...) \
18 static inline void trace_ ## name(proto) {}
19 #endif /* !CONFIG_ATH12K_TRACING || __CHECKER__ */
20 
21 #undef TRACE_SYSTEM
22 #define TRACE_SYSTEM ath12k
23 
24 TRACE_EVENT(ath12k_htt_pktlog,
25 	    TP_PROTO(struct ath12k *ar, const void *buf, u16 buf_len,
26 		     u32 pktlog_checksum),
27 
28 	TP_ARGS(ar, buf, buf_len, pktlog_checksum),
29 
30 	TP_STRUCT__entry(
31 		__string(device, dev_name(ar->ab->dev))
32 		__string(driver, dev_driver_string(ar->ab->dev))
33 		__field(u16, buf_len)
34 		__field(u32, pktlog_checksum)
35 		__dynamic_array(u8, pktlog, buf_len)
36 	),
37 
38 	TP_fast_assign(
39 		__assign_str(device, dev_name(ar->ab->dev));
40 		__assign_str(driver, dev_driver_string(ar->ab->dev));
41 		__entry->buf_len = buf_len;
42 		__entry->pktlog_checksum = pktlog_checksum;
43 		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
44 	),
45 
46 	TP_printk(
47 		"%s %s size %u pktlog_checksum %d",
48 		__get_str(driver),
49 		__get_str(device),
50 		__entry->buf_len,
51 		__entry->pktlog_checksum
52 	 )
53 );
54 
55 TRACE_EVENT(ath12k_htt_ppdu_stats,
56 	    TP_PROTO(struct ath12k *ar, const void *data, size_t len),
57 
58 	TP_ARGS(ar, data, len),
59 
60 	TP_STRUCT__entry(
61 		__string(device, dev_name(ar->ab->dev))
62 		__string(driver, dev_driver_string(ar->ab->dev))
63 		__field(u16, len)
64 		__field(u32, info)
65 		__field(u32, sync_tstmp_lo_us)
66 		__field(u32, sync_tstmp_hi_us)
67 		__field(u32, mlo_offset_lo)
68 		__field(u32, mlo_offset_hi)
69 		__field(u32, mlo_offset_clks)
70 		__field(u32, mlo_comp_clks)
71 		__field(u32, mlo_comp_timer)
72 		__dynamic_array(u8, ppdu, len)
73 	),
74 
75 	TP_fast_assign(
76 		__assign_str(device, dev_name(ar->ab->dev));
77 		__assign_str(driver, dev_driver_string(ar->ab->dev));
78 		__entry->len = len;
79 		__entry->info = ar->pdev->timestamp.info;
80 		__entry->sync_tstmp_lo_us = ar->pdev->timestamp.sync_timestamp_hi_us;
81 		__entry->sync_tstmp_hi_us = ar->pdev->timestamp.sync_timestamp_lo_us;
82 		__entry->mlo_offset_lo = ar->pdev->timestamp.mlo_offset_lo;
83 		__entry->mlo_offset_hi = ar->pdev->timestamp.mlo_offset_hi;
84 		__entry->mlo_offset_clks = ar->pdev->timestamp.mlo_offset_clks;
85 		__entry->mlo_comp_clks = ar->pdev->timestamp.mlo_comp_clks;
86 		__entry->mlo_comp_timer = ar->pdev->timestamp.mlo_comp_timer;
87 		memcpy(__get_dynamic_array(ppdu), data, len);
88 	),
89 
90 	TP_printk(
91 		"%s %s ppdu len %d",
92 		__get_str(driver),
93 		__get_str(device),
94 		__entry->len
95 	 )
96 );
97 
98 TRACE_EVENT(ath12k_htt_rxdesc,
99 	    TP_PROTO(struct ath12k *ar, const void *data, size_t type, size_t len),
100 
101 	TP_ARGS(ar, data, type, len),
102 
103 	TP_STRUCT__entry(
104 		__string(device, dev_name(ar->ab->dev))
105 		__string(driver, dev_driver_string(ar->ab->dev))
106 		__field(u16, len)
107 		__field(u16, type)
108 		__field(u32, info)
109 		__field(u32, sync_tstmp_lo_us)
110 		__field(u32, sync_tstmp_hi_us)
111 		__field(u32, mlo_offset_lo)
112 		__field(u32, mlo_offset_hi)
113 		__field(u32, mlo_offset_clks)
114 		__field(u32, mlo_comp_clks)
115 		__field(u32, mlo_comp_timer)
116 		__dynamic_array(u8, rxdesc, len)
117 	),
118 
119 	TP_fast_assign(
120 		__assign_str(device, dev_name(ar->ab->dev));
121 		__assign_str(driver, dev_driver_string(ar->ab->dev));
122 		__entry->len = len;
123 		__entry->type = type;
124 		__entry->info = ar->pdev->timestamp.info;
125 		__entry->sync_tstmp_lo_us = ar->pdev->timestamp.sync_timestamp_hi_us;
126 		__entry->sync_tstmp_hi_us = ar->pdev->timestamp.sync_timestamp_lo_us;
127 		__entry->mlo_offset_lo = ar->pdev->timestamp.mlo_offset_lo;
128 		__entry->mlo_offset_hi = ar->pdev->timestamp.mlo_offset_hi;
129 		__entry->mlo_offset_clks = ar->pdev->timestamp.mlo_offset_clks;
130 		__entry->mlo_comp_clks = ar->pdev->timestamp.mlo_comp_clks;
131 		__entry->mlo_comp_timer = ar->pdev->timestamp.mlo_comp_timer;
132 		memcpy(__get_dynamic_array(rxdesc), data, len);
133 	),
134 
135 	TP_printk(
136 		"%s %s rxdesc len %d",
137 		__get_str(driver),
138 		__get_str(device),
139 		__entry->len
140 	 )
141 );
142 
143 TRACE_EVENT(ath12k_wmi_diag,
144 	    TP_PROTO(struct ath12k_base *ab, const void *data, size_t len),
145 
146 	TP_ARGS(ab, data, len),
147 
148 	TP_STRUCT__entry(
149 		__string(device, dev_name(ab->dev))
150 		__string(driver, dev_driver_string(ab->dev))
151 		__field(u16, len)
152 		__dynamic_array(u8, data, len)
153 	),
154 
155 	TP_fast_assign(
156 		__assign_str(device, dev_name(ab->dev));
157 		__assign_str(driver, dev_driver_string(ab->dev));
158 		__entry->len = len;
159 		memcpy(__get_dynamic_array(data), data, len);
160 	),
161 
162 	TP_printk(
163 		"%s %s tlv diag len %d",
164 		__get_str(driver),
165 		__get_str(device),
166 		__entry->len
167 	)
168 );
169 
170 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
171 
172 /* we don't want to use include/trace/events */
173 #undef TRACE_INCLUDE_PATH
174 #define TRACE_INCLUDE_PATH .
175 #undef TRACE_INCLUDE_FILE
176 #define TRACE_INCLUDE_FILE trace
177 
178 /* This part must be outside protection */
179 #include <trace/define_trace.h>
180