summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath11k/trace.h
blob: 235ab8ea715fed7119e215fa31a7ef780eefb01c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
 * Copyright (c) 2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)

#include <linux/tracepoint.h>
#include "core.h"

#define _TRACE_H_

/* create empty functions when tracing is disabled */
#if !defined(CONFIG_ATH11K_TRACING)
#undef TRACE_EVENT
#define TRACE_EVENT(name, proto, ...) \
static inline void trace_ ## name(proto) {} \
static inline bool trace_##name##_enabled(void) \
{						\
	return false;				\
}

#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(...)
#undef DEFINE_EVENT
#define DEFINE_EVENT(evt_class, name, proto, ...) \
static inline void trace_ ## name(proto) {}
#endif /* !CONFIG_ATH11K_TRACING || __CHECKER__ */

#undef TRACE_SYSTEM
#define TRACE_SYSTEM ath11k

#define ATH11K_MSG_MAX 400

TRACE_EVENT(ath11k_htt_pktlog,
	    TP_PROTO(struct ath11k *ar, const void *buf, u16 buf_len,
		     u32 pktlog_checksum),

	TP_ARGS(ar, buf, buf_len, pktlog_checksum),

	TP_STRUCT__entry(
		__string(device, dev_name(ar->ab->dev))
		__string(driver, dev_driver_string(ar->ab->dev))
		__field(u16, buf_len)
		__field(u32, pktlog_checksum)
		__dynamic_array(u8, pktlog, buf_len)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ar->ab->dev));
		__assign_str(driver, dev_driver_string(ar->ab->dev));
		__entry->buf_len = buf_len;
		__entry->pktlog_checksum = pktlog_checksum;
		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
	),

	TP_printk(
		"%s %s size %u pktlog_checksum %d",
		__get_str(driver),
		__get_str(device),
		__entry->buf_len,
		__entry->pktlog_checksum
	 )
);

TRACE_EVENT(ath11k_htt_ppdu_stats,
	    TP_PROTO(struct ath11k *ar, const void *data, size_t len),

	TP_ARGS(ar, data, len),

	TP_STRUCT__entry(
		__string(device, dev_name(ar->ab->dev))
		__string(driver, dev_driver_string(ar->ab->dev))
		__field(u16, len)
		__dynamic_array(u8, ppdu, len)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ar->ab->dev));
		__assign_str(driver, dev_driver_string(ar->ab->dev));
		__entry->len = len;
		memcpy(__get_dynamic_array(ppdu), data, len);
	),

	TP_printk(
		"%s %s ppdu len %d",
		__get_str(driver),
		__get_str(device),
		__entry->len
	 )
);

TRACE_EVENT(ath11k_htt_rxdesc,
	    TP_PROTO(struct ath11k *ar, const void *data, size_t log_type, size_t len),

	TP_ARGS(ar, data, log_type, len),

	TP_STRUCT__entry(
		__string(device, dev_name(ar->ab->dev))
		__string(driver, dev_driver_string(ar->ab->dev))
		__field(u16, len)
		__field(u16, log_type)
		__dynamic_array(u8, rxdesc, len)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ar->ab->dev));
		__assign_str(driver, dev_driver_string(ar->ab->dev));
		__entry->len = len;
		__entry->log_type = log_type;
		memcpy(__get_dynamic_array(rxdesc), data, len);
	),

	TP_printk(
		"%s %s rxdesc len %d type %d",
		__get_str(driver),
		__get_str(device),
		__entry->len,
		__entry->log_type
	 )
);

DECLARE_EVENT_CLASS(ath11k_log_event,
		    TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
	TP_ARGS(ab, vaf),
	TP_STRUCT__entry(
		__string(device, dev_name(ab->dev))
		__string(driver, dev_driver_string(ab->dev))
		__vstring(msg, vaf->fmt, vaf->va)
	),
	TP_fast_assign(
		__assign_str(device, dev_name(ab->dev));
		__assign_str(driver, dev_driver_string(ab->dev));
		__assign_vstr(msg, vaf->fmt, vaf->va);
	),
	TP_printk(
		"%s %s %s",
		__get_str(driver),
		__get_str(device),
		__get_str(msg)
	)
);

DEFINE_EVENT(ath11k_log_event, ath11k_log_err,
	     TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
	     TP_ARGS(ab, vaf)
);

DEFINE_EVENT(ath11k_log_event, ath11k_log_warn,
	     TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
	     TP_ARGS(ab, vaf)
);

DEFINE_EVENT(ath11k_log_event, ath11k_log_info,
	     TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
	     TP_ARGS(ab, vaf)
);

TRACE_EVENT(ath11k_wmi_cmd,
	    TP_PROTO(struct ath11k_base *ab, int id, const void *buf, size_t buf_len),

	TP_ARGS(ab, id, buf, buf_len),

	TP_STRUCT__entry(
		__string(device, dev_name(ab->dev))
		__string(driver, dev_driver_string(ab->dev))
		__field(unsigned int, id)
		__field(size_t, buf_len)
		__dynamic_array(u8, buf, buf_len)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ab->dev));
		__assign_str(driver, dev_driver_string(ab->dev));
		__entry->id = id;
		__entry->buf_len = buf_len;
		memcpy(__get_dynamic_array(buf), buf, buf_len);
	),

	TP_printk(
		"%s %s id %d len %zu",
		__get_str(driver),
		__get_str(device),
		__entry->id,
		__entry->buf_len
	 )
);

TRACE_EVENT(ath11k_wmi_event,
	    TP_PROTO(struct ath11k_base *ab, int id, const void *buf, size_t buf_len),

	TP_ARGS(ab, id, buf, buf_len),

	TP_STRUCT__entry(
		__string(device, dev_name(ab->dev))
		__string(driver, dev_driver_string(ab->dev))
		__field(unsigned int, id)
		__field(size_t, buf_len)
		__dynamic_array(u8, buf, buf_len)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ab->dev));
		__assign_str(driver, dev_driver_string(ab->dev));
		__entry->id = id;
		__entry->buf_len = buf_len;
		memcpy(__get_dynamic_array(buf), buf, buf_len);
	),

	TP_printk(
		"%s %s id %d len %zu",
		__get_str(driver),
		__get_str(device),
		__entry->id,
		__entry->buf_len
	)
);

TRACE_EVENT(ath11k_log_dbg,
	    TP_PROTO(struct ath11k_base *ab, unsigned int level, struct va_format *vaf),

	TP_ARGS(ab, level, vaf),

	TP_STRUCT__entry(
		__string(device, dev_name(ab->dev))
		__string(driver, dev_driver_string(ab->dev))
		__field(unsigned int, level)
		__dynamic_array(char, msg, ATH11K_MSG_MAX)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ab->dev));
		__assign_str(driver, dev_driver_string(ab->dev));
		__entry->level = level;
		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
				       ATH11K_MSG_MAX, vaf->fmt,
				       *vaf->va) >= ATH11K_MSG_MAX);
	),

	TP_printk(
		"%s %s %s",
		__get_str(driver),
		__get_str(device),
		__get_str(msg)
	)
);

TRACE_EVENT(ath11k_log_dbg_dump,
	    TP_PROTO(struct ath11k_base *ab, const char *msg, const char *prefix,
		     const void *buf, size_t buf_len),

	TP_ARGS(ab, msg, prefix, buf, buf_len),

	TP_STRUCT__entry(
		__string(device, dev_name(ab->dev))
		__string(driver, dev_driver_string(ab->dev))
		__string(msg, msg)
		__string(prefix, prefix)
		__field(size_t, buf_len)
		__dynamic_array(u8, buf, buf_len)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ab->dev));
		__assign_str(driver, dev_driver_string(ab->dev));
		__assign_str(msg, msg);
		__assign_str(prefix, prefix);
		__entry->buf_len = buf_len;
		memcpy(__get_dynamic_array(buf), buf, buf_len);
	),

	TP_printk(
		"%s %s %s/%s\n",
		__get_str(driver),
		__get_str(device),
		__get_str(prefix),
		__get_str(msg)
	)
);

TRACE_EVENT(ath11k_wmi_diag,
	    TP_PROTO(struct ath11k_base *ab, const void *data, size_t len),

	TP_ARGS(ab, data, len),

	TP_STRUCT__entry(
		__string(device, dev_name(ab->dev))
		__string(driver, dev_driver_string(ab->dev))
		__field(u16, len)
		__dynamic_array(u8, data, len)
	),

	TP_fast_assign(
		__assign_str(device, dev_name(ab->dev));
		__assign_str(driver, dev_driver_string(ab->dev));
		__entry->len = len;
		memcpy(__get_dynamic_array(data), data, len);
	),

	TP_printk(
		"%s %s tlv diag len %d",
		__get_str(driver),
		__get_str(device),
		__entry->len
	)
);

TRACE_EVENT(ath11k_ps_timekeeper,
	    TP_PROTO(struct ath11k *ar, const void *peer_addr,
		     u32 peer_ps_timestamp, u8 peer_ps_state),
	TP_ARGS(ar, peer_addr, peer_ps_timestamp, peer_ps_state),

	TP_STRUCT__entry(__string(device, dev_name(ar->ab->dev))
			 __string(driver, dev_driver_string(ar->ab->dev))
			 __dynamic_array(u8, peer_addr, ETH_ALEN)
			 __field(u8, peer_ps_state)
			 __field(u32, peer_ps_timestamp)
	),

	TP_fast_assign(__assign_str(device, dev_name(ar->ab->dev));
		       __assign_str(driver, dev_driver_string(ar->ab->dev));
		       memcpy(__get_dynamic_array(peer_addr), peer_addr,
			      ETH_ALEN);
		       __entry->peer_ps_state = peer_ps_state;
		       __entry->peer_ps_timestamp = peer_ps_timestamp;
	),

	TP_printk("%s %s %u %u",
		  __get_str(driver),
		  __get_str(device),
		  __entry->peer_ps_state,
		  __entry->peer_ps_timestamp
	)
);

#endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/

/* we don't want to use include/trace/events */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace

/* This part must be outside protection */
#include <trace/define_trace.h>