Linux Audio

Check our new training course

Loading...
v6.8
  1/* SPDX-License-Identifier: ISC */
  2/*
  3 * Copyright (c) 2013-2016 Qualcomm Atheros, Inc.
  4 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#undef TRACE_SYSTEM
  8#define TRACE_SYSTEM wil6210
  9#if !defined(WIL6210_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
 10#define WIL6210_TRACE_H
 11
 12#include <linux/tracepoint.h>
 13#include "wil6210.h"
 14#include "txrx.h"
 15
 16/* create empty functions when tracing is disabled */
 17#if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
 18
 19#undef TRACE_EVENT
 20#define TRACE_EVENT(name, proto, ...) \
 21static inline void trace_ ## name(proto) {}
 22#undef DECLARE_EVENT_CLASS
 23#define DECLARE_EVENT_CLASS(...)
 24#undef DEFINE_EVENT
 25#define DEFINE_EVENT(evt_class, name, proto, ...) \
 26static inline void trace_ ## name(proto) {}
 27#endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */
 28
 29DECLARE_EVENT_CLASS(wil6210_wmi,
 30	TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
 31
 32	TP_ARGS(wmi, buf, buf_len),
 33
 34	TP_STRUCT__entry(
 35		__field(u8, mid)
 36		__field(u16, command_id)
 37		__field(u32, fw_timestamp)
 38		__field(u16, buf_len)
 39		__dynamic_array(u8, buf, buf_len)
 40	),
 41
 42	TP_fast_assign(
 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);
 48	),
 49
 50	TP_printk(
 51		"MID %d id 0x%04x len %d timestamp %d",
 52		__entry->mid, __entry->command_id, __entry->buf_len,
 53		__entry->fw_timestamp
 54	)
 55);
 56
 57DEFINE_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)
 60);
 61
 62DEFINE_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)
 65);
 66
 67#define WIL6210_MSG_MAX (200)
 68
 69DECLARE_EVENT_CLASS(wil6210_log_event,
 70	TP_PROTO(struct va_format *vaf),
 71	TP_ARGS(vaf),
 72	TP_STRUCT__entry(
 73		__vstring(msg, vaf->fmt, vaf->va)
 74	),
 75	TP_fast_assign(
 76		__assign_vstr(msg, vaf->fmt, vaf->va);
 
 
 
 77	),
 78	TP_printk("%s", __get_str(msg))
 79);
 80
 81DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
 82	TP_PROTO(struct va_format *vaf),
 83	TP_ARGS(vaf)
 84);
 85
 86DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
 87	TP_PROTO(struct va_format *vaf),
 88	TP_ARGS(vaf)
 89);
 90
 91DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
 92	TP_PROTO(struct va_format *vaf),
 93	TP_ARGS(vaf)
 94);
 95
 96#define wil_pseudo_irq_cause(x) __print_flags(x, "|",	\
 97	{BIT_DMA_PSEUDO_CAUSE_RX,	"Rx" },		\
 98	{BIT_DMA_PSEUDO_CAUSE_TX,	"Tx" },		\
 99	{BIT_DMA_PSEUDO_CAUSE_MISC,	"Misc" })
