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(u16 id
, void *buf
, u16 buf_len
),
42 TP_ARGS(id
, buf
, buf_len
),
47 __dynamic_array(u8
, buf
, buf_len
)
52 __entry
->buf_len
= buf_len
;
53 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
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
),
78 __dynamic_array(char, msg
, WIL6210_MSG_MAX
)
81 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
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
),
94 DEFINE_EVENT(wil6210_log_event
, wil6210_log_info
,
95 TP_PROTO(struct va_format
*vaf
),
99 DEFINE_EVENT(wil6210_log_event
, wil6210_log_dbg
,
100 TP_PROTO(struct va_format
*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
,
118 TP_printk("cause 0x%08x : %s", __entry
->x
,
119 wil_pseudo_irq_cause(__entry
->x
))
122 DECLARE_EVENT_CLASS(wil6210_irq
,
131 TP_printk("cause 0x%08x", __entry
->x
)
134 DEFINE_EVENT(wil6210_irq
, wil6210_irq_rx
,
139 DEFINE_EVENT(wil6210_irq
, wil6210_irq_tx
,
144 DEFINE_EVENT(wil6210_irq
, wil6210_irq_misc
,
149 DEFINE_EVENT(wil6210_irq
, wil6210_irq_misc_thread
,
154 TRACE_EVENT(wil6210_rx
,
155 TP_PROTO(u16 index
, struct vring_rx_desc
*d
),
159 __field(unsigned int, len
)
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
),
192 __field(unsigned int, len
)
195 __entry
->vring
= vring
;
196 __entry
->frags
= frags
;
197 __entry
->index
= index
;
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
),
211 __field(unsigned int, len
)
214 __entry
->vring
= vring
;
215 __entry
->index
= index
;
219 TP_printk("vring %d index %d len %d err 0x%02x",
220 __entry
->vring
, __entry
->index
, __entry
->len
,
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__) */