1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Based on net/wireless/trace.h */
5 #define TRACE_SYSTEM cfg802154
7 #if !defined(__RDEV_CFG802154_OPS_TRACE) || defined(TRACE_HEADER_MULTI_READ)
8 #define __RDEV_CFG802154_OPS_TRACE
10 #include <linux/tracepoint.h>
12 #include <net/cfg802154.h>
15 #define WPAN_PHY_ENTRY __array(char, wpan_phy_name, MAXNAME)
16 #define WPAN_PHY_ASSIGN strscpy(__entry->wpan_phy_name, \
17 wpan_phy_name(wpan_phy), \
19 #define WPAN_PHY_PR_FMT "%s"
20 #define WPAN_PHY_PR_ARG __entry->wpan_phy_name
22 #define WPAN_DEV_ENTRY __field(u32, identifier)
23 #define WPAN_DEV_ASSIGN (__entry->identifier) = (!IS_ERR_OR_NULL(wpan_dev) \
24 ? wpan_dev->identifier : 0)
25 #define WPAN_DEV_PR_FMT "wpan_dev(%u)"
26 #define WPAN_DEV_PR_ARG (__entry->identifier)
28 #define WPAN_CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
29 __field(enum nl802154_cca_opts, cca_opt)
30 #define WPAN_CCA_ASSIGN \
32 (__entry->cca_mode) = cca->mode; \
33 (__entry->cca_opt) = cca->opt; \
35 #define WPAN_CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
36 #define WPAN_CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
38 #define BOOL_TO_STR(bo) (bo) ? "true" : "false"
40 /*************************************************************
42 *************************************************************/
44 DECLARE_EVENT_CLASS(wpan_phy_only_evt
,
45 TP_PROTO(struct wpan_phy
*wpan_phy
),
53 TP_printk(WPAN_PHY_PR_FMT
, WPAN_PHY_PR_ARG
)
56 DEFINE_EVENT(wpan_phy_only_evt
, 802154_rdev_suspend
,
57 TP_PROTO(struct wpan_phy
*wpan_phy
),
61 DEFINE_EVENT(wpan_phy_only_evt
, 802154_rdev_resume
,
62 TP_PROTO(struct wpan_phy
*wpan_phy
),
66 TRACE_EVENT(802154_rdev_add_virtual_intf
,
67 TP_PROTO(struct wpan_phy
*wpan_phy
, char *name
,
68 enum nl802154_iftype type
, __le64 extended_addr
),
69 TP_ARGS(wpan_phy
, name
, type
, extended_addr
),
72 __string(vir_intf_name
, name
? name
: "<noname>")
73 __field(enum nl802154_iftype
, type
)
74 __field(__le64
, extended_addr
)
78 __assign_str(vir_intf_name
);
80 __entry
->extended_addr
= extended_addr
;
82 TP_printk(WPAN_PHY_PR_FMT
", virtual intf name: %s, type: %d, extended addr: 0x%llx",
83 WPAN_PHY_PR_ARG
, __get_str(vir_intf_name
), __entry
->type
,
84 __le64_to_cpu(__entry
->extended_addr
))
87 TRACE_EVENT(802154_rdev_del_virtual_intf
,
88 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
),
89 TP_ARGS(wpan_phy
, wpan_dev
),
98 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
, WPAN_PHY_PR_ARG
,
102 TRACE_EVENT(802154_rdev_set_channel
,
103 TP_PROTO(struct wpan_phy
*wpan_phy
, u8 page
, u8 channel
),
104 TP_ARGS(wpan_phy
, page
, channel
),
112 __entry
->page
= page
;
113 __entry
->channel
= channel
;
115 TP_printk(WPAN_PHY_PR_FMT
", page: %d, channel: %d", WPAN_PHY_PR_ARG
,
116 __entry
->page
, __entry
->channel
)
119 TRACE_EVENT(802154_rdev_set_tx_power
,
120 TP_PROTO(struct wpan_phy
*wpan_phy
, s32 power
),
121 TP_ARGS(wpan_phy
, power
),
128 __entry
->power
= power
;
130 TP_printk(WPAN_PHY_PR_FMT
", mbm: %d", WPAN_PHY_PR_ARG
,
134 TRACE_EVENT(802154_rdev_set_cca_mode
,
135 TP_PROTO(struct wpan_phy
*wpan_phy
, const struct wpan_phy_cca
*cca
),
136 TP_ARGS(wpan_phy
, cca
),
145 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_CCA_PR_FMT
, WPAN_PHY_PR_ARG
,
149 TRACE_EVENT(802154_rdev_set_cca_ed_level
,
150 TP_PROTO(struct wpan_phy
*wpan_phy
, s32 ed_level
),
151 TP_ARGS(wpan_phy
, ed_level
),
154 __field(s32
, ed_level
)
158 __entry
->ed_level
= ed_level
;
160 TP_printk(WPAN_PHY_PR_FMT
", ed level: %d", WPAN_PHY_PR_ARG
,
164 DECLARE_EVENT_CLASS(802154_le16_template
,
165 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
167 TP_ARGS(wpan_phy
, wpan_dev
, le16arg
),
171 __field(__le16
, le16arg
)
176 __entry
->le16arg
= le16arg
;
178 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
", pan id: 0x%04x",
179 WPAN_PHY_PR_ARG
, WPAN_DEV_PR_ARG
,
180 __le16_to_cpu(__entry
->le16arg
))
183 DEFINE_EVENT(802154_le16_template
, 802154_rdev_set_pan_id
,
184 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
186 TP_ARGS(wpan_phy
, wpan_dev
, le16arg
)
189 DEFINE_EVENT_PRINT(802154_le16_template
, 802154_rdev_set_short_addr
,
190 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
192 TP_ARGS(wpan_phy
, wpan_dev
, le16arg
),
193 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
", short addr: 0x%04x",
194 WPAN_PHY_PR_ARG
, WPAN_DEV_PR_ARG
,
195 __le16_to_cpu(__entry
->le16arg
))
198 TRACE_EVENT(802154_rdev_set_backoff_exponent
,
199 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
200 u8 min_be
, u8 max_be
),
201 TP_ARGS(wpan_phy
, wpan_dev
, min_be
, max_be
),
211 __entry
->min_be
= min_be
;
212 __entry
->max_be
= max_be
;
215 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
216 ", min be: %d, max be: %d", WPAN_PHY_PR_ARG
,
217 WPAN_DEV_PR_ARG
, __entry
->min_be
, __entry
->max_be
)
220 TRACE_EVENT(802154_rdev_set_csma_backoffs
,
221 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
222 u8 max_csma_backoffs
),
223 TP_ARGS(wpan_phy
, wpan_dev
, max_csma_backoffs
),
227 __field(u8
, max_csma_backoffs
)
232 __entry
->max_csma_backoffs
= max_csma_backoffs
;
235 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
236 ", max csma backoffs: %d", WPAN_PHY_PR_ARG
,
237 WPAN_DEV_PR_ARG
, __entry
->max_csma_backoffs
)
240 TRACE_EVENT(802154_rdev_set_max_frame_retries
,
241 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
242 s8 max_frame_retries
),
243 TP_ARGS(wpan_phy
, wpan_dev
, max_frame_retries
),
247 __field(s8
, max_frame_retries
)
252 __entry
->max_frame_retries
= max_frame_retries
;
255 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
256 ", max frame retries: %d", WPAN_PHY_PR_ARG
,
257 WPAN_DEV_PR_ARG
, __entry
->max_frame_retries
)
260 TRACE_EVENT(802154_rdev_set_lbt_mode
,
261 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
263 TP_ARGS(wpan_phy
, wpan_dev
, mode
),
272 __entry
->mode
= mode
;
274 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
275 ", lbt mode: %s", WPAN_PHY_PR_ARG
,
276 WPAN_DEV_PR_ARG
, BOOL_TO_STR(__entry
->mode
))
279 TRACE_EVENT(802154_rdev_set_ackreq_default
,
280 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
,
282 TP_ARGS(wpan_phy
, wpan_dev
, ackreq
),
286 __field(bool, ackreq
)
291 __entry
->ackreq
= ackreq
;
293 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
294 ", ackreq default: %s", WPAN_PHY_PR_ARG
,
295 WPAN_DEV_PR_ARG
, BOOL_TO_STR(__entry
->ackreq
))
298 TRACE_EVENT(802154_rdev_trigger_scan
,
299 TP_PROTO(struct wpan_phy
*wpan_phy
,
300 struct cfg802154_scan_request
*request
),
301 TP_ARGS(wpan_phy
, request
),
305 __field(u32
, channels
)
306 __field(u8
, duration
)
310 __entry
->page
= request
->page
;
311 __entry
->channels
= request
->channels
;
312 __entry
->duration
= request
->duration
;
314 TP_printk(WPAN_PHY_PR_FMT
", scan, page: %d, channels: %x, duration %d",
315 WPAN_PHY_PR_ARG
, __entry
->page
, __entry
->channels
, __entry
->duration
)
318 TRACE_EVENT(802154_rdev_send_beacons
,
319 TP_PROTO(struct wpan_phy
*wpan_phy
,
320 struct cfg802154_beacon_request
*request
),
321 TP_ARGS(wpan_phy
, request
),
324 __field(u8
, interval
)
328 __entry
->interval
= request
->interval
;
330 TP_printk(WPAN_PHY_PR_FMT
", sending beacons (interval order: %d)",
331 WPAN_PHY_PR_ARG
, __entry
->interval
)
334 DECLARE_EVENT_CLASS(802154_wdev_template
,
335 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
),
336 TP_ARGS(wpan_phy
, wpan_dev
),
345 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
,
346 WPAN_PHY_PR_ARG
, WPAN_DEV_PR_ARG
)
349 DEFINE_EVENT(802154_wdev_template
, 802154_rdev_abort_scan
,
350 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
),
351 TP_ARGS(wpan_phy
, wpan_dev
)
354 DEFINE_EVENT(802154_wdev_template
, 802154_rdev_stop_beacons
,
355 TP_PROTO(struct wpan_phy
*wpan_phy
, struct wpan_dev
*wpan_dev
),
356 TP_ARGS(wpan_phy
, wpan_dev
)
359 TRACE_EVENT(802154_rdev_associate
,
360 TP_PROTO(struct wpan_phy
*wpan_phy
,
361 struct wpan_dev
*wpan_dev
,
362 struct ieee802154_addr
*coord
),
363 TP_ARGS(wpan_phy
, wpan_dev
, coord
),
367 __field(__le64
, addr
)
372 __entry
->addr
= coord
->extended_addr
;
374 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
", associating with: 0x%llx",
375 WPAN_PHY_PR_ARG
, WPAN_DEV_PR_ARG
, __entry
->addr
)
378 TRACE_EVENT(802154_rdev_disassociate
,
379 TP_PROTO(struct wpan_phy
*wpan_phy
,
380 struct wpan_dev
*wpan_dev
,
381 struct ieee802154_addr
*target
),
382 TP_ARGS(wpan_phy
, wpan_dev
, target
),
386 __field(__le64
, addr
)
391 __entry
->addr
= target
->extended_addr
;
393 TP_printk(WPAN_PHY_PR_FMT
", " WPAN_DEV_PR_FMT
", disassociating with: 0x%llx",
394 WPAN_PHY_PR_ARG
, WPAN_DEV_PR_ARG
, __entry
->addr
)
397 TRACE_EVENT(802154_rdev_return_int
,
398 TP_PROTO(struct wpan_phy
*wpan_phy
, int ret
),
399 TP_ARGS(wpan_phy
, ret
),
408 TP_printk(WPAN_PHY_PR_FMT
", returned: %d", WPAN_PHY_PR_ARG
,
412 #endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
414 #undef TRACE_INCLUDE_PATH
415 #define TRACE_INCLUDE_PATH .
416 #undef TRACE_INCLUDE_FILE
417 #define TRACE_INCLUDE_FILE trace
418 #include <trace/define_trace.h>