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
),
116 TP_ARGS(id
, buf
, buf_len
),
119 __field(unsigned int, id
)
120 __field(size_t, buf_len
)
121 __dynamic_array(u8
, buf
, buf_len
)
126 __entry
->buf_len
= buf_len
;
127 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
137 TRACE_EVENT(ath10k_wmi_event
,
138 TP_PROTO(int id
, void *buf
, size_t buf_len
),
140 TP_ARGS(id
, buf
, buf_len
),
143 __field(unsigned int, id
)
144 __field(size_t, buf_len
)
145 __dynamic_array(u8
, buf
, buf_len
)
150 __entry
->buf_len
= buf_len
;
151 memcpy(__get_dynamic_array(buf
), buf
, buf_len
);
161 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
163 /* we don't want to use include/trace/events */
164 #undef TRACE_INCLUDE_PATH
165 #define TRACE_INCLUDE_PATH .
166 #undef TRACE_INCLUDE_FILE
167 #define TRACE_INCLUDE_FILE trace
169 /* This part must be outside protection */
170 #include <trace/define_trace.h>