Linux 4.10-rc3
[linux/fpc-iii.git] / net / mac802154 / trace.h
blob6f30e0c93a160f9f58cfd3195e4c35fe22d606cf
1 /* Based on net/mac80211/trace.h */
3 #undef TRACE_SYSTEM
4 #define TRACE_SYSTEM mac802154
6 #if !defined(__MAC802154_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
7 #define __MAC802154_DRIVER_TRACE
9 #include <linux/tracepoint.h>
11 #include <net/mac802154.h>
12 #include "ieee802154_i.h"
14 #define MAXNAME 32
15 #define LOCAL_ENTRY __array(char, wpan_phy_name, MAXNAME)
16 #define LOCAL_ASSIGN strlcpy(__entry->wpan_phy_name, \
17 wpan_phy_name(local->hw.phy), MAXNAME)
18 #define LOCAL_PR_FMT "%s"
19 #define LOCAL_PR_ARG __entry->wpan_phy_name
21 #define CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
22 __field(enum nl802154_cca_opts, cca_opt)
23 #define CCA_ASSIGN \
24 do { \
25 (__entry->cca_mode) = cca->mode; \
26 (__entry->cca_opt) = cca->opt; \
27 } while (0)
28 #define CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
29 #define CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
31 #define BOOL_TO_STR(bo) (bo) ? "true" : "false"
33 /* Tracing for driver callbacks */
35 DECLARE_EVENT_CLASS(local_only_evt,
36 TP_PROTO(struct ieee802154_local *local),
37 TP_ARGS(local),
38 TP_STRUCT__entry(
39 LOCAL_ENTRY
41 TP_fast_assign(
42 LOCAL_ASSIGN;
44 TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
47 DEFINE_EVENT(local_only_evt, 802154_drv_return_void,
48 TP_PROTO(struct ieee802154_local *local),
49 TP_ARGS(local)
52 TRACE_EVENT(802154_drv_return_int,
53 TP_PROTO(struct ieee802154_local *local, int ret),
54 TP_ARGS(local, ret),
55 TP_STRUCT__entry(
56 LOCAL_ENTRY
57 __field(int, ret)
59 TP_fast_assign(
60 LOCAL_ASSIGN;
61 __entry->ret = ret;
63 TP_printk(LOCAL_PR_FMT ", returned: %d", LOCAL_PR_ARG,
64 __entry->ret)
67 DEFINE_EVENT(local_only_evt, 802154_drv_start,
68 TP_PROTO(struct ieee802154_local *local),
69 TP_ARGS(local)
72 DEFINE_EVENT(local_only_evt, 802154_drv_stop,
73 TP_PROTO(struct ieee802154_local *local),
74 TP_ARGS(local)
77 TRACE_EVENT(802154_drv_set_channel,
78 TP_PROTO(struct ieee802154_local *local, u8 page, u8 channel),
79 TP_ARGS(local, page, channel),
80 TP_STRUCT__entry(
81 LOCAL_ENTRY
82 __field(u8, page)
83 __field(u8, channel)
85 TP_fast_assign(
86 LOCAL_ASSIGN;
87 __entry->page = page;
88 __entry->channel = channel;
90 TP_printk(LOCAL_PR_FMT ", page: %d, channel: %d", LOCAL_PR_ARG,
91 __entry->page, __entry->channel)
94 TRACE_EVENT(802154_drv_set_cca_mode,
95 TP_PROTO(struct ieee802154_local *local,
96 const struct wpan_phy_cca *cca),
97 TP_ARGS(local, cca),
98 TP_STRUCT__entry(
99 LOCAL_ENTRY
100 CCA_ENTRY
102 TP_fast_assign(
103 LOCAL_ASSIGN;
104 CCA_ASSIGN;
106 TP_printk(LOCAL_PR_FMT ", " CCA_PR_FMT, LOCAL_PR_ARG,
107 CCA_PR_ARG)
110 TRACE_EVENT(802154_drv_set_cca_ed_level,
111 TP_PROTO(struct ieee802154_local *local, s32 mbm),
112 TP_ARGS(local, mbm),
113 TP_STRUCT__entry(
114 LOCAL_ENTRY
115 __field(s32, mbm)
117 TP_fast_assign(
118 LOCAL_ASSIGN;
119 __entry->mbm = mbm;
121 TP_printk(LOCAL_PR_FMT ", ed level: %d", LOCAL_PR_ARG,
122 __entry->mbm)
125 TRACE_EVENT(802154_drv_set_tx_power,
126 TP_PROTO(struct ieee802154_local *local, s32 power),
127 TP_ARGS(local, power),
128 TP_STRUCT__entry(
129 LOCAL_ENTRY
130 __field(s32, power)
132 TP_fast_assign(
133 LOCAL_ASSIGN;
134 __entry->power = power;
136 TP_printk(LOCAL_PR_FMT ", mbm: %d", LOCAL_PR_ARG,
137 __entry->power)
140 TRACE_EVENT(802154_drv_set_lbt_mode,
141 TP_PROTO(struct ieee802154_local *local, bool mode),
142 TP_ARGS(local, mode),
143 TP_STRUCT__entry(
144 LOCAL_ENTRY
145 __field(bool, mode)
147 TP_fast_assign(
148 LOCAL_ASSIGN;
149 __entry->mode = mode;
151 TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
152 BOOL_TO_STR(__entry->mode))
155 TRACE_EVENT(802154_drv_set_short_addr,
156 TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
157 TP_ARGS(local, short_addr),
158 TP_STRUCT__entry(
159 LOCAL_ENTRY
160 __field(__le16, short_addr)
162 TP_fast_assign(
163 LOCAL_ASSIGN;
164 __entry->short_addr = short_addr;
166 TP_printk(LOCAL_PR_FMT ", short addr: 0x%04x", LOCAL_PR_ARG,
167 le16_to_cpu(__entry->short_addr))
170 TRACE_EVENT(802154_drv_set_pan_id,
171 TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
172 TP_ARGS(local, pan_id),
173 TP_STRUCT__entry(
174 LOCAL_ENTRY
175 __field(__le16, pan_id)
177 TP_fast_assign(
178 LOCAL_ASSIGN;
179 __entry->pan_id = pan_id;
181 TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
182 le16_to_cpu(__entry->pan_id))
185 TRACE_EVENT(802154_drv_set_extended_addr,
186 TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
187 TP_ARGS(local, extended_addr),
188 TP_STRUCT__entry(
189 LOCAL_ENTRY
190 __field(__le64, extended_addr)
192 TP_fast_assign(
193 LOCAL_ASSIGN;
194 __entry->extended_addr = extended_addr;
196 TP_printk(LOCAL_PR_FMT ", extended addr: 0x%llx", LOCAL_PR_ARG,
197 le64_to_cpu(__entry->extended_addr))
200 TRACE_EVENT(802154_drv_set_pan_coord,
201 TP_PROTO(struct ieee802154_local *local, bool is_coord),
202 TP_ARGS(local, is_coord),
203 TP_STRUCT__entry(
204 LOCAL_ENTRY
205 __field(bool, is_coord)
207 TP_fast_assign(
208 LOCAL_ASSIGN;
209 __entry->is_coord = is_coord;
211 TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
212 BOOL_TO_STR(__entry->is_coord))
215 TRACE_EVENT(802154_drv_set_csma_params,
216 TP_PROTO(struct ieee802154_local *local, u8 min_be, u8 max_be,
217 u8 max_csma_backoffs),
218 TP_ARGS(local, min_be, max_be, max_csma_backoffs),
219 TP_STRUCT__entry(
220 LOCAL_ENTRY
221 __field(u8, min_be)
222 __field(u8, max_be)
223 __field(u8, max_csma_backoffs)
225 TP_fast_assign(
226 LOCAL_ASSIGN,
227 __entry->min_be = min_be;
228 __entry->max_be = max_be;
229 __entry->max_csma_backoffs = max_csma_backoffs;
231 TP_printk(LOCAL_PR_FMT ", min be: %d, max be: %d, max csma backoffs: %d",
232 LOCAL_PR_ARG, __entry->min_be, __entry->max_be,
233 __entry->max_csma_backoffs)
236 TRACE_EVENT(802154_drv_set_max_frame_retries,
237 TP_PROTO(struct ieee802154_local *local, s8 max_frame_retries),
238 TP_ARGS(local, max_frame_retries),
239 TP_STRUCT__entry(
240 LOCAL_ENTRY
241 __field(s8, max_frame_retries)
243 TP_fast_assign(
244 LOCAL_ASSIGN;
245 __entry->max_frame_retries = max_frame_retries;
247 TP_printk(LOCAL_PR_FMT ", max frame retries: %d", LOCAL_PR_ARG,
248 __entry->max_frame_retries)
251 TRACE_EVENT(802154_drv_set_promiscuous_mode,
252 TP_PROTO(struct ieee802154_local *local, bool on),
253 TP_ARGS(local, on),
254 TP_STRUCT__entry(
255 LOCAL_ENTRY
256 __field(bool, on)
258 TP_fast_assign(
259 LOCAL_ASSIGN;
260 __entry->on = on;
262 TP_printk(LOCAL_PR_FMT ", promiscuous mode: %s", LOCAL_PR_ARG,
263 BOOL_TO_STR(__entry->on))
266 #endif /* !__MAC802154_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
268 #undef TRACE_INCLUDE_PATH
269 #define TRACE_INCLUDE_PATH .
270 #undef TRACE_INCLUDE_FILE
271 #define TRACE_INCLUDE_FILE trace
272 #include <trace/define_trace.h>