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 
26 	TP_ARGS(ar, buf, buf_len),
27 
28 	TP_STRUCT__entry(
29 		__string(device, dev_name(ar->ab->dev))
30 		__string(driver, dev_driver_string(ar->ab->dev))
31 		__field(u16, buf_len)
32 		__dynamic_array(u8, pktlog, buf_len)
33 	),
34 
35 	TP_fast_assign(
36 		__assign_str(device, dev_name(ar->ab->dev));
37 		__assign_str(driver, dev_driver_string(ar->ab->dev));
38 		__entry->buf_len = buf_len;
39 		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
40 	),
41 
42 	TP_printk(
43 		"%s %s size %hu",
44 		__get_str(driver),
45 		__get_str(device),
46 		__entry->buf_len
47 	 )
48 );
49 
50 TRACE_EVENT(ath11k_htt_ppdu_stats,
51 	    TP_PROTO(struct ath11k *ar, const void *data, size_t len),
52 
53 	TP_ARGS(ar, data, len),
54 
55 	TP_STRUCT__entry(
56 		__string(device, dev_name(ar->ab->dev))
57 		__string(driver, dev_driver_string(ar->ab->dev))
58 		__field(u16, len)
59 		__dynamic_array(u8, ppdu, len)
60 	),
61 
62 	TP_fast_assign(
63 		__assign_str(device, dev_name(ar->ab->dev));
64 		__assign_str(driver, dev_driver_string(ar->ab->dev));
65 		__entry->len = len;
66 		memcpy(__get_dynamic_array(ppdu), data, len);
67 	),
68 
69 	TP_printk(
70 		"%s %s ppdu len %d",
71 		__get_str(driver),
72 		__get_str(device),
73 		__entry->len
74 	 )
75 );
76 
77 TRACE_EVENT(ath11k_htt_rxdesc,
78 	    TP_PROTO(struct ath11k *ar, const void *data, size_t len),
79 
80 	TP_ARGS(ar, data, len),
81 
82 	TP_STRUCT__entry(
83 		__string(device, dev_name(ar->ab->dev))
84 		__string(driver, dev_driver_string(ar->ab->dev))
85 		__field(u16, len)
86 		__dynamic_array(u8, rxdesc, len)
87 	),
88 
89 	TP_fast_assign(
90 		__assign_str(device, dev_name(ar->ab->dev));
91 		__assign_str(driver, dev_driver_string(ar->ab->dev));
92 		__entry->len = len;
93 		memcpy(__get_dynamic_array(rxdesc), data, len);
94 	),
95 
96 	TP_printk(
97 		"%s %s rxdesc len %d",
98 		__get_str(driver),
99 		__get_str(device),
100 		__entry->len
101 	 )
102 );
103 
104 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
105 
106 /* we don't want to use include/trace/events */
107 #undef TRACE_INCLUDE_PATH
108 #define TRACE_INCLUDE_PATH .
109 #undef TRACE_INCLUDE_FILE
110 #define TRACE_INCLUDE_FILE trace
111 
112 /* This part must be outside protection */
113 #include <trace/define_trace.h>
114