Linux 3.11-rc3
[cris-mirror.git] / drivers / net / wireless / ath / wil6210 / trace.h
blobeff1239be53adc93d1e9dcbe2ac290951e902e12
1 /*
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.
17 #undef TRACE_SYSTEM
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>
23 #include "wil6210.h"
24 #include "txrx.h"
26 /* create empty functions when tracing is disabled */
27 #if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
29 #undef TRACE_EVENT
30 #define TRACE_EVENT(name, proto, ...) \
31 static inline void trace_ ## name(proto) {}
32 #undef DECLARE_EVENT_CLASS
33 #define DECLARE_EVENT_CLASS(...)
34 #undef DEFINE_EVENT
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(u16 id, void *buf, u16 buf_len),
42 TP_ARGS(id, buf, buf_len),
44 TP_STRUCT__entry(
45 __field(u16, id)
46 __field(u16, buf_len)
47 __dynamic_array(u8, buf, buf_len)
50 TP_fast_assign(
51 __entry->id = id;
52 __entry->buf_len = buf_len;
53 memcpy(__get_dynamic_array(buf), buf, buf_len);
56 TP_printk(
57 "id 0x%04x len %d",
58 __entry->id, __entry->buf_len
62 DEFINE_EVENT(wil6210_wmi, wil6210_wmi_cmd,
63 TP_PROTO(u16 id, void *buf, u16 buf_len),
64 TP_ARGS(id, buf, buf_len)
67 DEFINE_EVENT(wil6210_wmi, wil6210_wmi_event,
68 TP_PROTO(u16 id, void *buf, u16 buf_len),
69 TP_ARGS(id, buf, buf_len)
72 #define WIL6210_MSG_MAX (200)
74 DECLARE_EVENT_CLASS(wil6210_log_event,
75 TP_PROTO(struct va_format *vaf),
76 TP_ARGS(vaf),
77 TP_STRUCT__entry(
78 __dynamic_array(char, msg, WIL6210_MSG_MAX)
80 TP_fast_assign(
81 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
82 WIL6210_MSG_MAX,
83 vaf->fmt,
84 *vaf->va) >= WIL6210_MSG_MAX);
86 TP_printk("%s", __get_str(msg))
89 DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
90 TP_PROTO(struct va_format *vaf),
91 TP_ARGS(vaf)
94 DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
95 TP_PROTO(struct va_format *vaf),
96 TP_ARGS(vaf)
99 DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
100 TP_PROTO(struct va_format *vaf),
101 TP_ARGS(vaf)
104 #define wil_pseudo_irq_cause(x) __print_flags(x, "|", \
105 {BIT_DMA_PSEUDO_CAUSE_RX, "Rx" }, \
106 {BIT_DMA_PSEUDO_CAUSE_TX, "Tx" }, \
107 {BIT_DMA_PSEUDO_CAUSE_MISC, "Misc" })
109 TRACE_EVENT(wil6210_irq_pseudo,
110 TP_PROTO(u32 x),
111 TP_ARGS(x),
112 TP_STRUCT__entry(
113 __field(u32, x)
115 TP_fast_assign(
116 __entry->x = x;
118 TP_printk("cause 0x%08x : %s", __entry->x,
119 wil_pseudo_irq_cause(__entry->x))
122 DECLARE_EVENT_CLASS(wil6210_irq,
123 TP_PROTO(u32 x),
124 TP_ARGS(x),
125 TP_STRUCT__entry(
126 __field(u32, x)
128 TP_fast_assign(
129 __entry->x = x;
131 TP_printk("cause 0x%08x", __entry->x)
134 DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
135 TP_PROTO(u32 x),
136 TP_ARGS(x)
139 DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
140 TP_PROTO(u32 x),
141 TP_ARGS(x)
144 DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
145 TP_PROTO(u32 x),
146 TP_ARGS(x)
149 DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
150 TP_PROTO(u32 x),
151 TP_ARGS(x)
154 TRACE_EVENT(wil6210_rx,
155 TP_PROTO(u16 index, struct vring_rx_desc *d),
156 TP_ARGS(index, d),
157 TP_STRUCT__entry(
158 __field(u16, index)
159 __field(unsigned int, len)
160 __field(u8, mid)
161 __field(u8, cid)
162 __field(u8, tid)
163 __field(u8, type)
164 __field(u8, subtype)
165 __field(u16, seq)
166 __field(u8, mcs)
168 TP_fast_assign(
169 __entry->index = index;
170 __entry->len = d->dma.length;
171 __entry->mid = wil_rxdesc_mid(d);
172 __entry->cid = wil_rxdesc_cid(d);
173 __entry->tid = wil_rxdesc_tid(d);
174 __entry->type = wil_rxdesc_ftype(d);
175 __entry->subtype = wil_rxdesc_subtype(d);
176 __entry->seq = wil_rxdesc_seq(d);
177 __entry->mcs = wil_rxdesc_mcs(d);
179 TP_printk("index %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x"
180 " type 0x%1x subtype 0x%1x", __entry->index, __entry->len,
181 __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
182 __entry->seq, __entry->type, __entry->subtype)
185 TRACE_EVENT(wil6210_tx,
186 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
187 TP_ARGS(vring, index, len, frags),
188 TP_STRUCT__entry(
189 __field(u8, vring)
190 __field(u8, frags)
191 __field(u16, index)
192 __field(unsigned int, len)
194 TP_fast_assign(
195 __entry->vring = vring;
196 __entry->frags = frags;
197 __entry->index = index;
198 __entry->len = len;
200 TP_printk("vring %d index %d len %d frags %d",
201 __entry->vring, __entry->index, __entry->len, __entry->frags)
204 TRACE_EVENT(wil6210_tx_done,
205 TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
206 TP_ARGS(vring, index, len, err),
207 TP_STRUCT__entry(
208 __field(u8, vring)
209 __field(u8, err)
210 __field(u16, index)
211 __field(unsigned int, len)
213 TP_fast_assign(
214 __entry->vring = vring;
215 __entry->index = index;
216 __entry->len = len;
217 __entry->err = err;
219 TP_printk("vring %d index %d len %d err 0x%02x",
220 __entry->vring, __entry->index, __entry->len,
221 __entry->err)
224 #endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
226 #if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
227 /* we don't want to use include/trace/events */
228 #undef TRACE_INCLUDE_PATH
229 #define TRACE_INCLUDE_PATH .
230 #undef TRACE_INCLUDE_FILE
231 #define TRACE_INCLUDE_FILE trace
233 /* This part must be outside protection */
234 #include <trace/define_trace.h>
235 #endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */