1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
7 #if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
9 #include <linux/tracepoint.h>
14 /* create empty functions when tracing is disabled */
15 #if !defined(CONFIG_ATH11K_TRACING)
17 #define TRACE_EVENT(name, proto, ...) \
18 static inline void trace_ ## name(proto) {} \
19 static inline bool trace_##name##_enabled(void) \
24 #undef DECLARE_EVENT_CLASS
25 #define DECLARE_EVENT_CLASS(...)
27 #define DEFINE_EVENT(evt_class, name, proto, ...) \
28 static inline void trace_ ## name(proto) {}
29 #endif /* !CONFIG_ATH11K_TRACING || __CHECKER__ */
32 #define TRACE_SYSTEM ath11k
34 #define ATH11K_MSG_MAX 400
36 TRACE_EVENT(ath11k_htt_pktlog
,
37 TP_PROTO(struct ath11k
*ar
, const void *buf
, u16 buf_len
,
40 TP_ARGS(ar
, buf
, buf_len
, pktlog_checksum
),
43 __string(device
, dev_name(ar
->ab
->dev
))
44 __string(driver
, dev_driver_string(ar
->ab
->dev
))
46 __field(u32
, pktlog_checksum
)
47 __dynamic_array(u8
, pktlog
, buf_len
)
53 __entry
->buf_len
= buf_len
;
54 __entry
->pktlog_checksum
= pktlog_checksum
;
55 memcpy(__get_dynamic_array(pktlog
), buf
, buf_len
);
59 "%s %s size %u pktlog_checksum %d",
63 __entry
->pktlog_checksum
67 TRACE_EVENT(ath11k_htt_ppdu_stats
,
68 TP_PROTO(struct ath11k
*ar
, const void *data
, size_t len
),
70 TP_ARGS(ar
, data
, len
),
73 __string(device
, dev_name(ar
->ab
->dev
))
74 __string(driver
, dev_driver_string(ar
->ab
->dev
))
76 __dynamic_array(u8
, ppdu
, len
)
83 memcpy(__get_dynamic_array(ppdu
), data
, len
);
94 TRACE_EVENT(ath11k_htt_rxdesc
,
95 TP_PROTO(struct ath11k
*ar
, const void *data
, size_t log_type
, size_t len
),
97 TP_ARGS(ar
, data
, log_type
, len
),
100 __string(device
, dev_name(ar
->ab
->dev
))
101 __string(driver
, dev_driver_string(ar
->ab
->dev
))
103 __field(u16
, log_type
)
104 __dynamic_array(u8
, rxdesc
, len
)
108 __assign_str(device
);
109 __assign_str(driver
);
111 __entry
->log_type
= log_type
;
112 memcpy(__get_dynamic_array(rxdesc
), data
, len
);
116 "%s %s rxdesc len %d type %d",
124 DECLARE_EVENT_CLASS(ath11k_log_event
,
125 TP_PROTO(struct ath11k_base
*ab
, struct va_format
*vaf
),
128 __string(device
, dev_name(ab
->dev
))
129 __string(driver
, dev_driver_string(ab
->dev
))
130 __vstring(msg
, vaf
->fmt
, vaf
->va
)
133 __assign_str(device
);
134 __assign_str(driver
);
135 __assign_vstr(msg
, vaf
->fmt
, vaf
->va
);
145 DEFINE_EVENT(ath11k_log_event
, ath11k_log_err
,
146 TP_PROTO(struct ath11k_base
*ab
, struct va_format
*vaf
),
150 DEFINE_EVENT(ath11k_log_event
, ath11k_log_warn
,
151 TP_PROTO(struct ath11k_base
*ab
, struct va_format
*vaf
),
155 DEFINE_EVENT(ath11k_log_event
, ath11k_log_info
,
156 TP_PROTO(struct ath11k_base
*ab
, struct va_format
*vaf
),
160 TRACE_EVENT(ath11k_wmi_cmd
,
161 TP_PROTO(struct ath11k_base
*ab
, int id
, const void *buf
, size_t buf_len
),
163 TP_ARGS(ab
, id
, buf
, buf_len
),
166 __string(device
, dev_name(ab
->dev
))
167 __string(driver
, dev_driver_string(ab
->dev
))
168 __field(unsigned int, id
)
169 __field(size_t, buf_len
)
170 __dynamic_array(u8
, buf
, buf_len
)
174 __assign_str(device
);
175 __assign_str(driver
);
177 __entry
->buf_len
= buf_len
;
178 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
182 "%s %s id %d len %zu",
190 TRACE_EVENT(ath11k_wmi_event
,
191 TP_PROTO(struct ath11k_base
*ab
, int id
, const void *buf
, size_t buf_len
),
193 TP_ARGS(ab
, id
, buf
, buf_len
),
196 __string(device
, dev_name(ab
->dev
))
197 __string(driver
, dev_driver_string(ab
->dev
))
198 __field(unsigned int, id
)
199 __field(size_t, buf_len
)
200 __dynamic_array(u8
, buf
, buf_len
)
204 __assign_str(device
);
205 __assign_str(driver
);
207 __entry
->buf_len
= buf_len
;
208 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
212 "%s %s id %d len %zu",
220 TRACE_EVENT(ath11k_log_dbg
,
221 TP_PROTO(struct ath11k_base
*ab
, unsigned int level
, struct va_format
*vaf
),
223 TP_ARGS(ab
, level
, vaf
),
226 __string(device
, dev_name(ab
->dev
))
227 __string(driver
, dev_driver_string(ab
->dev
))
228 __field(unsigned int, level
)
229 __dynamic_array(char, msg
, ATH11K_MSG_MAX
)
233 __assign_str(device
);
234 __assign_str(driver
);
235 __entry
->level
= level
;
236 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
237 ATH11K_MSG_MAX
, vaf
->fmt
,
238 *vaf
->va
) >= ATH11K_MSG_MAX
);
249 TRACE_EVENT(ath11k_log_dbg_dump
,
250 TP_PROTO(struct ath11k_base
*ab
, const char *msg
, const char *prefix
,
251 const void *buf
, size_t buf_len
),
253 TP_ARGS(ab
, msg
, prefix
, buf
, buf_len
),
256 __string(device
, dev_name(ab
->dev
))
257 __string(driver
, dev_driver_string(ab
->dev
))
259 __string(prefix
, prefix
)
260 __field(size_t, buf_len
)
261 __dynamic_array(u8
, buf
, buf_len
)
265 __assign_str(device
);
266 __assign_str(driver
);
268 __assign_str(prefix
);
269 __entry
->buf_len
= buf_len
;
270 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
282 TRACE_EVENT(ath11k_wmi_diag
,
283 TP_PROTO(struct ath11k_base
*ab
, const void *data
, size_t len
),
285 TP_ARGS(ab
, data
, len
),
288 __string(device
, dev_name(ab
->dev
))
289 __string(driver
, dev_driver_string(ab
->dev
))
291 __dynamic_array(u8
, data
, len
)
295 __assign_str(device
);
296 __assign_str(driver
);
298 memcpy(__get_dynamic_array(data
), data
, len
);
302 "%s %s tlv diag len %d",
309 TRACE_EVENT(ath11k_ps_timekeeper
,
310 TP_PROTO(struct ath11k
*ar
, const void *peer_addr
,
311 u32 peer_ps_timestamp
, u8 peer_ps_state
),
312 TP_ARGS(ar
, peer_addr
, peer_ps_timestamp
, peer_ps_state
),
314 TP_STRUCT__entry(__string(device
, dev_name(ar
->ab
->dev
))
315 __string(driver
, dev_driver_string(ar
->ab
->dev
))
316 __dynamic_array(u8
, peer_addr
, ETH_ALEN
)
317 __field(u8
, peer_ps_state
)
318 __field(u32
, peer_ps_timestamp
)
321 TP_fast_assign(__assign_str(device
);
322 __assign_str(driver
);
323 memcpy(__get_dynamic_array(peer_addr
), peer_addr
,
325 __entry
->peer_ps_state
= peer_ps_state
;
326 __entry
->peer_ps_timestamp
= peer_ps_timestamp
;
329 TP_printk("%s %s %u %u",
332 __entry
->peer_ps_state
,
333 __entry
->peer_ps_timestamp
337 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
339 /* we don't want to use include/trace/events */
340 #undef TRACE_INCLUDE_PATH
341 #define TRACE_INCLUDE_PATH .
342 #undef TRACE_INCLUDE_FILE
343 #define TRACE_INCLUDE_FILE trace
345 /* This part must be outside protection */
346 #include <trace/define_trace.h>