Loading...
1/* SPDX-License-Identifier: ISC */
2/*
3 * Copyright (c) 2013-2016 Qualcomm Atheros, Inc.
4 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
5 */
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM wil6210
9#if !defined(WIL6210_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10#define WIL6210_TRACE_H
11
12#include <linux/tracepoint.h>
13#include "wil6210.h"
14#include "txrx.h"
15
16/* create empty functions when tracing is disabled */
17#if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
18
19#undef TRACE_EVENT
20#define TRACE_EVENT(name, proto, ...) \
21static inline void trace_ ## name(proto) {}
22#undef DECLARE_EVENT_CLASS
23#define DECLARE_EVENT_CLASS(...)
24#undef DEFINE_EVENT
25#define DEFINE_EVENT(evt_class, name, proto, ...) \
26static inline void trace_ ## name(proto) {}
27#endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */
28
29DECLARE_EVENT_CLASS(wil6210_wmi,
30 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
31
32 TP_ARGS(wmi, buf, buf_len),
33
34 TP_STRUCT__entry(
35 __field(u8, mid)
36 __field(u16, command_id)
37 __field(u32, fw_timestamp)
38 __field(u16, buf_len)
39 __dynamic_array(u8, buf, buf_len)
40 ),
41
42 TP_fast_assign(
43 __entry->mid = wmi->mid;
44 __entry->command_id = le16_to_cpu(wmi->command_id);
45 __entry->fw_timestamp = le32_to_cpu(wmi->fw_timestamp);
46 __entry->buf_len = buf_len;
47 memcpy(__get_dynamic_array(buf), buf, buf_len);
48 ),
49
50 TP_printk(
51 "MID %d id 0x%04x len %d timestamp %d",
52 __entry->mid, __entry->command_id, __entry->buf_len,
53 __entry->fw_timestamp
54 )
55);
56
57DEFINE_EVENT(wil6210_wmi, wil6210_wmi_cmd,
58 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
59 TP_ARGS(wmi, buf, buf_len)
60);
61
62DEFINE_EVENT(wil6210_wmi, wil6210_wmi_event,
63 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
64 TP_ARGS(wmi, buf, buf_len)
65);
66
67#define WIL6210_MSG_MAX (200)
68
69DECLARE_EVENT_CLASS(wil6210_log_event,
70 TP_PROTO(struct va_format *vaf),
71 TP_ARGS(vaf),
72 TP_STRUCT__entry(
73 __dynamic_array(char, msg, WIL6210_MSG_MAX)
74 ),
75 TP_fast_assign(
76 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
77 WIL6210_MSG_MAX,
78 vaf->fmt,
79 *vaf->va) >= WIL6210_MSG_MAX);
80 ),
81 TP_printk("%s", __get_str(msg))
82);
83
84DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
85 TP_PROTO(struct va_format *vaf),
86 TP_ARGS(vaf)
87);
88
89DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
90 TP_PROTO(struct va_format *vaf),
91 TP_ARGS(vaf)
92);
93
94DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
95 TP_PROTO(struct va_format *vaf),
96 TP_ARGS(vaf)
97);
98
99#define wil_pseudo_irq_cause(x) __print_flags(x, "|", \
100 {BIT_DMA_PSEUDO_CAUSE_RX, "Rx" }, \
101 {BIT_DMA_PSEUDO_CAUSE_TX, "Tx" }, \
102 {BIT_DMA_PSEUDO_CAUSE_MISC, "Misc" })
103
104TRACE_EVENT(wil6210_irq_pseudo,
105 TP_PROTO(u32 x),
106 TP_ARGS(x),
107 TP_STRUCT__entry(
108 __field(u32, x)
109 ),
110 TP_fast_assign(
111 __entry->x = x;
112 ),
113 TP_printk("cause 0x%08x : %s", __entry->x,
114 wil_pseudo_irq_cause(__entry->x))
115);
116
117DECLARE_EVENT_CLASS(wil6210_irq,
118 TP_PROTO(u32 x),
119 TP_ARGS(x),
120 TP_STRUCT__entry(
121 __field(u32, x)
122 ),
123 TP_fast_assign(
124 __entry->x = x;
125 ),
126 TP_printk("cause 0x%08x", __entry->x)
127);
128
129DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
130 TP_PROTO(u32 x),
131 TP_ARGS(x)
132);
133
134DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
135 TP_PROTO(u32 x),
136 TP_ARGS(x)
137);
138
139DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
140 TP_PROTO(u32 x),
141 TP_ARGS(x)
142);
143
144DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
145 TP_PROTO(u32 x),
146 TP_ARGS(x)
147);
148
149TRACE_EVENT(wil6210_rx,
150 TP_PROTO(u16 index, struct vring_rx_desc *d),
151 TP_ARGS(index, d),
152 TP_STRUCT__entry(
153 __field(u16, index)
154 __field(unsigned int, len)
155 __field(u8, mid)
156 __field(u8, cid)
157 __field(u8, tid)
158 __field(u8, type)
159 __field(u8, subtype)
160 __field(u16, seq)
161 __field(u8, mcs)
162 ),
163 TP_fast_assign(
164 __entry->index = index;
165 __entry->len = d->dma.length;
166 __entry->mid = wil_rxdesc_mid(d);
167 __entry->cid = wil_rxdesc_cid(d);
168 __entry->tid = wil_rxdesc_tid(d);
169 __entry->type = wil_rxdesc_ftype(d);
170 __entry->subtype = wil_rxdesc_subtype(d);
171 __entry->seq = wil_rxdesc_seq(d);
172 __entry->mcs = wil_rxdesc_mcs(d);
173 ),
174 TP_printk("index %d len %d mid %d cid (%%8) %d tid %d mcs %d seq 0x%03x"
175 " type 0x%1x subtype 0x%1x", __entry->index, __entry->len,
176 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
177 __entry->seq, __entry->type, __entry->subtype)
178);
179
180TRACE_EVENT(wil6210_rx_status,
181 TP_PROTO(struct wil6210_priv *wil, u8 use_compressed, u16 buff_id,
182 void *msg),
183 TP_ARGS(wil, use_compressed, buff_id, msg),
184 TP_STRUCT__entry(__field(u8, use_compressed)
185 __field(u16, buff_id)
186 __field(unsigned int, len)
187 __field(u8, mid)
188 __field(u8, cid)
189 __field(u8, tid)
190 __field(u8, type)
191 __field(u8, subtype)
192 __field(u16, seq)
193 __field(u8, mcs)
194 ),
195 TP_fast_assign(__entry->use_compressed = use_compressed;
196 __entry->buff_id = buff_id;
197 __entry->len = wil_rx_status_get_length(msg);
198 __entry->mid = wil_rx_status_get_mid(msg);
199 __entry->cid = wil_rx_status_get_cid(msg);
200 __entry->tid = wil_rx_status_get_tid(msg);
201 __entry->type = wil_rx_status_get_frame_type(wil,
202 msg);
203 __entry->subtype = wil_rx_status_get_fc1(wil, msg);
204 __entry->seq = wil_rx_status_get_seq(wil, msg);
205 __entry->mcs = wil_rx_status_get_mcs(msg);
206 ),
207 TP_printk(
208 "compressed %d buff_id %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x type 0x%1x subtype 0x%1x",
209 __entry->use_compressed, __entry->buff_id, __entry->len,
210 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
211 __entry->seq, __entry->type, __entry->subtype)
212);
213
214TRACE_EVENT(wil6210_tx,
215 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
216 TP_ARGS(vring, index, len, frags),
217 TP_STRUCT__entry(
218 __field(u8, vring)
219 __field(u8, frags)
220 __field(u16, index)
221 __field(unsigned int, len)
222 ),
223 TP_fast_assign(
224 __entry->vring = vring;
225 __entry->frags = frags;
226 __entry->index = index;
227 __entry->len = len;
228 ),
229 TP_printk("vring %d index %d len %d frags %d",
230 __entry->vring, __entry->index, __entry->len, __entry->frags)
231);
232
233TRACE_EVENT(wil6210_tx_done,
234 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
235 TP_ARGS(vring, index, len, err),
236 TP_STRUCT__entry(
237 __field(u8, vring)
238 __field(u8, err)
239 __field(u16, index)
240 __field(unsigned int, len)
241 ),
242 TP_fast_assign(
243 __entry->vring = vring;
244 __entry->index = index;
245 __entry->len = len;
246 __entry->err = err;
247 ),
248 TP_printk("vring %d index %d len %d err 0x%02x",
249 __entry->vring, __entry->index, __entry->len,
250 __entry->err)
251);
252
253TRACE_EVENT(wil6210_tx_status,
254 TP_PROTO(struct wil_ring_tx_status *msg, u16 index,
255 unsigned int len),
256 TP_ARGS(msg, index, len),
257 TP_STRUCT__entry(__field(u16, index)
258 __field(unsigned int, len)
259 __field(u8, num_descs)
260 __field(u8, ring_id)
261 __field(u8, status)
262 __field(u8, mcs)
263
264 ),
265 TP_fast_assign(__entry->index = index;
266 __entry->len = len;
267 __entry->num_descs = msg->num_descriptors;
268 __entry->ring_id = msg->ring_id;
269 __entry->status = msg->status;
270 __entry->mcs = wil_tx_status_get_mcs(msg);
271 ),
272 TP_printk(
273 "ring_id %d swtail 0x%x len %d num_descs %d status 0x%x mcs %d",
274 __entry->ring_id, __entry->index, __entry->len,
275 __entry->num_descs, __entry->status, __entry->mcs)
276);
277
278#endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
279
280#if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
281/* we don't want to use include/trace/events */
282#undef TRACE_INCLUDE_PATH
283#define TRACE_INCLUDE_PATH .
284#undef TRACE_INCLUDE_FILE
285#define TRACE_INCLUDE_FILE trace
286
287/* This part must be outside protection */
288#include <trace/define_trace.h>
289#endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */
1/*
2 * Copyright (c) 2013-2016 Qualcomm Atheros, Inc.
3 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM wil6210
20#if !defined(WIL6210_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
21#define WIL6210_TRACE_H
22
23#include <linux/tracepoint.h>
24#include "wil6210.h"
25#include "txrx.h"
26
27/* create empty functions when tracing is disabled */
28#if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
29
30#undef TRACE_EVENT
31#define TRACE_EVENT(name, proto, ...) \
32static inline void trace_ ## name(proto) {}
33#undef DECLARE_EVENT_CLASS
34#define DECLARE_EVENT_CLASS(...)
35#undef DEFINE_EVENT
36#define DEFINE_EVENT(evt_class, name, proto, ...) \
37static inline void trace_ ## name(proto) {}
38#endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */
39
40DECLARE_EVENT_CLASS(wil6210_wmi,
41 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
42
43 TP_ARGS(wmi, buf, buf_len),
44
45 TP_STRUCT__entry(
46 __field(u8, mid)
47 __field(u16, command_id)
48 __field(u32, fw_timestamp)
49 __field(u16, buf_len)
50 __dynamic_array(u8, buf, buf_len)
51 ),
52
53 TP_fast_assign(
54 __entry->mid = wmi->mid;
55 __entry->command_id = le16_to_cpu(wmi->command_id);
56 __entry->fw_timestamp = le32_to_cpu(wmi->fw_timestamp);
57 __entry->buf_len = buf_len;
58 memcpy(__get_dynamic_array(buf), buf, buf_len);
59 ),
60
61 TP_printk(
62 "MID %d id 0x%04x len %d timestamp %d",
63 __entry->mid, __entry->command_id, __entry->buf_len,
64 __entry->fw_timestamp
65 )
66);
67
68DEFINE_EVENT(wil6210_wmi, wil6210_wmi_cmd,
69 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
70 TP_ARGS(wmi, buf, buf_len)
71);
72
73DEFINE_EVENT(wil6210_wmi, wil6210_wmi_event,
74 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
75 TP_ARGS(wmi, buf, buf_len)
76);
77
78#define WIL6210_MSG_MAX (200)
79
80DECLARE_EVENT_CLASS(wil6210_log_event,
81 TP_PROTO(struct va_format *vaf),
82 TP_ARGS(vaf),
83 TP_STRUCT__entry(
84 __dynamic_array(char, msg, WIL6210_MSG_MAX)
85 ),
86 TP_fast_assign(
87 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
88 WIL6210_MSG_MAX,
89 vaf->fmt,
90 *vaf->va) >= WIL6210_MSG_MAX);
91 ),
92 TP_printk("%s", __get_str(msg))
93);
94
95DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
96 TP_PROTO(struct va_format *vaf),
97 TP_ARGS(vaf)
98);
99
100DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
101 TP_PROTO(struct va_format *vaf),
102 TP_ARGS(vaf)
103);
104
105DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
106 TP_PROTO(struct va_format *vaf),
107 TP_ARGS(vaf)
108);
109
110#define wil_pseudo_irq_cause(x) __print_flags(x, "|", \
111 {BIT_DMA_PSEUDO_CAUSE_RX, "Rx" }, \
112 {BIT_DMA_PSEUDO_CAUSE_TX, "Tx" }, \
113 {BIT_DMA_PSEUDO_CAUSE_MISC, "Misc" })
114
115TRACE_EVENT(wil6210_irq_pseudo,
116 TP_PROTO(u32 x),
117 TP_ARGS(x),
118 TP_STRUCT__entry(
119 __field(u32, x)
120 ),
121 TP_fast_assign(
122 __entry->x = x;
123 ),
124 TP_printk("cause 0x%08x : %s", __entry->x,
125 wil_pseudo_irq_cause(__entry->x))
126);
127
128DECLARE_EVENT_CLASS(wil6210_irq,
129 TP_PROTO(u32 x),
130 TP_ARGS(x),
131 TP_STRUCT__entry(
132 __field(u32, x)
133 ),
134 TP_fast_assign(
135 __entry->x = x;
136 ),
137 TP_printk("cause 0x%08x", __entry->x)
138);
139
140DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
141 TP_PROTO(u32 x),
142 TP_ARGS(x)
143);
144
145DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
146 TP_PROTO(u32 x),
147 TP_ARGS(x)
148);
149
150DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
151 TP_PROTO(u32 x),
152 TP_ARGS(x)
153);
154
155DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
156 TP_PROTO(u32 x),
157 TP_ARGS(x)
158);
159
160TRACE_EVENT(wil6210_rx,
161 TP_PROTO(u16 index, struct vring_rx_desc *d),
162 TP_ARGS(index, d),
163 TP_STRUCT__entry(
164 __field(u16, index)
165 __field(unsigned int, len)
166 __field(u8, mid)
167 __field(u8, cid)
168 __field(u8, tid)
169 __field(u8, type)
170 __field(u8, subtype)
171 __field(u16, seq)
172 __field(u8, mcs)
173 ),
174 TP_fast_assign(
175 __entry->index = index;
176 __entry->len = d->dma.length;
177 __entry->mid = wil_rxdesc_mid(d);
178 __entry->cid = wil_rxdesc_cid(d);
179 __entry->tid = wil_rxdesc_tid(d);
180 __entry->type = wil_rxdesc_ftype(d);
181 __entry->subtype = wil_rxdesc_subtype(d);
182 __entry->seq = wil_rxdesc_seq(d);
183 __entry->mcs = wil_rxdesc_mcs(d);
184 ),
185 TP_printk("index %d len %d mid %d cid (%%8) %d tid %d mcs %d seq 0x%03x"
186 " type 0x%1x subtype 0x%1x", __entry->index, __entry->len,
187 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
188 __entry->seq, __entry->type, __entry->subtype)
189);
190
191TRACE_EVENT(wil6210_rx_status,
192 TP_PROTO(struct wil6210_priv *wil, u8 use_compressed, u16 buff_id,
193 void *msg),
194 TP_ARGS(wil, use_compressed, buff_id, msg),
195 TP_STRUCT__entry(__field(u8, use_compressed)
196 __field(u16, buff_id)
197 __field(unsigned int, len)
198 __field(u8, mid)
199 __field(u8, cid)
200 __field(u8, tid)
201 __field(u8, type)
202 __field(u8, subtype)
203 __field(u16, seq)
204 __field(u8, mcs)
205 ),
206 TP_fast_assign(__entry->use_compressed = use_compressed;
207 __entry->buff_id = buff_id;
208 __entry->len = wil_rx_status_get_length(msg);
209 __entry->mid = wil_rx_status_get_mid(msg);
210 __entry->cid = wil_rx_status_get_cid(msg);
211 __entry->tid = wil_rx_status_get_tid(msg);
212 __entry->type = wil_rx_status_get_frame_type(wil,
213 msg);
214 __entry->subtype = wil_rx_status_get_fc1(wil, msg);
215 __entry->seq = wil_rx_status_get_seq(wil, msg);
216 __entry->mcs = wil_rx_status_get_mcs(msg);
217 ),
218 TP_printk(
219 "compressed %d buff_id %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x type 0x%1x subtype 0x%1x",
220 __entry->use_compressed, __entry->buff_id, __entry->len,
221 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
222 __entry->seq, __entry->type, __entry->subtype)
223);
224
225TRACE_EVENT(wil6210_tx,
226 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
227 TP_ARGS(vring, index, len, frags),
228 TP_STRUCT__entry(
229 __field(u8, vring)
230 __field(u8, frags)
231 __field(u16, index)
232 __field(unsigned int, len)
233 ),
234 TP_fast_assign(
235 __entry->vring = vring;
236 __entry->frags = frags;
237 __entry->index = index;
238 __entry->len = len;
239 ),
240 TP_printk("vring %d index %d len %d frags %d",
241 __entry->vring, __entry->index, __entry->len, __entry->frags)
242);
243
244TRACE_EVENT(wil6210_tx_done,
245 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
246 TP_ARGS(vring, index, len, err),
247 TP_STRUCT__entry(
248 __field(u8, vring)
249 __field(u8, err)
250 __field(u16, index)
251 __field(unsigned int, len)
252 ),
253 TP_fast_assign(
254 __entry->vring = vring;
255 __entry->index = index;
256 __entry->len = len;
257 __entry->err = err;
258 ),
259 TP_printk("vring %d index %d len %d err 0x%02x",
260 __entry->vring, __entry->index, __entry->len,
261 __entry->err)
262);
263
264TRACE_EVENT(wil6210_tx_status,
265 TP_PROTO(struct wil_ring_tx_status *msg, u16 index,
266 unsigned int len),
267 TP_ARGS(msg, index, len),
268 TP_STRUCT__entry(__field(u16, index)
269 __field(unsigned int, len)
270 __field(u8, num_descs)
271 __field(u8, ring_id)
272 __field(u8, status)
273 __field(u8, mcs)
274
275 ),
276 TP_fast_assign(__entry->index = index;
277 __entry->len = len;
278 __entry->num_descs = msg->num_descriptors;
279 __entry->ring_id = msg->ring_id;
280 __entry->status = msg->status;
281 __entry->mcs = wil_tx_status_get_mcs(msg);
282 ),
283 TP_printk(
284 "ring_id %d swtail 0x%x len %d num_descs %d status 0x%x mcs %d",
285 __entry->ring_id, __entry->index, __entry->len,
286 __entry->num_descs, __entry->status, __entry->mcs)
287);
288
289#endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
290
291#if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
292/* we don't want to use include/trace/events */
293#undef TRACE_INCLUDE_PATH
294#define TRACE_INCLUDE_PATH .
295#undef TRACE_INCLUDE_FILE
296#define TRACE_INCLUDE_FILE trace
297
298/* This part must be outside protection */
299#include <trace/define_trace.h>
300#endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */