blob: 9a471e41ec737270a2d9f364564187f2736aaf19 [file] [log] [blame]
Varka Bhadramdec169e2015-05-27 14:21:06 +05301/* Based on net/wireless/trace.h */
Guido Günther1cc800e2015-04-30 17:44:55 +02002
3#undef TRACE_SYSTEM
4#define TRACE_SYSTEM cfg802154
5
6#if !defined(__RDEV_CFG802154_OPS_TRACE) || defined(TRACE_HEADER_MULTI_READ)
7#define __RDEV_CFG802154_OPS_TRACE
8
9#include <linux/tracepoint.h>
10
11#include <net/cfg802154.h>
12
13#define MAXNAME 32
14#define WPAN_PHY_ENTRY __array(char, wpan_phy_name, MAXNAME)
15#define WPAN_PHY_ASSIGN strlcpy(__entry->wpan_phy_name, \
16 wpan_phy_name(wpan_phy), \
17 MAXNAME)
18#define WPAN_PHY_PR_FMT "%s"
19#define WPAN_PHY_PR_ARG __entry->wpan_phy_name
20
21#define WPAN_DEV_ENTRY __field(u32, identifier)
22#define WPAN_DEV_ASSIGN (__entry->identifier) = (!IS_ERR_OR_NULL(wpan_dev) \
23 ? wpan_dev->identifier : 0)
24#define WPAN_DEV_PR_FMT "wpan_dev(%u)"
25#define WPAN_DEV_PR_ARG (__entry->identifier)
26
27#define WPAN_CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
28 __field(enum nl802154_cca_opts, cca_opt)
29#define WPAN_CCA_ASSIGN \
30 do { \
31 (__entry->cca_mode) = cca->mode; \
32 (__entry->cca_opt) = cca->opt; \
33 } while (0)
34#define WPAN_CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
35#define WPAN_CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
36
37#define BOOL_TO_STR(bo) (bo) ? "true" : "false"
38
39/*************************************************************
40 * rdev->ops traces *
41 *************************************************************/
42
Varka Bhadrama6cb8692015-06-24 11:36:35 +020043DECLARE_EVENT_CLASS(wpan_phy_only_evt,
44 TP_PROTO(struct wpan_phy *wpan_phy),
45 TP_ARGS(wpan_phy),
46 TP_STRUCT__entry(
47 WPAN_PHY_ENTRY
48 ),
49 TP_fast_assign(
50 WPAN_PHY_ASSIGN;
51 ),
52 TP_printk(WPAN_PHY_PR_FMT, WPAN_PHY_PR_ARG)
53);
54
55DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_suspend,
56 TP_PROTO(struct wpan_phy *wpan_phy),
57 TP_ARGS(wpan_phy)
58);
59
60DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_resume,
61 TP_PROTO(struct wpan_phy *wpan_phy),
62 TP_ARGS(wpan_phy)
63);
64
Guido Günther1cc800e2015-04-30 17:44:55 +020065TRACE_EVENT(802154_rdev_add_virtual_intf,
66 TP_PROTO(struct wpan_phy *wpan_phy, char *name,
67 enum nl802154_iftype type, __le64 extended_addr),
68 TP_ARGS(wpan_phy, name, type, extended_addr),
69 TP_STRUCT__entry(
70 WPAN_PHY_ENTRY
71 __string(vir_intf_name, name ? name : "<noname>")
72 __field(enum nl802154_iftype, type)
73 __field(__le64, extended_addr)
74 ),
75 TP_fast_assign(
76 WPAN_PHY_ASSIGN;
77 __assign_str(vir_intf_name, name ? name : "<noname>");
78 __entry->type = type;
79 __entry->extended_addr = extended_addr;
80 ),
Varka Bhadram07bd77f2015-06-03 09:21:47 +053081 TP_printk(WPAN_PHY_PR_FMT ", virtual intf name: %s, type: %d, extended addr: 0x%llx",
Guido Günther1cc800e2015-04-30 17:44:55 +020082 WPAN_PHY_PR_ARG, __get_str(vir_intf_name), __entry->type,
Alexander Aring1add1562015-04-30 17:45:04 +020083 __le64_to_cpu(__entry->extended_addr))
Guido Günther1cc800e2015-04-30 17:44:55 +020084);
85
86TRACE_EVENT(802154_rdev_del_virtual_intf,
87 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
88 TP_ARGS(wpan_phy, wpan_dev),
89 TP_STRUCT__entry(
90 WPAN_PHY_ENTRY
91 WPAN_DEV_ENTRY
92 ),
93 TP_fast_assign(
94 WPAN_PHY_ASSIGN;
95 WPAN_DEV_ASSIGN;
96 ),
97 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT, WPAN_PHY_PR_ARG,
98 WPAN_DEV_PR_ARG)
99);
100
101TRACE_EVENT(802154_rdev_set_channel,
102 TP_PROTO(struct wpan_phy *wpan_phy, u8 page, u8 channel),
103 TP_ARGS(wpan_phy, page, channel),
104 TP_STRUCT__entry(
105 WPAN_PHY_ENTRY
106 __field(u8, page)
107 __field(u8, channel)
108 ),
109 TP_fast_assign(
110 WPAN_PHY_ASSIGN;
111 __entry->page = page;
112 __entry->channel = channel;
113 ),
114 TP_printk(WPAN_PHY_PR_FMT ", page: %d, channel: %d", WPAN_PHY_PR_ARG,
115 __entry->page, __entry->channel)
116);
117
Varka Bhadram0f999b02015-05-27 09:10:54 +0530118TRACE_EVENT(802154_rdev_set_tx_power,
119 TP_PROTO(struct wpan_phy *wpan_phy, s32 power),
120 TP_ARGS(wpan_phy, power),
121 TP_STRUCT__entry(
122 WPAN_PHY_ENTRY
123 __field(s32, power)
124 ),
125 TP_fast_assign(
126 WPAN_PHY_ASSIGN;
127 __entry->power = power;
128 ),
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530129 TP_printk(WPAN_PHY_PR_FMT ", mbm: %d", WPAN_PHY_PR_ARG,
Varka Bhadram0f999b02015-05-27 09:10:54 +0530130 __entry->power)
131);
132
Guido Günther1cc800e2015-04-30 17:44:55 +0200133TRACE_EVENT(802154_rdev_set_cca_mode,
134 TP_PROTO(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca),
135 TP_ARGS(wpan_phy, cca),
136 TP_STRUCT__entry(
137 WPAN_PHY_ENTRY
138 WPAN_CCA_ENTRY
139 ),
140 TP_fast_assign(
141 WPAN_PHY_ASSIGN;
142 WPAN_CCA_ASSIGN;
143 ),
144 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
145 WPAN_CCA_PR_ARG)
146);
147
Alexander Aringb69644c2015-05-27 13:42:10 +0200148TRACE_EVENT(802154_rdev_set_cca_ed_level,
149 TP_PROTO(struct wpan_phy *wpan_phy, s32 ed_level),
150 TP_ARGS(wpan_phy, ed_level),
151 TP_STRUCT__entry(
152 WPAN_PHY_ENTRY
153 __field(s32, ed_level)
154 ),
155 TP_fast_assign(
156 WPAN_PHY_ASSIGN;
157 __entry->ed_level = ed_level;
158 ),
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530159 TP_printk(WPAN_PHY_PR_FMT ", ed level: %d", WPAN_PHY_PR_ARG,
Alexander Aringb69644c2015-05-27 13:42:10 +0200160 __entry->ed_level)
161);
162
Guido Günther1cc800e2015-04-30 17:44:55 +0200163DECLARE_EVENT_CLASS(802154_le16_template,
164 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
165 __le16 le16arg),
166 TP_ARGS(wpan_phy, wpan_dev, le16arg),
167 TP_STRUCT__entry(
168 WPAN_PHY_ENTRY
169 WPAN_DEV_ENTRY
170 __field(__le16, le16arg)
171 ),
172 TP_fast_assign(
173 WPAN_PHY_ASSIGN;
174 WPAN_DEV_ASSIGN;
175 __entry->le16arg = le16arg;
176 ),
177 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
178 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
179 __le16_to_cpu(__entry->le16arg))
180);
181
182DEFINE_EVENT(802154_le16_template, 802154_rdev_set_pan_id,
183 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
184 __le16 le16arg),
185 TP_ARGS(wpan_phy, wpan_dev, le16arg)
186);
187
188DEFINE_EVENT_PRINT(802154_le16_template, 802154_rdev_set_short_addr,
189 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
190 __le16 le16arg),
191 TP_ARGS(wpan_phy, wpan_dev, le16arg),
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530192 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", short addr: 0x%04x",
Alexander Aring1add1562015-04-30 17:45:04 +0200193 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
194 __le16_to_cpu(__entry->le16arg))
Guido Günther1cc800e2015-04-30 17:44:55 +0200195);
196
197TRACE_EVENT(802154_rdev_set_backoff_exponent,
198 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
199 u8 min_be, u8 max_be),
200 TP_ARGS(wpan_phy, wpan_dev, min_be, max_be),
201 TP_STRUCT__entry(
202 WPAN_PHY_ENTRY
203 WPAN_DEV_ENTRY
204 __field(u8, min_be)
205 __field(u8, max_be)
206 ),
207 TP_fast_assign(
208 WPAN_PHY_ASSIGN;
209 WPAN_DEV_ASSIGN;
210 __entry->min_be = min_be;
211 __entry->max_be = max_be;
212 ),
213
214 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530215 ", min be: %d, max be: %d", WPAN_PHY_PR_ARG,
Guido Günther1cc800e2015-04-30 17:44:55 +0200216 WPAN_DEV_PR_ARG, __entry->min_be, __entry->max_be)
217);
218
219TRACE_EVENT(802154_rdev_set_csma_backoffs,
220 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
221 u8 max_csma_backoffs),
222 TP_ARGS(wpan_phy, wpan_dev, max_csma_backoffs),
223 TP_STRUCT__entry(
224 WPAN_PHY_ENTRY
225 WPAN_DEV_ENTRY
226 __field(u8, max_csma_backoffs)
227 ),
228 TP_fast_assign(
229 WPAN_PHY_ASSIGN;
230 WPAN_DEV_ASSIGN;
231 __entry->max_csma_backoffs = max_csma_backoffs;
232 ),
233
234 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
235 ", max csma backoffs: %d", WPAN_PHY_PR_ARG,
236 WPAN_DEV_PR_ARG, __entry->max_csma_backoffs)
237);
238
239TRACE_EVENT(802154_rdev_set_max_frame_retries,
240 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
241 s8 max_frame_retries),
242 TP_ARGS(wpan_phy, wpan_dev, max_frame_retries),
243 TP_STRUCT__entry(
244 WPAN_PHY_ENTRY
245 WPAN_DEV_ENTRY
246 __field(s8, max_frame_retries)
247 ),
248 TP_fast_assign(
249 WPAN_PHY_ASSIGN;
250 WPAN_DEV_ASSIGN;
251 __entry->max_frame_retries = max_frame_retries;
252 ),
253
254 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
255 ", max frame retries: %d", WPAN_PHY_PR_ARG,
256 WPAN_DEV_PR_ARG, __entry->max_frame_retries)
257);
258
259TRACE_EVENT(802154_rdev_set_lbt_mode,
260 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
261 bool mode),
262 TP_ARGS(wpan_phy, wpan_dev, mode),
263 TP_STRUCT__entry(
264 WPAN_PHY_ENTRY
265 WPAN_DEV_ENTRY
266 __field(bool, mode)
267 ),
268 TP_fast_assign(
269 WPAN_PHY_ASSIGN;
270 WPAN_DEV_ASSIGN;
271 __entry->mode = mode;
272 ),
273 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
274 ", lbt mode: %s", WPAN_PHY_PR_ARG,
275 WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->mode))
276);
277
Alexander Aringc91208d2015-08-10 21:15:58 +0200278TRACE_EVENT(802154_rdev_set_ackreq_default,
279 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
280 bool ackreq),
281 TP_ARGS(wpan_phy, wpan_dev, ackreq),
282 TP_STRUCT__entry(
283 WPAN_PHY_ENTRY
284 WPAN_DEV_ENTRY
285 __field(bool, ackreq)
286 ),
287 TP_fast_assign(
288 WPAN_PHY_ASSIGN;
289 WPAN_DEV_ASSIGN;
290 __entry->ackreq = ackreq;
291 ),
292 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
293 ", ackreq default: %s", WPAN_PHY_PR_ARG,
294 WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->ackreq))
295);
296
Guido Günther1cc800e2015-04-30 17:44:55 +0200297TRACE_EVENT(802154_rdev_return_int,
298 TP_PROTO(struct wpan_phy *wpan_phy, int ret),
299 TP_ARGS(wpan_phy, ret),
300 TP_STRUCT__entry(
301 WPAN_PHY_ENTRY
302 __field(int, ret)
303 ),
304 TP_fast_assign(
305 WPAN_PHY_ASSIGN;
306 __entry->ret = ret;
307 ),
308 TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
309 __entry->ret)
310);
311
312#endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
313
314#undef TRACE_INCLUDE_PATH
315#define TRACE_INCLUDE_PATH .
316#undef TRACE_INCLUDE_FILE
317#define TRACE_INCLUDE_FILE trace
318#include <trace/define_trace.h>