2 * Copyright (c) 2011 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.
17 #if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ)
19 #define __TRACE_BRCMSMAC_H
21 #include <linux/types.h>
22 #include <linux/device.h>
23 #include <linux/tracepoint.h>
24 #include "mac80211_if.h"
26 #ifndef CONFIG_BRCM_TRACING
28 #define TRACE_EVENT(name, proto, ...) \
29 static inline void trace_ ## name(proto) {}
30 #undef DECLARE_EVENT_CLASS
31 #define DECLARE_EVENT_CLASS(...)
33 #define DEFINE_EVENT(evt_class, name, proto, ...) \
34 static inline void trace_ ## name(proto) {}
38 #define TRACE_SYSTEM brcmsmac
41 * We define a tracepoint, its arguments, its printk format and its
42 * 'fast binary record' layout.
44 TRACE_EVENT(brcms_timer
,
45 /* TPPROTO is the prototype of the function called by this tracepoint */
46 TP_PROTO(struct brcms_timer
*t
),
48 * TPARGS(firstarg, p) are the parameters names, same as found in the
53 * Fast binary tracing: define the trace record via TP_STRUCT__entry().
54 * You can think about it like a regular C structure local variable
60 __field(uint
, periodic
)
64 __entry
->set
= t
->set
;
65 __entry
->periodic
= t
->periodic
;
68 "ms=%u set=%u periodic=%u",
69 __entry
->ms
, __entry
->set
, __entry
->periodic
73 TRACE_EVENT(brcms_dpc
,
74 TP_PROTO(unsigned long data
),
77 __field(unsigned long, data
)
88 TRACE_EVENT(brcms_macintstatus
,
89 TP_PROTO(const struct device
*dev
, int in_isr
, u32 macintstatus
,
91 TP_ARGS(dev
, in_isr
, macintstatus
, mask
),
93 __string(dev
, dev_name(dev
))
95 __field(u32
, macintstatus
)
99 __assign_str(dev
, dev_name(dev
));
100 __entry
->in_isr
= in_isr
;
101 __entry
->macintstatus
= macintstatus
;
102 __entry
->mask
= mask
;
104 TP_printk("[%s] in_isr=%d macintstatus=%#x mask=%#x", __get_str(dev
),
105 __entry
->in_isr
, __entry
->macintstatus
, __entry
->mask
)
109 #define TRACE_SYSTEM brcmsmac_tx
111 TRACE_EVENT(brcms_txdesc
,
112 TP_PROTO(const struct device
*dev
,
113 void *txh
, size_t txh_len
),
114 TP_ARGS(dev
, txh
, txh_len
),
116 __string(dev
, dev_name(dev
))
117 __dynamic_array(u8
, txh
, txh_len
)
120 __assign_str(dev
, dev_name(dev
));
121 memcpy(__get_dynamic_array(txh
), txh
, txh_len
);
123 TP_printk("[%s] txdesc", __get_str(dev
))
126 TRACE_EVENT(brcms_txstatus
,
127 TP_PROTO(const struct device
*dev
, u16 framelen
, u16 frameid
,
128 u16 status
, u16 lasttxtime
, u16 sequence
, u16 phyerr
,
130 TP_ARGS(dev
, framelen
, frameid
, status
, lasttxtime
, sequence
, phyerr
,
133 __string(dev
, dev_name(dev
))
134 __field(u16
, framelen
)
135 __field(u16
, frameid
)
137 __field(u16
, lasttxtime
)
138 __field(u16
, sequence
)
140 __field(u16
, ackphyrxsh
)
143 __assign_str(dev
, dev_name(dev
));
144 __entry
->framelen
= framelen
;
145 __entry
->frameid
= frameid
;
146 __entry
->status
= status
;
147 __entry
->lasttxtime
= lasttxtime
;
148 __entry
->sequence
= sequence
;
149 __entry
->phyerr
= phyerr
;
150 __entry
->ackphyrxsh
= ackphyrxsh
;
152 TP_printk("[%s] FrameId %#04x TxStatus %#04x LastTxTime %#04x "
153 "Seq %#04x PHYTxStatus %#04x RxAck %#04x",
154 __get_str(dev
), __entry
->frameid
, __entry
->status
,
155 __entry
->lasttxtime
, __entry
->sequence
, __entry
->phyerr
,
159 TRACE_EVENT(brcms_ampdu_session
,
160 TP_PROTO(const struct device
*dev
, unsigned max_ampdu_len
,
161 u16 max_ampdu_frames
, u16 ampdu_len
, u16 ampdu_frames
,
163 TP_ARGS(dev
, max_ampdu_len
, max_ampdu_frames
, ampdu_len
, ampdu_frames
,
166 __string(dev
, dev_name(dev
))
167 __field(unsigned, max_ampdu_len
)
168 __field(u16
, max_ampdu_frames
)
169 __field(u16
, ampdu_len
)
170 __field(u16
, ampdu_frames
)
171 __field(u16
, dma_len
)
174 __assign_str(dev
, dev_name(dev
));
175 __entry
->max_ampdu_len
= max_ampdu_len
;
176 __entry
->max_ampdu_frames
= max_ampdu_frames
;
177 __entry
->ampdu_len
= ampdu_len
;
178 __entry
->ampdu_frames
= ampdu_frames
;
179 __entry
->dma_len
= dma_len
;
181 TP_printk("[%s] ampdu session max_len=%u max_frames=%u len=%u frames=%u dma_len=%u",
182 __get_str(dev
), __entry
->max_ampdu_len
,
183 __entry
->max_ampdu_frames
, __entry
->ampdu_len
,
184 __entry
->ampdu_frames
, __entry
->dma_len
)
188 #define TRACE_SYSTEM brcmsmac_msg
190 #define MAX_MSG_LEN 100
192 DECLARE_EVENT_CLASS(brcms_msg_event
,
193 TP_PROTO(struct va_format
*vaf
),
196 __dynamic_array(char, msg
, MAX_MSG_LEN
)
199 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
200 MAX_MSG_LEN
, vaf
->fmt
,
201 *vaf
->va
) >= MAX_MSG_LEN
);
203 TP_printk("%s", __get_str(msg
))
206 DEFINE_EVENT(brcms_msg_event
, brcms_info
,
207 TP_PROTO(struct va_format
*vaf
),
211 DEFINE_EVENT(brcms_msg_event
, brcms_warn
,
212 TP_PROTO(struct va_format
*vaf
),
216 DEFINE_EVENT(brcms_msg_event
, brcms_err
,
217 TP_PROTO(struct va_format
*vaf
),
221 DEFINE_EVENT(brcms_msg_event
, brcms_crit
,
222 TP_PROTO(struct va_format
*vaf
),
226 TRACE_EVENT(brcms_dbg
,
227 TP_PROTO(u32 level
, const char *func
, struct va_format
*vaf
),
228 TP_ARGS(level
, func
, vaf
),
232 __dynamic_array(char, msg
, MAX_MSG_LEN
)
235 __entry
->level
= level
;
236 __assign_str(func
, func
);
237 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
238 MAX_MSG_LEN
, vaf
->fmt
,
239 *vaf
->va
) >= MAX_MSG_LEN
);
241 TP_printk("%s: %s", __get_str(func
), __get_str(msg
))
244 #endif /* __TRACE_BRCMSMAC_H */
246 #ifdef CONFIG_BRCM_TRACING
248 #undef TRACE_INCLUDE_PATH
249 #define TRACE_INCLUDE_PATH .
250 #undef TRACE_INCLUDE_FILE
251 #define TRACE_INCLUDE_FILE brcms_trace_events
253 #include <trace/define_trace.h>
255 #endif /* CONFIG_BRCM_TRACING */