1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Based on net/mac80211/trace.h */
5 #define TRACE_SYSTEM mac802154
7 #if !defined(__MAC802154_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
8 #define __MAC802154_DRIVER_TRACE
10 #include <linux/tracepoint.h>
12 #include <net/mac802154.h>
13 #include "ieee802154_i.h"
16 #define LOCAL_ENTRY __array(char, wpan_phy_name, MAXNAME)
17 #define LOCAL_ASSIGN strscpy(__entry->wpan_phy_name, \
18 wpan_phy_name(local->hw.phy), MAXNAME)
19 #define LOCAL_PR_FMT "%s"
20 #define LOCAL_PR_ARG __entry->wpan_phy_name
22 #define CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
23 __field(enum nl802154_cca_opts, cca_opt)
26 (__entry->cca_mode) = cca->mode; \
27 (__entry->cca_opt) = cca->opt; \
29 #define CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
30 #define CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
32 #define BOOL_TO_STR(bo) (bo) ? "true" : "false"
34 /* Tracing for driver callbacks */
36 DECLARE_EVENT_CLASS(local_only_evt4,
37 TP_PROTO(struct ieee802154_local *local),
45 TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
48 DEFINE_EVENT(local_only_evt4, 802154_drv_return_void,
49 TP_PROTO(struct ieee802154_local *local),
53 TRACE_EVENT(802154_drv_return_int,
54 TP_PROTO(struct ieee802154_local *local, int ret),
64 TP_printk(LOCAL_PR_FMT ", returned: %d", LOCAL_PR_ARG,
68 DEFINE_EVENT(local_only_evt4, 802154_drv_start,
69 TP_PROTO(struct ieee802154_local *local),
73 DEFINE_EVENT(local_only_evt4, 802154_drv_stop,
74 TP_PROTO(struct ieee802154_local *local),
78 TRACE_EVENT(802154_drv_set_channel,
79 TP_PROTO(struct ieee802154_local *local, u8 page, u8 channel),
80 TP_ARGS(local, page, channel),
89 __entry->channel = channel;
91 TP_printk(LOCAL_PR_FMT ", page: %d, channel: %d", LOCAL_PR_ARG,
92 __entry->page, __entry->channel)
95 TRACE_EVENT(802154_drv_set_cca_mode,
96 TP_PROTO(struct ieee802154_local *local,
97 const struct wpan_phy_cca *cca),
107 TP_printk(LOCAL_PR_FMT ", " CCA_PR_FMT, LOCAL_PR_ARG,
111 TRACE_EVENT(802154_drv_set_cca_ed_level,
112 TP_PROTO(struct ieee802154_local *local, s32 mbm),
122 TP_printk(LOCAL_PR_FMT ", ed level: %d", LOCAL_PR_ARG,
126 TRACE_EVENT(802154_drv_set_tx_power,
127 TP_PROTO(struct ieee802154_local *local, s32 power),
128 TP_ARGS(local, power),
135 __entry->power = power;
137 TP_printk(LOCAL_PR_FMT ", mbm: %d", LOCAL_PR_ARG,
141 TRACE_EVENT(802154_drv_set_lbt_mode,
142 TP_PROTO(struct ieee802154_local *local, bool mode),
143 TP_ARGS(local, mode),
150 __entry->mode = mode;
152 TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
153 BOOL_TO_STR(__entry->mode))
156 TRACE_EVENT(802154_drv_set_short_addr,
157 TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
158 TP_ARGS(local, short_addr),
161 __field(__le16, short_addr)
165 __entry->short_addr = short_addr;
167 TP_printk(LOCAL_PR_FMT ", short addr: 0x%04x", LOCAL_PR_ARG,
168 le16_to_cpu(__entry->short_addr))
171 TRACE_EVENT(802154_drv_set_pan_id,
172 TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
173 TP_ARGS(local, pan_id),
176 __field(__le16, pan_id)
180 __entry->pan_id = pan_id;
182 TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
183 le16_to_cpu(__entry->pan_id))
186 TRACE_EVENT(802154_drv_set_extended_addr,
187 TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
188 TP_ARGS(local, extended_addr),
191 __field(__le64, extended_addr)
195 __entry->extended_addr = extended_addr;
197 TP_printk(LOCAL_PR_FMT ", extended addr: 0x%llx", LOCAL_PR_ARG,
198 le64_to_cpu(__entry->extended_addr))
201 TRACE_EVENT(802154_drv_set_pan_coord,
202 TP_PROTO(struct ieee802154_local *local, bool is_coord),
203 TP_ARGS(local, is_coord),
206 __field(bool, is_coord)
210 __entry->is_coord = is_coord;
212 TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
213 BOOL_TO_STR(__entry->is_coord))
216 TRACE_EVENT(802154_drv_set_csma_params,
217 TP_PROTO(struct ieee802154_local *local, u8 min_be, u8 max_be,
218 u8 max_csma_backoffs),
219 TP_ARGS(local, min_be, max_be, max_csma_backoffs),
224 __field(u8, max_csma_backoffs)
228 __entry->min_be = min_be;
229 __entry->max_be = max_be;
230 __entry->max_csma_backoffs = max_csma_backoffs;
232 TP_printk(LOCAL_PR_FMT ", min be: %d, max be: %d, max csma backoffs: %d",
233 LOCAL_PR_ARG, __entry->min_be, __entry->max_be,
234 __entry->max_csma_backoffs)
237 TRACE_EVENT(802154_drv_set_max_frame_retries,
238 TP_PROTO(struct ieee802154_local *local, s8 max_frame_retries),
239 TP_ARGS(local, max_frame_retries),
242 __field(s8, max_frame_retries)
246 __entry->max_frame_retries = max_frame_retries;
248 TP_printk(LOCAL_PR_FMT ", max frame retries: %d", LOCAL_PR_ARG,
249 __entry->max_frame_retries)
252 TRACE_EVENT(802154_drv_set_promiscuous_mode,
253 TP_PROTO(struct ieee802154_local *local, bool on),
263 TP_printk(LOCAL_PR_FMT ", promiscuous mode: %s", LOCAL_PR_ARG,
264 BOOL_TO_STR(__entry->on))
267 TRACE_EVENT(802154_new_scan_event,
268 TP_PROTO(struct ieee802154_coord_desc *desc),
271 __field(__le16, pan_id)
272 __field(__le64, addr)
277 __entry->page = desc->page;
278 __entry->channel = desc->channel;
279 __entry->pan_id = desc->addr.pan_id;
280 __entry->addr = desc->addr.extended_addr;
282 TP_printk("panid: %u, coord_addr: 0x%llx, page: %u, channel: %u",
283 __le16_to_cpu(__entry->pan_id), __le64_to_cpu(__entry->addr),
284 __entry->page, __entry->channel)
287 DEFINE_EVENT(802154_new_scan_event, 802154_scan_event,
288 TP_PROTO(struct ieee802154_coord_desc *desc),
292 #endif /* !__MAC802154_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
294 #undef TRACE_INCLUDE_PATH
295 #define TRACE_INCLUDE_PATH .
296 #undef TRACE_INCLUDE_FILE
297 #define TRACE_INCLUDE_FILE trace
298 #include <trace/define_trace.h>