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 log_type, size_t len),
83 
84 	TP_ARGS(ar, data, log_type, 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 		__field(u16, log_type)
91 		__dynamic_array(u8, rxdesc, len)
92 	),
93 
94 	TP_fast_assign(
95 		__assign_str(device, dev_name(ar->ab->dev));
96 		__assign_str(driver, dev_driver_string(ar->ab->dev));
97 		__entry->len = len;
98 		__entry->log_type = log_type;
99 		memcpy(__get_dynamic_array(rxdesc), data, len);
100 	),
101 
102 	TP_printk(
103 		"%s %s rxdesc len %d type %d",
104 		__get_str(driver),
105 		__get_str(device),
106 		__entry->len,
107 		__entry->log_type
108 	 )
109 );
110 
111 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
112 
113 /* we don't want to use include/trace/events */
114 #undef TRACE_INCLUDE_PATH
115 #define TRACE_INCLUDE_PATH .
116 #undef TRACE_INCLUDE_FILE
117 #define TRACE_INCLUDE_FILE trace
118 
119 /* This part must be outside protection */
120 #include <trace/define_trace.h>
121