staging: vboxvideo: Embed drm_device into driver structure
[linux/fpc-iii.git] / net / ieee802154 / trace.h
blob19c2e5d60e765d50f96bb02a033241351627dcf4
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Based on net/wireless/trace.h */
4 #undef TRACE_SYSTEM
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>
14 #define MAXNAME 32
15 #define WPAN_PHY_ENTRY __array(char, wpan_phy_name, MAXNAME)
16 #define WPAN_PHY_ASSIGN strlcpy(__entry->wpan_phy_name, \
17 wpan_phy_name(wpan_phy), \
18 MAXNAME)
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 \
31 do { \
32 (__entry->cca_mode) = cca->mode; \
33 (__entry->cca_opt) = cca->opt; \
34 } while (0)
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 /*************************************************************
41 * rdev->ops traces *
42 *************************************************************/
44 DECLARE_EVENT_CLASS(wpan_phy_only_evt,
45 TP_PROTO(struct wpan_phy *wpan_phy),
46 TP_ARGS(wpan_phy),
47 TP_STRUCT__entry(
48 WPAN_PHY_ENTRY
50 TP_fast_assign(
51 WPAN_PHY_ASSIGN;
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),
58 TP_ARGS(wpan_phy)
61 DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_resume,
62 TP_PROTO(struct wpan_phy *wpan_phy),
63 TP_ARGS(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),
70 TP_STRUCT__entry(
71 WPAN_PHY_ENTRY
72 __string(vir_intf_name, name ? name : "<noname>")
73 __field(enum nl802154_iftype, type)
74 __field(__le64, extended_addr)
76 TP_fast_assign(
77 WPAN_PHY_ASSIGN;
78 __assign_str(vir_intf_name, name ? name : "<noname>");
79 __entry->type = type;
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),
90 TP_STRUCT__entry(
91 WPAN_PHY_ENTRY
92 WPAN_DEV_ENTRY
94 TP_fast_assign(
95 WPAN_PHY_ASSIGN;
96 WPAN_DEV_ASSIGN;
98 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT, WPAN_PHY_PR_ARG,
99 WPAN_DEV_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),
105 TP_STRUCT__entry(
106 WPAN_PHY_ENTRY
107 __field(u8, page)
108 __field(u8, channel)
110 TP_fast_assign(
111 WPAN_PHY_ASSIGN;
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),
122 TP_STRUCT__entry(
123 WPAN_PHY_ENTRY
124 __field(s32, power)
126 TP_fast_assign(
127 WPAN_PHY_ASSIGN;
128 __entry->power = power;
130 TP_printk(WPAN_PHY_PR_FMT ", mbm: %d", WPAN_PHY_PR_ARG,
131 __entry->power)
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),
137 TP_STRUCT__entry(
138 WPAN_PHY_ENTRY
139 WPAN_CCA_ENTRY
141 TP_fast_assign(
142 WPAN_PHY_ASSIGN;
143 WPAN_CCA_ASSIGN;
145 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
146 WPAN_CCA_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),
152 TP_STRUCT__entry(
153 WPAN_PHY_ENTRY
154 __field(s32, ed_level)
156 TP_fast_assign(
157 WPAN_PHY_ASSIGN;
158 __entry->ed_level = ed_level;
160 TP_printk(WPAN_PHY_PR_FMT ", ed level: %d", WPAN_PHY_PR_ARG,
161 __entry->ed_level)
164 DECLARE_EVENT_CLASS(802154_le16_template,
165 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
166 __le16 le16arg),
167 TP_ARGS(wpan_phy, wpan_dev, le16arg),
168 TP_STRUCT__entry(
169 WPAN_PHY_ENTRY
170 WPAN_DEV_ENTRY
171 __field(__le16, le16arg)
173 TP_fast_assign(
174 WPAN_PHY_ASSIGN;
175 WPAN_DEV_ASSIGN;
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,
185 __le16 le16arg),
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,
191 __le16 le16arg),
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),
202 TP_STRUCT__entry(
203 WPAN_PHY_ENTRY
204 WPAN_DEV_ENTRY
205 __field(u8, min_be)
206 __field(u8, max_be)
208 TP_fast_assign(
209 WPAN_PHY_ASSIGN;
210 WPAN_DEV_ASSIGN;
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),
224 TP_STRUCT__entry(
225 WPAN_PHY_ENTRY
226 WPAN_DEV_ENTRY
227 __field(u8, max_csma_backoffs)
229 TP_fast_assign(
230 WPAN_PHY_ASSIGN;
231 WPAN_DEV_ASSIGN;
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),
244 TP_STRUCT__entry(
245 WPAN_PHY_ENTRY
246 WPAN_DEV_ENTRY
247 __field(s8, max_frame_retries)
249 TP_fast_assign(
250 WPAN_PHY_ASSIGN;
251 WPAN_DEV_ASSIGN;
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,
262 bool mode),
263 TP_ARGS(wpan_phy, wpan_dev, mode),
264 TP_STRUCT__entry(
265 WPAN_PHY_ENTRY
266 WPAN_DEV_ENTRY
267 __field(bool, mode)
269 TP_fast_assign(
270 WPAN_PHY_ASSIGN;
271 WPAN_DEV_ASSIGN;
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,
281 bool ackreq),
282 TP_ARGS(wpan_phy, wpan_dev, ackreq),
283 TP_STRUCT__entry(
284 WPAN_PHY_ENTRY
285 WPAN_DEV_ENTRY
286 __field(bool, ackreq)
288 TP_fast_assign(
289 WPAN_PHY_ASSIGN;
290 WPAN_DEV_ASSIGN;
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_return_int,
299 TP_PROTO(struct wpan_phy *wpan_phy, int ret),
300 TP_ARGS(wpan_phy, ret),
301 TP_STRUCT__entry(
302 WPAN_PHY_ENTRY
303 __field(int, ret)
305 TP_fast_assign(
306 WPAN_PHY_ASSIGN;
307 __entry->ret = ret;
309 TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
310 __entry->ret)
313 #endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
315 #undef TRACE_INCLUDE_PATH
316 #define TRACE_INCLUDE_PATH .
317 #undef TRACE_INCLUDE_FILE
318 #define TRACE_INCLUDE_FILE trace
319 #include <trace/define_trace.h>