WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / wireless / ath / ath6kl / trace.h
bloba3d3740419eb7fd68f8c4fec47c3da025675b927
1 /* SPDX-License-Identifier: ISC */
2 #if !defined(_ATH6KL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
4 #include <net/cfg80211.h>
5 #include <linux/skbuff.h>
6 #include <linux/tracepoint.h>
7 #include "wmi.h"
8 #include "hif.h"
10 #if !defined(_ATH6KL_TRACE_H)
11 static inline unsigned int ath6kl_get_wmi_id(void *buf, size_t buf_len)
13 struct wmi_cmd_hdr *hdr = buf;
15 if (buf_len < sizeof(*hdr))
16 return 0;
18 return le16_to_cpu(hdr->cmd_id);
20 #endif /* __ATH6KL_TRACE_H */
22 #define _ATH6KL_TRACE_H
24 /* create empty functions when tracing is disabled */
25 #if !defined(CONFIG_ATH6KL_TRACING)
26 #undef TRACE_EVENT
27 #define TRACE_EVENT(name, proto, ...) \
28 static inline void trace_ ## name(proto) {}
29 #undef DECLARE_EVENT_CLASS
30 #define DECLARE_EVENT_CLASS(...)
31 #undef DEFINE_EVENT
32 #define DEFINE_EVENT(evt_class, name, proto, ...) \
33 static inline void trace_ ## name(proto) {}
34 #endif /* !CONFIG_ATH6KL_TRACING || __CHECKER__ */
36 #undef TRACE_SYSTEM
37 #define TRACE_SYSTEM ath6kl
39 TRACE_EVENT(ath6kl_wmi_cmd,
40 TP_PROTO(void *buf, size_t buf_len),
42 TP_ARGS(buf, buf_len),
44 TP_STRUCT__entry(
45 __field(unsigned int, id)
46 __field(size_t, buf_len)
47 __dynamic_array(u8, buf, buf_len)
50 TP_fast_assign(
51 __entry->id = ath6kl_get_wmi_id(buf, buf_len);
52 __entry->buf_len = buf_len;
53 memcpy(__get_dynamic_array(buf), buf, buf_len);
56 TP_printk(
57 "id %d len %zd",
58 __entry->id, __entry->buf_len
62 TRACE_EVENT(ath6kl_wmi_event,
63 TP_PROTO(void *buf, size_t buf_len),
65 TP_ARGS(buf, buf_len),
67 TP_STRUCT__entry(
68 __field(unsigned int, id)
69 __field(size_t, buf_len)
70 __dynamic_array(u8, buf, buf_len)
73 TP_fast_assign(
74 __entry->id = ath6kl_get_wmi_id(buf, buf_len);
75 __entry->buf_len = buf_len;
76 memcpy(__get_dynamic_array(buf), buf, buf_len);
79 TP_printk(
80 "id %d len %zd",
81 __entry->id, __entry->buf_len
85 TRACE_EVENT(ath6kl_sdio,
86 TP_PROTO(unsigned int addr, int flags,
87 void *buf, size_t buf_len),
89 TP_ARGS(addr, flags, buf, buf_len),
91 TP_STRUCT__entry(
92 __field(unsigned int, tx)
93 __field(unsigned int, addr)
94 __field(int, flags)
95 __field(size_t, buf_len)
96 __dynamic_array(u8, buf, buf_len)
99 TP_fast_assign(
100 __entry->addr = addr;
101 __entry->flags = flags;
102 __entry->buf_len = buf_len;
103 memcpy(__get_dynamic_array(buf), buf, buf_len);
105 if (flags & HIF_WRITE)
106 __entry->tx = 1;
107 else
108 __entry->tx = 0;
111 TP_printk(
112 "%s addr 0x%x flags 0x%x len %zd\n",
113 __entry->tx ? "tx" : "rx",
114 __entry->addr,
115 __entry->flags,
116 __entry->buf_len
120 TRACE_EVENT(ath6kl_sdio_scat,
121 TP_PROTO(unsigned int addr, int flags, unsigned int total_len,
122 unsigned int entries, struct hif_scatter_item *list),
124 TP_ARGS(addr, flags, total_len, entries, list),
126 TP_STRUCT__entry(
127 __field(unsigned int, tx)
128 __field(unsigned int, addr)
129 __field(int, flags)
130 __field(unsigned int, entries)
131 __field(size_t, total_len)
132 __dynamic_array(unsigned int, len_array, entries)
133 __dynamic_array(u8, data, total_len)
136 TP_fast_assign(
137 unsigned int *len_array;
138 int i, offset = 0;
139 size_t len;
141 __entry->addr = addr;
142 __entry->flags = flags;
143 __entry->entries = entries;
144 __entry->total_len = total_len;
146 if (flags & HIF_WRITE)
147 __entry->tx = 1;
148 else
149 __entry->tx = 0;
151 len_array = __get_dynamic_array(len_array);
153 for (i = 0; i < entries; i++) {
154 len = list[i].len;
156 memcpy((u8 *) __get_dynamic_array(data) + offset,
157 list[i].buf, len);
159 len_array[i] = len;
160 offset += len;
164 TP_printk(
165 "%s addr 0x%x flags 0x%x entries %d total_len %zd\n",
166 __entry->tx ? "tx" : "rx",
167 __entry->addr,
168 __entry->flags,
169 __entry->entries,
170 __entry->total_len
174 TRACE_EVENT(ath6kl_sdio_irq,
175 TP_PROTO(void *buf, size_t buf_len),
177 TP_ARGS(buf, buf_len),
179 TP_STRUCT__entry(
180 __field(size_t, buf_len)
181 __dynamic_array(u8, buf, buf_len)
184 TP_fast_assign(
185 __entry->buf_len = buf_len;
186 memcpy(__get_dynamic_array(buf), buf, buf_len);
189 TP_printk(
190 "irq len %zd\n", __entry->buf_len
194 TRACE_EVENT(ath6kl_htc_rx,
195 TP_PROTO(int status, int endpoint, void *buf,
196 size_t buf_len),
198 TP_ARGS(status, endpoint, buf, buf_len),
200 TP_STRUCT__entry(
201 __field(int, status)
202 __field(int, endpoint)
203 __field(size_t, buf_len)
204 __dynamic_array(u8, buf, buf_len)
207 TP_fast_assign(
208 __entry->status = status;
209 __entry->endpoint = endpoint;
210 __entry->buf_len = buf_len;
211 memcpy(__get_dynamic_array(buf), buf, buf_len);
214 TP_printk(
215 "status %d endpoint %d len %zd\n",
216 __entry->status,
217 __entry->endpoint,
218 __entry->buf_len
222 TRACE_EVENT(ath6kl_htc_tx,
223 TP_PROTO(int status, int endpoint, void *buf,
224 size_t buf_len),
226 TP_ARGS(status, endpoint, buf, buf_len),
228 TP_STRUCT__entry(
229 __field(int, status)
230 __field(int, endpoint)
231 __field(size_t, buf_len)
232 __dynamic_array(u8, buf, buf_len)
235 TP_fast_assign(
236 __entry->status = status;
237 __entry->endpoint = endpoint;
238 __entry->buf_len = buf_len;
239 memcpy(__get_dynamic_array(buf), buf, buf_len);
242 TP_printk(
243 "status %d endpoint %d len %zd\n",
244 __entry->status,
245 __entry->endpoint,
246 __entry->buf_len
250 #define ATH6KL_MSG_MAX 200
252 DECLARE_EVENT_CLASS(ath6kl_log_event,
253 TP_PROTO(struct va_format *vaf),
254 TP_ARGS(vaf),
255 TP_STRUCT__entry(
256 __dynamic_array(char, msg, ATH6KL_MSG_MAX)
258 TP_fast_assign(
259 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
260 ATH6KL_MSG_MAX,
261 vaf->fmt,
262 *vaf->va) >= ATH6KL_MSG_MAX);
264 TP_printk("%s", __get_str(msg))
267 DEFINE_EVENT(ath6kl_log_event, ath6kl_log_err,
268 TP_PROTO(struct va_format *vaf),
269 TP_ARGS(vaf)
272 DEFINE_EVENT(ath6kl_log_event, ath6kl_log_warn,
273 TP_PROTO(struct va_format *vaf),
274 TP_ARGS(vaf)
277 DEFINE_EVENT(ath6kl_log_event, ath6kl_log_info,
278 TP_PROTO(struct va_format *vaf),
279 TP_ARGS(vaf)
282 TRACE_EVENT(ath6kl_log_dbg,
283 TP_PROTO(unsigned int level, struct va_format *vaf),
284 TP_ARGS(level, vaf),
285 TP_STRUCT__entry(
286 __field(unsigned int, level)
287 __dynamic_array(char, msg, ATH6KL_MSG_MAX)
289 TP_fast_assign(
290 __entry->level = level;
291 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
292 ATH6KL_MSG_MAX,
293 vaf->fmt,
294 *vaf->va) >= ATH6KL_MSG_MAX);
296 TP_printk("%s", __get_str(msg))
299 TRACE_EVENT(ath6kl_log_dbg_dump,
300 TP_PROTO(const char *msg, const char *prefix,
301 const void *buf, size_t buf_len),
303 TP_ARGS(msg, prefix, buf, buf_len),
305 TP_STRUCT__entry(
306 __string(msg, msg)
307 __string(prefix, prefix)
308 __field(size_t, buf_len)
309 __dynamic_array(u8, buf, buf_len)
312 TP_fast_assign(
313 __assign_str(msg, msg);
314 __assign_str(prefix, prefix);
315 __entry->buf_len = buf_len;
316 memcpy(__get_dynamic_array(buf), buf, buf_len);
319 TP_printk(
320 "%s/%s\n", __get_str(prefix), __get_str(msg)
324 #endif /* _ ATH6KL_TRACE_H || TRACE_HEADER_MULTI_READ*/
326 /* we don't want to use include/trace/events */
327 #undef TRACE_INCLUDE_PATH
328 #define TRACE_INCLUDE_PATH .
329 #undef TRACE_INCLUDE_FILE
330 #define TRACE_INCLUDE_FILE trace
332 /* This part must be outside protection */
333 #include <trace/define_trace.h>