2 * Copyright (c) 2013 Broadcom Corporation
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.
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 ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #if !defined(BRCMF_TRACEPOINT_H_) || defined(TRACE_HEADER_MULTI_READ)
17 #define BRCMF_TRACEPOINT_H_
19 #include <linux/types.h>
20 #include <linux/tracepoint.h>
22 #ifndef CONFIG_BRCM_TRACING
25 #define TRACE_EVENT(name, proto, ...) \
26 static inline void trace_ ## name(proto) {}
28 #undef DECLARE_EVENT_CLASS
29 #define DECLARE_EVENT_CLASS(...)
32 #define DEFINE_EVENT(evt_class, name, proto, ...) \
33 static inline void trace_ ## name(proto) {}
35 #endif /* CONFIG_BRCM_TRACING */
38 #define TRACE_SYSTEM brcmfmac
40 #define MAX_MSG_LEN 100
42 TRACE_EVENT(brcmf_err
,
43 TP_PROTO(const char *func
, struct va_format
*vaf
),
47 __dynamic_array(char, msg
, MAX_MSG_LEN
)
50 __assign_str(func
, func
);
51 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
52 MAX_MSG_LEN
, vaf
->fmt
,
53 *vaf
->va
) >= MAX_MSG_LEN
);
55 TP_printk("%s: %s", __get_str(func
), __get_str(msg
))
58 TRACE_EVENT(brcmf_dbg
,
59 TP_PROTO(u32 level
, const char *func
, struct va_format
*vaf
),
60 TP_ARGS(level
, func
, vaf
),
64 __dynamic_array(char, msg
, MAX_MSG_LEN
)
67 __entry
->level
= level
;
68 __assign_str(func
, func
);
69 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
70 MAX_MSG_LEN
, vaf
->fmt
,
71 *vaf
->va
) >= MAX_MSG_LEN
);
73 TP_printk("%s: %s", __get_str(func
), __get_str(msg
))
76 TRACE_EVENT(brcmf_hexdump
,
77 TP_PROTO(void *data
, size_t len
),
80 __field(unsigned long, len
)
81 __dynamic_array(u8
, hdata
, len
)
85 memcpy(__get_dynamic_array(hdata
), data
, len
);
87 TP_printk("hexdump [length=%lu]", __entry
->len
)
90 TRACE_EVENT(brcmf_bdchdr
,
98 __dynamic_array(u8
, signal
, *((u8
*)data
+ 3) * 4)
101 __entry
->flags
= *(u8
*)data
;
102 __entry
->prio
= *((u8
*)data
+ 1);
103 __entry
->flags2
= *((u8
*)data
+ 2);
104 __entry
->siglen
= *((u8
*)data
+ 3) * 4;
105 memcpy(__get_dynamic_array(signal
),
106 (u8
*)data
+ 4, __entry
->siglen
);
108 TP_printk("bdc: prio=%d siglen=%d", __entry
->prio
, __entry
->siglen
)
111 #ifdef CONFIG_BRCM_TRACING
113 #undef TRACE_INCLUDE_PATH
114 #define TRACE_INCLUDE_PATH .
115 #undef TRACE_INCLUDE_FILE
116 #define TRACE_INCLUDE_FILE tracepoint
118 #include <trace/define_trace.h>
120 #endif /* CONFIG_BRCM_TRACING */
122 #endif /* BRCMF_TRACEPOINT_H_ */