2 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
20 #include <linux/tracepoint.h>
24 /* create empty functions when tracing is disabled */
25 #if !defined(CONFIG_ATH10K_TRACING)
27 #define TRACE_EVENT(name, proto, ...) \
28 static inline void trace_ ## name(proto) {}
29 #undef DECLARE_EVENT_CLASS
30 #define DECLARE_EVENT_CLASS(...)
32 #define DEFINE_EVENT(evt_class, name, proto, ...) \
33 static inline void trace_ ## name(proto) {}
34 #endif /* !CONFIG_ATH10K_TRACING || __CHECKER__ */
37 #define TRACE_SYSTEM ath10k
39 #define ATH10K_MSG_MAX 200
41 DECLARE_EVENT_CLASS(ath10k_log_event
,
42 TP_PROTO(struct va_format
*vaf
),
45 __dynamic_array(char, msg
, ATH10K_MSG_MAX
)
48 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
51 *vaf
->va
) >= ATH10K_MSG_MAX
);
53 TP_printk("%s", __get_str(msg
))
56 DEFINE_EVENT(ath10k_log_event
, ath10k_log_err
,
57 TP_PROTO(struct va_format
*vaf
),
61 DEFINE_EVENT(ath10k_log_event
, ath10k_log_warn
,
62 TP_PROTO(struct va_format
*vaf
),
66 DEFINE_EVENT(ath10k_log_event
, ath10k_log_info
,
67 TP_PROTO(struct va_format
*vaf
),
71 TRACE_EVENT(ath10k_log_dbg
,
72 TP_PROTO(unsigned int level
, struct va_format
*vaf
),
75 __field(unsigned int, level
)
76 __dynamic_array(char, msg
, ATH10K_MSG_MAX
)
79 __entry
->level
= level
;
80 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
83 *vaf
->va
) >= ATH10K_MSG_MAX
);
85 TP_printk("%s", __get_str(msg
))
88 TRACE_EVENT(ath10k_log_dbg_dump
,
89 TP_PROTO(const char *msg
, const char *prefix
,
90 const void *buf
, size_t buf_len
),
92 TP_ARGS(msg
, prefix
, buf
, buf_len
),
96 __string(prefix
, prefix
)
97 __field(size_t, buf_len
)
98 __dynamic_array(u8
, buf
, buf_len
)
102 __assign_str(msg
, msg
);
103 __assign_str(prefix
, prefix
);
104 __entry
->buf_len
= buf_len
;
105 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
109 "%s/%s\n", __get_str(prefix
), __get_str(msg
)
113 TRACE_EVENT(ath10k_wmi_cmd
,
114 TP_PROTO(int id
, void *buf
, size_t buf_len
, int ret
),
116 TP_ARGS(id
, buf
, buf_len
, ret
),
119 __field(unsigned int, id
)
120 __field(size_t, buf_len
)
121 __dynamic_array(u8
, buf
, buf_len
)
127 __entry
->buf_len
= buf_len
;
129 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
133 "id %d len %zu ret %d",
140 TRACE_EVENT(ath10k_wmi_event
,
141 TP_PROTO(int id
, void *buf
, size_t buf_len
),
143 TP_ARGS(id
, buf
, buf_len
),
146 __field(unsigned int, id
)
147 __field(size_t, buf_len
)
148 __dynamic_array(u8
, buf
, buf_len
)
153 __entry
->buf_len
= buf_len
;
154 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
164 TRACE_EVENT(ath10k_htt_stats
,
165 TP_PROTO(void *buf
, size_t buf_len
),
167 TP_ARGS(buf
, buf_len
),
170 __field(size_t, buf_len
)
171 __dynamic_array(u8
, buf
, buf_len
)
175 __entry
->buf_len
= buf_len
;
176 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
185 TRACE_EVENT(ath10k_wmi_dbglog
,
186 TP_PROTO(void *buf
, size_t buf_len
),
188 TP_ARGS(buf
, buf_len
),
191 __field(size_t, buf_len
)
192 __dynamic_array(u8
, buf
, buf_len
)
196 __entry
->buf_len
= buf_len
;
197 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
206 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
208 /* we don't want to use include/trace/events */
209 #undef TRACE_INCLUDE_PATH
210 #define TRACE_INCLUDE_PATH .
211 #undef TRACE_INCLUDE_FILE
212 #define TRACE_INCLUDE_FILE trace
214 /* This part must be outside protection */
215 #include <trace/define_trace.h>