]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h
96a962abc89a7929375ed854582d9dbd10275ce0
[mirror_ubuntu-bionic-kernel.git] / drivers / net / wireless / brcm80211 / brcmsmac / brcms_trace_events.h
1 /*
2 * Copyright (c) 2011 Broadcom Corporation
3 *
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.
7 *
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.
15 */
16
17 #if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ)
18
19 #define __TRACE_BRCMSMAC_H
20
21 #include <linux/types.h>
22 #include <linux/device.h>
23 #include <linux/tracepoint.h>
24 #include "mac80211_if.h"
25
26 #ifndef CONFIG_BRCM_TRACING
27 #undef TRACE_EVENT
28 #define TRACE_EVENT(name, proto, ...) \
29 static inline void trace_ ## name(proto) {}
30 #undef DECLARE_EVENT_CLASS
31 #define DECLARE_EVENT_CLASS(...)
32 #undef DEFINE_EVENT
33 #define DEFINE_EVENT(evt_class, name, proto, ...) \
34 static inline void trace_ ## name(proto) {}
35 #endif
36
37 #undef TRACE_SYSTEM
38 #define TRACE_SYSTEM brcmsmac
39
40 /*
41 * We define a tracepoint, its arguments, its printk format and its
42 * 'fast binary record' layout.
43 */
44 TRACE_EVENT(brcms_timer,
45 /* TPPROTO is the prototype of the function called by this tracepoint */
46 TP_PROTO(struct brcms_timer *t),
47 /*
48 * TPARGS(firstarg, p) are the parameters names, same as found in the
49 * prototype.
50 */
51 TP_ARGS(t),
52 /*
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
55 * definition.
56 */
57 TP_STRUCT__entry(
58 __field(uint, ms)
59 __field(uint, set)
60 __field(uint, periodic)
61 ),
62 TP_fast_assign(
63 __entry->ms = t->ms;
64 __entry->set = t->set;
65 __entry->periodic = t->periodic;
66 ),
67 TP_printk(
68 "ms=%u set=%u periodic=%u",
69 __entry->ms, __entry->set, __entry->periodic
70 )
71 );
72
73 TRACE_EVENT(brcms_dpc,
74 TP_PROTO(unsigned long data),
75 TP_ARGS(data),
76 TP_STRUCT__entry(
77 __field(unsigned long, data)
78 ),
79 TP_fast_assign(
80 __entry->data = data;
81 ),
82 TP_printk(
83 "data=%p",
84 (void *)__entry->data
85 )
86 );
87
88 #undef TRACE_SYSTEM
89 #define TRACE_SYSTEM brcmsmac_tx
90
91 TRACE_EVENT(brcms_txdesc,
92 TP_PROTO(const struct device *dev,
93 void *txh, size_t txh_len),
94 TP_ARGS(dev, txh, txh_len),
95 TP_STRUCT__entry(
96 __string(dev, dev_name(dev))
97 __dynamic_array(u8, txh, txh_len)
98 ),
99 TP_fast_assign(
100 __assign_str(dev, dev_name(dev));
101 memcpy(__get_dynamic_array(txh), txh, txh_len);
102 ),
103 TP_printk("[%s] txdesc", __get_str(dev))
104 );
105
106 TRACE_EVENT(brcms_txstatus,
107 TP_PROTO(const struct device *dev, u16 framelen, u16 frameid,
108 u16 status, u16 lasttxtime, u16 sequence, u16 phyerr,
109 u16 ackphyrxsh),
110 TP_ARGS(dev, framelen, frameid, status, lasttxtime, sequence, phyerr,
111 ackphyrxsh),
112 TP_STRUCT__entry(
113 __string(dev, dev_name(dev))
114 __field(u16, framelen)
115 __field(u16, frameid)
116 __field(u16, status)
117 __field(u16, lasttxtime)
118 __field(u16, sequence)
119 __field(u16, phyerr)
120 __field(u16, ackphyrxsh)
121 ),
122 TP_fast_assign(
123 __assign_str(dev, dev_name(dev));
124 __entry->framelen = framelen;
125 __entry->frameid = frameid;
126 __entry->status = status;
127 __entry->lasttxtime = lasttxtime;
128 __entry->sequence = sequence;
129 __entry->phyerr = phyerr;
130 __entry->ackphyrxsh = ackphyrxsh;
131 ),
132 TP_printk("[%s] FrameId %#04x TxStatus %#04x LastTxTime %#04x "
133 "Seq %#04x PHYTxStatus %#04x RxAck %#04x",
134 __get_str(dev), __entry->frameid, __entry->status,
135 __entry->lasttxtime, __entry->sequence, __entry->phyerr,
136 __entry->ackphyrxsh)
137 );
138
139 #undef TRACE_SYSTEM
140 #define TRACE_SYSTEM brcmsmac_msg
141
142 #define MAX_MSG_LEN 100
143
144 DECLARE_EVENT_CLASS(brcms_msg_event,
145 TP_PROTO(struct va_format *vaf),
146 TP_ARGS(vaf),
147 TP_STRUCT__entry(
148 __dynamic_array(char, msg, MAX_MSG_LEN)
149 ),
150 TP_fast_assign(
151 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
152 MAX_MSG_LEN, vaf->fmt,
153 *vaf->va) >= MAX_MSG_LEN);
154 ),
155 TP_printk("%s", __get_str(msg))
156 );
157
158 DEFINE_EVENT(brcms_msg_event, brcms_info,
159 TP_PROTO(struct va_format *vaf),
160 TP_ARGS(vaf)
161 );
162
163 DEFINE_EVENT(brcms_msg_event, brcms_warn,
164 TP_PROTO(struct va_format *vaf),
165 TP_ARGS(vaf)
166 );
167
168 DEFINE_EVENT(brcms_msg_event, brcms_err,
169 TP_PROTO(struct va_format *vaf),
170 TP_ARGS(vaf)
171 );
172
173 DEFINE_EVENT(brcms_msg_event, brcms_crit,
174 TP_PROTO(struct va_format *vaf),
175 TP_ARGS(vaf)
176 );
177
178 TRACE_EVENT(brcms_dbg,
179 TP_PROTO(u32 level, const char *func, struct va_format *vaf),
180 TP_ARGS(level, func, vaf),
181 TP_STRUCT__entry(
182 __field(u32, level)
183 __string(func, func)
184 __dynamic_array(char, msg, MAX_MSG_LEN)
185 ),
186 TP_fast_assign(
187 __entry->level = level;
188 __assign_str(func, func);
189 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
190 MAX_MSG_LEN, vaf->fmt,
191 *vaf->va) >= MAX_MSG_LEN);
192 ),
193 TP_printk("%s: %s", __get_str(func), __get_str(msg))
194 );
195
196 #endif /* __TRACE_BRCMSMAC_H */
197
198 #ifdef CONFIG_BRCM_TRACING
199
200 #undef TRACE_INCLUDE_PATH
201 #define TRACE_INCLUDE_PATH .
202 #undef TRACE_INCLUDE_FILE
203 #define TRACE_INCLUDE_FILE brcms_trace_events
204
205 #include <trace/define_trace.h>
206
207 #endif /* CONFIG_BRCM_TRACING */