2 * Copyright (c) 2013-2016 Qualcomm Atheros, Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #define TRACE_SYSTEM wil6210
19 #if !defined(WIL6210_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
20 #define WIL6210_TRACE_H
22 #include <linux/tracepoint.h>
26 /* create empty functions when tracing is disabled */
27 #if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
30 #define TRACE_EVENT(name, proto, ...) \
31 static inline void trace_ ## name(proto) {}
32 #undef DECLARE_EVENT_CLASS
33 #define DECLARE_EVENT_CLASS(...)
35 #define DEFINE_EVENT(evt_class, name, proto, ...) \
36 static inline void trace_ ## name(proto) {}
37 #endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */
39 DECLARE_EVENT_CLASS(wil6210_wmi,
40 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
42 TP_ARGS(wmi, buf, buf_len),
46 __field(u16, command_id)
47 __field(u32, fw_timestamp)
49 __dynamic_array(u8, buf, buf_len)
53 __entry->mid = wmi->mid;
54 __entry->command_id = le16_to_cpu(wmi->command_id);
55 __entry->fw_timestamp = le32_to_cpu(wmi->fw_timestamp);
56 __entry->buf_len = buf_len;
57 memcpy(__get_dynamic_array(buf), buf, buf_len);
61 "MID %d id 0x%04x len %d timestamp %d",
62 __entry->mid, __entry->command_id, __entry->buf_len,
67 DEFINE_EVENT(wil6210_wmi, wil6210_wmi_cmd,
68 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
69 TP_ARGS(wmi, buf, buf_len)
72 DEFINE_EVENT(wil6210_wmi, wil6210_wmi_event,
73 TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
74 TP_ARGS(wmi, buf, buf_len)
77 #define WIL6210_MSG_MAX (200)
79 DECLARE_EVENT_CLASS(wil6210_log_event,
80 TP_PROTO(struct va_format *vaf),
83 __dynamic_array(char, msg, WIL6210_MSG_MAX)
86 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
89 *vaf->va) >= WIL6210_MSG_MAX);
91 TP_printk("%s", __get_str(msg))
94 DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
95 TP_PROTO(struct va_format *vaf),
99 DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
100 TP_PROTO(struct va_format *vaf),
104 DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
105 TP_PROTO(struct va_format *vaf),
109 #define wil_pseudo_irq_cause(x) __print_flags(x, "|", \
110 {BIT_DMA_PSEUDO_CAUSE_RX, "Rx" }, \
111 {BIT_DMA_PSEUDO_CAUSE_TX, "Tx" }, \
112 {BIT_DMA_PSEUDO_CAUSE_MISC, "Misc" })
114 TRACE_EVENT(wil6210_irq_pseudo,
123 TP_printk("cause 0x%08x : %s", __entry->x,
124 wil_pseudo_irq_cause(__entry->x))
127 DECLARE_EVENT_CLASS(wil6210_irq,
136 TP_printk("cause 0x%08x", __entry->x)
139 DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
144 DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
149 DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
154 DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
159 TRACE_EVENT(wil6210_rx,
160 TP_PROTO(u16 index, struct vring_rx_desc *d),
164 __field(unsigned int, len)
174 __entry->index = index;
175 __entry->len = d->dma.length;
176 __entry->mid = wil_rxdesc_mid(d);
177 __entry->cid = wil_rxdesc_cid(d);
178 __entry->tid = wil_rxdesc_tid(d);
179 __entry->type = wil_rxdesc_ftype(d);
180 __entry->subtype = wil_rxdesc_subtype(d);
181 __entry->seq = wil_rxdesc_seq(d);
182 __entry->mcs = wil_rxdesc_mcs(d);
184 TP_printk("index %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x"
185 " type 0x%1x subtype 0x%1x", __entry->index, __entry->len,
186 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
187 __entry->seq, __entry->type, __entry->subtype)
190 TRACE_EVENT(wil6210_rx_status,
191 TP_PROTO(struct wil6210_priv *wil, u8 use_compressed, u16 buff_id,
193 TP_ARGS(wil, use_compressed, buff_id, msg),
194 TP_STRUCT__entry(__field(u8, use_compressed)
195 __field(u16, buff_id)
196 __field(unsigned int, len)
205 TP_fast_assign(__entry->use_compressed = use_compressed;
206 __entry->buff_id = buff_id;
207 __entry->len = wil_rx_status_get_length(msg);
208 __entry->mid = wil_rx_status_get_mid(msg);
209 __entry->cid = wil_rx_status_get_cid(msg);
210 __entry->tid = wil_rx_status_get_tid(msg);
211 __entry->type = wil_rx_status_get_frame_type(wil,
213 __entry->subtype = wil_rx_status_get_fc1(wil, msg);
214 __entry->seq = wil_rx_status_get_seq(wil, msg);
215 __entry->mcs = wil_rx_status_get_mcs(msg);
218 "compressed %d buff_id %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x type 0x%1x subtype 0x%1x",
219 __entry->use_compressed, __entry->buff_id, __entry->len,
220 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
221 __entry->seq, __entry->type, __entry->subtype)
224 TRACE_EVENT(wil6210_tx,
225 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
226 TP_ARGS(vring, index, len, frags),
231 __field(unsigned int, len)
234 __entry->vring = vring;
235 __entry->frags = frags;
236 __entry->index = index;
239 TP_printk("vring %d index %d len %d frags %d",
240 __entry->vring, __entry->index, __entry->len, __entry->frags)
243 TRACE_EVENT(wil6210_tx_done,
244 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
245 TP_ARGS(vring, index, len, err),
250 __field(unsigned int, len)
253 __entry->vring = vring;
254 __entry->index = index;
258 TP_printk("vring %d index %d len %d err 0x%02x",
259 __entry->vring, __entry->index, __entry->len,
263 TRACE_EVENT(wil6210_tx_status,
264 TP_PROTO(struct wil_ring_tx_status *msg, u16 index,
266 TP_ARGS(msg, index, len),
267 TP_STRUCT__entry(__field(u16, index)
268 __field(unsigned int, len)
269 __field(u8, num_descs)
275 TP_fast_assign(__entry->index = index;
277 __entry->num_descs = msg->num_descriptors;
278 __entry->ring_id = msg->ring_id;
279 __entry->status = msg->status;
280 __entry->mcs = wil_tx_status_get_mcs(msg);
283 "ring_id %d swtail 0x%x len %d num_descs %d status 0x%x mcs %d",
284 __entry->ring_id, __entry->index, __entry->len,
285 __entry->num_descs, __entry->status, __entry->mcs)
288 #endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
290 #if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
291 /* we don't want to use include/trace/events */
292 #undef TRACE_INCLUDE_PATH
293 #define TRACE_INCLUDE_PATH .
294 #undef TRACE_INCLUDE_FILE
295 #define TRACE_INCLUDE_FILE trace
297 /* This part must be outside protection */
298 #include <trace/define_trace.h>
299 #endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */