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