100
101TRACE_EVENT(wil6210_irq_pseudo,
102	TP_PROTO(u32 x),
103	TP_ARGS(x),
104	TP_STRUCT__entry(
105		__field(u32, x)
106	),
107	TP_fast_assign(
108		__entry->x = x;
109	),
110	TP_printk("cause 0x%08x : %s", __entry->x,
111		  wil_pseudo_irq_cause(__entry->x))
112);
113
114DECLARE_EVENT_CLASS(wil6210_irq,
115	TP_PROTO(u32 x),
116	TP_ARGS(x),
117	TP_STRUCT__entry(
118		__field(u32, x)
119	),
120	TP_fast_assign(
121		__entry->x = x;
122	),
123	TP_printk("cause 0x%08x", __entry->x)
124);
125
126DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
127	TP_PROTO(u32 x),
128	TP_ARGS(x)
129);
130
131DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
132	TP_PROTO(u32 x),
133	TP_ARGS(x)
134);
135
136DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
137	TP_PROTO(u32 x),
138	TP_ARGS(x)
139);
140
141DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
142	TP_PROTO(u32 x),
143	TP_ARGS(x)
144);
145
146TRACE_EVENT(wil6210_rx,
147	TP_PROTO(u16 index, struct vring_rx_desc *d),
148	TP_ARGS(index, d),
149	TP_STRUCT__entry(
150		__field(u16, index)
151		__field(unsigned int, len)
152		__field(u8, mid)
153		__field(u8, cid)
154		__field(u8, tid)
155		__field(u8, type)
156		__field(u8, subtype)
157		__field(u16, seq)
158		__field(u8, mcs)
159	),
160	TP_fast_assign(
161		__entry->index = index;
162		__entry->len = d->dma.length;
163		__entry->mid = wil_rxdesc_mid(d);
164		__entry->cid = wil_rxdesc_cid(d);
165		__entry->tid = wil_rxdesc_tid(d);
166		__entry->type = wil_rxdesc_ftype(d);
167		__entry->subtype = wil_rxdesc_subtype(d);
168		__entry->seq = wil_rxdesc_seq(d);
169		__entry->mcs = wil_rxdesc_mcs(d);
170	),
171	TP_printk("index %d len %d mid %d cid (%%8) %d tid %d mcs %d seq 0x%03x"
172		  " type 0x%1x subtype 0x%1x", __entry->index, __entry->len,
173		  __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
174		  __entry->seq, __entry->type, __entry->subtype)
175);
176
177TRACE_EVENT(wil6210_rx_status,
178	    TP_PROTO(struct wil6210_priv *wil, u8 use_compressed, u16 buff_id,
179		     void *msg),
180	    TP_ARGS(wil, use_compressed, buff_id, msg),
181	    TP_STRUCT__entry(__field(u8, use_compressed)
182			     __field(u16, buff_id)
183			     __field(unsigned int, len)
184			     __field(u8, mid)
185			     __field(u8, cid)
186			     __field(u8, tid)
187			     __field(u8, type)
188			     __field(u8, subtype)
189			     __field(u16, seq)
190			     __field(u8, mcs)
191	    ),
192	    TP_fast_assign(__entry->use_compressed = use_compressed;
193			   __entry->buff_id = buff_id;
194			   __entry->len = wil_rx_status_get_length(msg);
195			   __entry->mid = wil_rx_status_get_mid(msg);
196			   __entry->cid = wil_rx_status_get_cid(msg);
197			   __entry->tid = wil_rx_status_get_tid(msg);
198			   __entry->type = wil_rx_status_get_frame_type(wil,
199									msg);
200			   __entry->subtype = wil_rx_status_get_fc1(wil, msg);
201			   __entry->seq = wil_rx_status_get_seq(wil, msg);
202			   __entry->mcs = wil_rx_status_get_mcs(msg);
203	    ),
204	    TP_printk(
205		      "compressed %d buff_id %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x type 0x%1x subtype 0x%1x",
206		      __entry->use_compressed, __entry->buff_id, __entry->len,
207		      __entry->mid, __entry->cid, __entry->tid, __entry->mcs,
208		      __entry->seq, __entry->type, __entry->subtype)
209);
210
211TRACE_EVENT(wil6210_tx,
212	TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
213	TP_ARGS(vring, index, len, frags),
214	TP_STRUCT__entry(
215		__field(u8, vring)
216		__field(u8, frags)
217		__field(u16, index)
218		__field(unsigned int, len)
219	),
220	TP_fast_assign(
221		__entry->vring = vring;
222		__entry->frags = frags;
223		__entry->index = index;
224		__entry->len = len;
225	),
226	TP_printk("vring %d index %d len %d frags %d",
227		  __entry->vring, __entry->index, __entry->len, __entry->frags)
228);
229
230TRACE_EVENT(wil6210_tx_done,
231	TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
232	TP_ARGS(vring, index, len, err),
233	TP_STRUCT__entry(
234		__field(u8, vring)
235		__field(u8, err)
236		__field(u16, index)
237		__field(unsigned int, len)
238	),
239	TP_fast_assign(
240		__entry->vring = vring;
241		__entry->index = index;
242		__entry->len = len;
243		__entry->err = err;
244	),
245	TP_printk("vring %d index %d len %d err 0x%02x",
246		  __entry->vring, __entry->index, __entry->len,
247		  __entry->err)
248);
249
250TRACE_EVENT(wil6210_tx_status,
251	    TP_PROTO(struct wil_ring_tx_status *msg, u16 index,
252		     unsigned int len),
253	    TP_ARGS(msg, index, len),
254	    TP_STRUCT__entry(__field(u16, index)
255			     __field(unsigned int, len)
256			     __field(u8, num_descs)
257			     __field(u8, ring_id)
258			     __field(u8, status)
259			     __field(u8, mcs)
260
261	    ),
262	    TP_fast_assign(__entry->index = index;
263			   __entry->len = len;
264			   __entry->num_descs = msg->num_descriptors;
265			   __entry->ring_id = msg->ring_id;
266			   __entry->status = msg->status;
267			   __entry->mcs = wil_tx_status_get_mcs(msg);
268	    ),
269	    TP_printk(
270		      "ring_id %d swtail 0x%x len %d num_descs %d status 0x%x mcs %d",
271		      __entry->ring_id, __entry->index, __entry->len,
272		      __entry->num_descs, __entry->status, __entry->mcs)
273);
274
275#endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
276
277#if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
278/* we don't want to use include/trace/events */
279#undef TRACE_INCLUDE_PATH
280#define TRACE_INCLUDE_PATH .
281#undef TRACE_INCLUDE_FILE
282#define TRACE_INCLUDE_FILE trace
283
284/* This part must be outside protection */
285#include <trace/define_trace.h>
286#endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */
v4.10.11
 
  1/*
  2 * Copyright (c) 2013-2016 Qualcomm Atheros, Inc.
  3 *
  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.
  7 *
  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.
 15 */
 16
 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
 21
 22#include <linux/tracepoint.h>
 23#include "wil6210.h"
 24#include "txrx.h"
 25
 26/* create empty functions when tracing is disabled */
 27#if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__)
 28
 29#undef TRACE_EVENT
 30#define TRACE_EVENT(name, proto, ...) \
 31static 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, ...) \
 36static inline void trace_ ## name(proto) {}
 37#endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */
 38
 39DECLARE_EVENT_CLASS(wil6210_wmi,
 40	TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len),
 41
 42	TP_ARGS(wmi, buf, buf_len),
 43
 44	TP_STRUCT__entry(
 45		__field(u8, mid)
 46		__field(u16, command_id)
 47		__field(u32, fw_timestamp)
 48		__field(u16, buf_len)
 49		__dynamic_array(u8, buf, buf_len)
 50	),
 51
 52	TP_fast_assign(
 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);
 58	),
 59
 60	TP_printk(
 61		"MID %d id 0x%04x len %d timestamp %d",
 62		__entry->mid, __entry->command_id, __entry->buf_len,
 63		__entry->fw_timestamp
 64	)
 65);
 66
 67DEFINE_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)
 70);
 71
 72DEFINE_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)
 75);
 76
 77#define WIL6210_MSG_MAX (200)
 78
 79DECLARE_EVENT_CLASS(wil6210_log_event,
 80	TP_PROTO(struct va_format *vaf),
 81	TP_ARGS(vaf),
 82	TP_STRUCT__entry(
 83		__dynamic_array(char, msg, WIL6210_MSG_MAX)
 84	),
 85	TP_fast_assign(
 86		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
 87				       WIL6210_MSG_MAX,
 88				       vaf->fmt,
 89				       *vaf->va) >= WIL6210_MSG_MAX);
 90	),
 91	TP_printk("%s", __get_str(msg))
 92);
 93
 94DEFINE_EVENT(wil6210_log_event, wil6210_log_err,
 95	TP_PROTO(struct va_format *vaf),
 96	TP_ARGS(vaf)
 97);
 98
 99DEFINE_EVENT(wil6210_log_event, wil6210_log_info,
100	TP_PROTO(struct va_format *vaf),
101	TP_ARGS(vaf)
102);
103
104DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg,
105	TP_PROTO(struct va_format *vaf),
106	TP_ARGS(vaf)
107);
108
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" })
113
114TRACE_EVENT(wil6210_irq_pseudo,
115	TP_PROTO(u32 x),
116	TP_ARGS(x),
117	TP_STRUCT__entry(
118		__field(u32, x)
119	),
120	TP_fast_assign(
121		__entry->x = x;
122	),
123	TP_printk("cause 0x%08x : %s", __entry->x,
124		  wil_pseudo_irq_cause(__entry->x))
125);
126
127DECLARE_EVENT_CLASS(wil6210_irq,
128	TP_PROTO(u32 x),
129	TP_ARGS(x),
130	TP_STRUCT__entry(
131		__field(u32, x)
132	),
133	TP_fast_assign(
134		__entry->x = x;
135	),
136	TP_printk("cause 0x%08x", __entry->x)
137);
138
139DEFINE_EVENT(wil6210_irq, wil6210_irq_rx,
140	TP_PROTO(u32 x),
141	TP_ARGS(x)
142);
143
144DEFINE_EVENT(wil6210_irq, wil6210_irq_tx,
145	TP_PROTO(u32 x),
146	TP_ARGS(x)
147);
148
149DEFINE_EVENT(wil6210_irq, wil6210_irq_misc,
150	TP_PROTO(u32 x),
151	TP_ARGS(x)
152);
153
154DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread,
155	TP_PROTO(u32 x),
156	TP_ARGS(x)
157);
158
159TRACE_EVENT(wil6210_rx,
160	TP_PROTO(u16 index, struct vring_rx_desc *d),
161	TP_ARGS(index, d),
162	TP_STRUCT__entry(
163		__field(u16, index)
164		__field(unsigned int, len)
165		__field(u8, mid)
166		__field(u8, cid)
167		__field(u8, tid)
168		__field(u8, type)
169		__field(u8, subtype)
170		__field(u16, seq)
171		__field(u8, mcs)
172	),
173	TP_fast_assign(
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);
183	),
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)
188);
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190TRACE_EVENT(wil6210_tx,
191	TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags),
192	TP_ARGS(vring, index, len, frags),
193	TP_STRUCT__entry(
194		__field(u8, vring)
195		__field(u8, frags)
196		__field(u16, index)
197		__field(unsigned int, len)
198	),
199	TP_fast_assign(
200		__entry->vring = vring;
201		__entry->frags = frags;
202		__entry->index = index;
203		__entry->len = len;
204	),
205	TP_printk("vring %d index %d len %d frags %d",
206		  __entry->vring, __entry->index, __entry->len, __entry->frags)
207);
208
209TRACE_EVENT(wil6210_tx_done,
210	TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err),
211	TP_ARGS(vring, index, len, err),
212	TP_STRUCT__entry(
213		__field(u8, vring)
214		__field(u8, err)
215		__field(u16, index)
216		__field(unsigned int, len)
217	),
218	TP_fast_assign(
219		__entry->vring = vring;
220		__entry->index = index;
221		__entry->len = len;
222		__entry->err = err;
223	),
224	TP_printk("vring %d index %d len %d err 0x%02x",
225		  __entry->vring, __entry->index, __entry->len,
226		  __entry->err)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227);
228
229#endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/
230
231#if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__)
232/* we don't want to use include/trace/events */
233#undef TRACE_INCLUDE_PATH
234#define TRACE_INCLUDE_PATH .
235#undef TRACE_INCLUDE_FILE
236#define TRACE_INCLUDE_FILE trace
237
238/* This part must be outside protection */
239#include <trace/define_trace.h>
240#endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */