1 #if !defined(_ATH6KL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
3 #include <net/cfg80211.h>
4 #include <linux/skbuff.h>
5 #include <linux/tracepoint.h>
9 #if !defined(_ATH6KL_TRACE_H)
10 static inline unsigned int ath6kl_get_wmi_id(void *buf
, size_t buf_len
)
12 struct wmi_cmd_hdr
*hdr
= buf
;
14 if (buf_len
< sizeof(*hdr
))
17 return le16_to_cpu(hdr
->cmd_id
);
19 #endif /* __ATH6KL_TRACE_H */
21 #define _ATH6KL_TRACE_H
23 /* create empty functions when tracing is disabled */
24 #if !defined(CONFIG_ATH6KL_TRACING)
26 #define TRACE_EVENT(name, proto, ...) \
27 static inline void trace_ ## name(proto) {}
28 #undef DECLARE_EVENT_CLASS
29 #define DECLARE_EVENT_CLASS(...)
31 #define DEFINE_EVENT(evt_class, name, proto, ...) \
32 static inline void trace_ ## name(proto) {}
33 #endif /* !CONFIG_ATH6KL_TRACING || __CHECKER__ */
36 #define TRACE_SYSTEM ath6kl
38 TRACE_EVENT(ath6kl_wmi_cmd
,
39 TP_PROTO(void *buf
, size_t buf_len
),
41 TP_ARGS(buf
, buf_len
),
44 __field(unsigned int, id
)
45 __field(size_t, buf_len
)
46 __dynamic_array(u8
, buf
, buf_len
)
50 __entry
->id
= ath6kl_get_wmi_id(buf
, buf_len
);
51 __entry
->buf_len
= buf_len
;
52 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
57 __entry
->id
, __entry
->buf_len
61 TRACE_EVENT(ath6kl_wmi_event
,
62 TP_PROTO(void *buf
, size_t buf_len
),
64 TP_ARGS(buf
, buf_len
),
67 __field(unsigned int, id
)
68 __field(size_t, buf_len
)
69 __dynamic_array(u8
, buf
, buf_len
)
73 __entry
->id
= ath6kl_get_wmi_id(buf
, buf_len
);
74 __entry
->buf_len
= buf_len
;
75 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
80 __entry
->id
, __entry
->buf_len
84 TRACE_EVENT(ath6kl_sdio
,
85 TP_PROTO(unsigned int addr
, int flags
,
86 void *buf
, size_t buf_len
),
88 TP_ARGS(addr
, flags
, buf
, buf_len
),
91 __field(unsigned int, tx
)
92 __field(unsigned int, addr
)
94 __field(size_t, buf_len
)
95 __dynamic_array(u8
, buf
, buf_len
)
100 __entry
->flags
= flags
;
101 __entry
->buf_len
= buf_len
;
102 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
104 if (flags
& HIF_WRITE
)
111 "%s addr 0x%x flags 0x%x len %zd\n",
112 __entry
->tx
? "tx" : "rx",
119 TRACE_EVENT(ath6kl_sdio_scat
,
120 TP_PROTO(unsigned int addr
, int flags
, unsigned int total_len
,
121 unsigned int entries
, struct hif_scatter_item
*list
),
123 TP_ARGS(addr
, flags
, total_len
, entries
, list
),
126 __field(unsigned int, tx
)
127 __field(unsigned int, addr
)
129 __field(unsigned int, entries
)
130 __field(size_t, total_len
)
131 __dynamic_array(unsigned int, len_array
, entries
)
132 __dynamic_array(u8
, data
, total_len
)
136 unsigned int *len_array
;
140 __entry
->addr
= addr
;
141 __entry
->flags
= flags
;
142 __entry
->entries
= entries
;
143 __entry
->total_len
= total_len
;
145 if (flags
& HIF_WRITE
)
150 len_array
= __get_dynamic_array(len_array
);
152 for (i
= 0; i
< entries
; i
++) {
155 memcpy((u8
*) __get_dynamic_array(data
) + offset
,
164 "%s addr 0x%x flags 0x%x entries %d total_len %zd\n",
165 __entry
->tx
? "tx" : "rx",
173 TRACE_EVENT(ath6kl_sdio_irq
,
174 TP_PROTO(void *buf
, size_t buf_len
),
176 TP_ARGS(buf
, buf_len
),
179 __field(size_t, buf_len
)
180 __dynamic_array(u8
, buf
, buf_len
)
184 __entry
->buf_len
= buf_len
;
185 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
189 "irq len %zd\n", __entry
->buf_len
193 TRACE_EVENT(ath6kl_htc_rx
,
194 TP_PROTO(int status
, int endpoint
, void *buf
,
197 TP_ARGS(status
, endpoint
, buf
, buf_len
),
201 __field(int, endpoint
)
202 __field(size_t, buf_len
)
203 __dynamic_array(u8
, buf
, buf_len
)
207 __entry
->status
= status
;
208 __entry
->endpoint
= endpoint
;
209 __entry
->buf_len
= buf_len
;
210 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
214 "status %d endpoint %d len %zd\n",
221 TRACE_EVENT(ath6kl_htc_tx
,
222 TP_PROTO(int status
, int endpoint
, void *buf
,
225 TP_ARGS(status
, endpoint
, buf
, buf_len
),
229 __field(int, endpoint
)
230 __field(size_t, buf_len
)
231 __dynamic_array(u8
, buf
, buf_len
)
235 __entry
->status
= status
;
236 __entry
->endpoint
= endpoint
;
237 __entry
->buf_len
= buf_len
;
238 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
242 "status %d endpoint %d len %zd\n",
249 #define ATH6KL_MSG_MAX 200
251 DECLARE_EVENT_CLASS(ath6kl_log_event
,
252 TP_PROTO(struct va_format
*vaf
),
255 __dynamic_array(char, msg
, ATH6KL_MSG_MAX
)
258 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
261 *vaf
->va
) >= ATH6KL_MSG_MAX
);
263 TP_printk("%s", __get_str(msg
))
266 DEFINE_EVENT(ath6kl_log_event
, ath6kl_log_err
,
267 TP_PROTO(struct va_format
*vaf
),
271 DEFINE_EVENT(ath6kl_log_event
, ath6kl_log_warn
,
272 TP_PROTO(struct va_format
*vaf
),
276 DEFINE_EVENT(ath6kl_log_event
, ath6kl_log_info
,
277 TP_PROTO(struct va_format
*vaf
),
281 TRACE_EVENT(ath6kl_log_dbg
,
282 TP_PROTO(unsigned int level
, struct va_format
*vaf
),
285 __field(unsigned int, level
)
286 __dynamic_array(char, msg
, ATH6KL_MSG_MAX
)
289 __entry
->level
= level
;
290 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
293 *vaf
->va
) >= ATH6KL_MSG_MAX
);
295 TP_printk("%s", __get_str(msg
))
298 TRACE_EVENT(ath6kl_log_dbg_dump
,
299 TP_PROTO(const char *msg
, const char *prefix
,
300 const void *buf
, size_t buf_len
),
302 TP_ARGS(msg
, prefix
, buf
, buf_len
),
306 __string(prefix
, prefix
)
307 __field(size_t, buf_len
)
308 __dynamic_array(u8
, buf
, buf_len
)
312 __assign_str(msg
, msg
);
313 __assign_str(prefix
, prefix
);
314 __entry
->buf_len
= buf_len
;
315 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
319 "%s/%s\n", __get_str(prefix
), __get_str(msg
)
323 #endif /* _ ATH6KL_TRACE_H || TRACE_HEADER_MULTI_READ*/
325 /* we don't want to use include/trace/events */
326 #undef TRACE_INCLUDE_PATH
327 #define TRACE_INCLUDE_PATH .
328 #undef TRACE_INCLUDE_FILE
329 #define TRACE_INCLUDE_FILE trace
331 /* This part must be outside protection */
332 #include <trace/define_trace.h>