1 /* SPDX-License-Identifier: ISC */
3 * Copyright (c) 2013-2016 Qualcomm Atheros, Inc.
4 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
8 #define TRACE_SYSTEM wil6210
9 #if !defined(WIL6210_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define WIL6210_TRACE_H
12 #include <linux/tracepoint.h>
16 /* create empty functions when tracing is disabled */
17 #if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
20 #define TRACE_EVENT(name, proto, ...) \
21 static inline void trace_ ## name(proto) {}
22 #undef DECLARE_EVENT_CLASS
23 #define DECLARE_EVENT_CLASS(...)
25 #define DEFINE_EVENT(evt_class, name, proto, ...) \
26 static inline void trace_ ## name(proto) {}
27 #endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */
29 DECLARE_EVENT_CLASS(wil6210_wmi
,
30 TP_PROTO(struct wmi_cmd_hdr
*wmi
, void *buf
, u16 buf_len
),
32 TP_ARGS(wmi
, buf
, buf_len
),
36 __field(u16
, command_id
)
37 __field(u32
, fw_timestamp
)
39 __dynamic_array(u8
, buf
, buf_len
)
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
);
51 "MID %d id 0x%04x len %d timestamp %d",
52 __entry
->mid
, __entry
->command_id
, __entry
->buf_len
,
57 DEFINE_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
)
62 DEFINE_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
)
67 #define WIL6210_MSG_MAX (200)
69 DECLARE_EVENT_CLASS(wil6210_log_event
,
70 TP_PROTO(struct va_format
*vaf
),
73 __dynamic_array(char, msg
, WIL6210_MSG_MAX
)
76 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
79 *vaf
->va
) >= WIL6210_MSG_MAX
);
81 TP_printk("%s", __get_str(msg
))
84 DEFINE_EVENT(wil6210_log_event
, wil6210_log_err
,
85 TP_PROTO(struct va_format
*vaf
),
89 DEFINE_EVENT(wil6210_log_event
, wil6210_log_info
,
90 TP_PROTO(struct va_format
*vaf
),
94 DEFINE_EVENT(wil6210_log_event
, wil6210_log_dbg
,
95 TP_PROTO(struct va_format
*vaf
),
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" })
104 TRACE_EVENT(wil6210_irq_pseudo
,
113 TP_printk("cause 0x%08x : %s", __entry
->x
,
114 wil_pseudo_irq_cause(__entry
->x
))
117 DECLARE_EVENT_CLASS(wil6210_irq
,
126 TP_printk("cause 0x%08x", __entry
->x
)
129 DEFINE_EVENT(wil6210_irq
, wil6210_irq_rx
,
134 DEFINE_EVENT(wil6210_irq
, wil6210_irq_tx
,
139 DEFINE_EVENT(wil6210_irq
, wil6210_irq_misc
,
144 DEFINE_EVENT(wil6210_irq
, wil6210_irq_misc_thread
,
149 TRACE_EVENT(wil6210_rx
,
150 TP_PROTO(u16 index
, struct vring_rx_desc
*d
),
154 __field(unsigned int, len
)
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
);
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
)
180 TRACE_EVENT(wil6210_rx_status
,
181 TP_PROTO(struct wil6210_priv
*wil
, u8 use_compressed
, u16 buff_id
,
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
)
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
,
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
);
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
)
214 TRACE_EVENT(wil6210_tx
,
215 TP_PROTO(u8 vring
, u16 index
, unsigned int len
, u8 frags
),
216 TP_ARGS(vring
, index
, len
, frags
),
221 __field(unsigned int, len
)
224 __entry
->vring
= vring
;
225 __entry
->frags
= frags
;
226 __entry
->index
= index
;
229 TP_printk("vring %d index %d len %d frags %d",
230 __entry
->vring
, __entry
->index
, __entry
->len
, __entry
->frags
)
233 TRACE_EVENT(wil6210_tx_done
,
234 TP_PROTO(u8 vring
, u16 index
, unsigned int len
, u8 err
),
235 TP_ARGS(vring
, index
, len
, err
),
240 __field(unsigned int, len
)
243 __entry
->vring
= vring
;
244 __entry
->index
= index
;
248 TP_printk("vring %d index %d len %d err 0x%02x",
249 __entry
->vring
, __entry
->index
, __entry
->len
,
253 TRACE_EVENT(wil6210_tx_status
,
254 TP_PROTO(struct wil_ring_tx_status
*msg
, u16 index
,
256 TP_ARGS(msg
, index
, len
),
257 TP_STRUCT__entry(__field(u16
, index
)
258 __field(unsigned int, len
)
259 __field(u8
, num_descs
)
265 TP_fast_assign(__entry
->index
= index
;
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
);
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
)
278 #endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
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
287 /* This part must be outside protection */
288 #include <trace/define_trace.h>
289 #endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */