1 /* Based on net/mac80211/trace.h */
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"
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)
25 (__entry->cca_mode) = cca->mode; \
26 (__entry->cca_opt) = cca->opt; \
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
),
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
),
52 TRACE_EVENT(802154_drv_return_int
,
53 TP_PROTO(struct ieee802154_local
*local
, int ret
),
63 TP_printk(LOCAL_PR_FMT
", returned: %d", LOCAL_PR_ARG
,
67 DEFINE_EVENT(local_only_evt
, 802154_drv_start
,
68 TP_PROTO(struct ieee802154_local
*local
),
72 DEFINE_EVENT(local_only_evt
, 802154_drv_stop
,
73 TP_PROTO(struct ieee802154_local
*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
),
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
),
106 TP_printk(LOCAL_PR_FMT
", " CCA_PR_FMT
, LOCAL_PR_ARG
,
110 TRACE_EVENT(802154_drv_set_cca_ed_level
,
111 TP_PROTO(struct ieee802154_local
*local
, s32 mbm
),
121 TP_printk(LOCAL_PR_FMT
", ed level: %d", LOCAL_PR_ARG
,
125 TRACE_EVENT(802154_drv_set_tx_power
,
126 TP_PROTO(struct ieee802154_local
*local
, s32 power
),
127 TP_ARGS(local
, power
),
134 __entry
->power
= power
;
136 TP_printk(LOCAL_PR_FMT
", mbm: %d", LOCAL_PR_ARG
,
140 TRACE_EVENT(802154_drv_set_lbt_mode
,
141 TP_PROTO(struct ieee802154_local
*local
, bool mode
),
142 TP_ARGS(local
, mode
),
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
),
160 __field(__le16
, short_addr
)
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
),
175 __field(__le16
, pan_id
)
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
),
190 __field(__le64
, extended_addr
)
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
),
205 __field(bool, is_coord
)
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
),
223 __field(u8
, max_csma_backoffs
)
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
),
241 __field(s8
, max_frame_retries
)
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
),
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>