2 * Copyright (c) 2013 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 wil6210_mbox_hdr_wmi *wmi, void *buf, u16 buf_len),
42 TP_ARGS(wmi, buf, buf_len),
47 __field(u32, timestamp)
49 __dynamic_array(u8, buf, buf_len)
53 __entry->mid = wmi->mid;
54 __entry->id = le16_to_cpu(wmi->id);
55 __entry->timestamp = le32_to_cpu(wmi->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->id, __entry->buf_len, __entry->timestamp
66 DEFINE_EVENT(wil6210_wmi, wil6210_wmi_cmd,
67 TP_PROTO(struct wil6210_mbox_hdr_wmi *wmi, void *buf, u16 buf_len),
68 TP_ARGS(wmi, buf, buf_len)
71 DEFINE_EVENT(wil6210_wmi, wil6210_wmi_event,
72 TP_PROTO(struct wil6210_mbox_hdr_wmi *wmi, void *buf, u16 buf_len),
73 TP_ARGS(wmi, buf, buf_len)
76 #define WIL6210_MSG_MAX (200)
78 DECLARE_EVENT_CLASS(wil6210_log_event,
79 TP_PROTO(struct va_format *vaf),
82 __dynamic_array(char, msg, WIL6210_MSG_MAX)
85 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
88 *vaf->va) >= WIL6210_MSG_MAX);
90 TP_printk("%s", __get_str(msg))
93 DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
94 TP_PROTO(struct va_format *vaf),
98 DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
99 TP_PROTO(struct va_format *vaf),
103 DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
104 TP_PROTO(struct va_format *vaf),
108 #define wil_pseudo_irq_cause(x) __print_flags(x, "|", \
109 {BIT_DMA_PSEUDO_CAUSE_RX, "Rx" }, \
110 {BIT_DMA_PSEUDO_CAUSE_TX, "Tx" }, \
111 {BIT_DMA_PSEUDO_CAUSE_MISC, "Misc" })
113 TRACE_EVENT(wil6210_irq_pseudo,
122 TP_printk("cause 0x%08x : %s", __entry->x,
123 wil_pseudo_irq_cause(__entry->x))
126 DECLARE_EVENT_CLASS(wil6210_irq,
135 TP_printk("cause 0x%08x", __entry->x)
138 DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
143 DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
148 DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
153 DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
158 TRACE_EVENT(wil6210_rx,
159 TP_PROTO(u16 index, struct vring_rx_desc *d),
163 __field(unsigned int, len)
173 __entry->index = index;
174 __entry->len = d->dma.length;
175 __entry->mid = wil_rxdesc_mid(d);
176 __entry->cid = wil_rxdesc_cid(d);
177 __entry->tid = wil_rxdesc_tid(d);
178 __entry->type = wil_rxdesc_ftype(d);
179 __entry->subtype = wil_rxdesc_subtype(d);
180 __entry->seq = wil_rxdesc_seq(d);
181 __entry->mcs = wil_rxdesc_mcs(d);
183 TP_printk("index %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x"
184 " type 0x%1x subtype 0x%1x", __entry->index, __entry->len,
185 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
186 __entry->seq, __entry->type, __entry->subtype)
189 TRACE_EVENT(wil6210_tx,
190 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
191 TP_ARGS(vring, index, len, frags),
196 __field(unsigned int, len)
199 __entry->vring = vring;
200 __entry->frags = frags;
201 __entry->index = index;
204 TP_printk("vring %d index %d len %d frags %d",
205 __entry->vring, __entry->index, __entry->len, __entry->frags)
208 TRACE_EVENT(wil6210_tx_done,
209 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
210 TP_ARGS(vring, index, len, err),
215 __field(unsigned int, len)
218 __entry->vring = vring;
219 __entry->index = index;
223 TP_printk("vring %d index %d len %d err 0x%02x",
224 __entry->vring, __entry->index, __entry->len,
228 #endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
230 #if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
231 /* we don't want to use include/trace/events */
232 #undef TRACE_INCLUDE_PATH
233 #define TRACE_INCLUDE_PATH .
234 #undef TRACE_INCLUDE_FILE
235 #define TRACE_INCLUDE_FILE trace
237 /* This part must be outside protection */
238 #include <trace/define_trace.h>
239 #endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */