blob: 9b5f0eb366969c0c968935389b97ad0893b41cf1 [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
43TRACE_EVENT(802154_rdev_add_virtual_intf,
44 TP_PROTO(struct wpan_phy *wpan_phy, char *name,
45 enum nl802154_iftype type, __le64 extended_addr),
46 TP_ARGS(wpan_phy, name, type, extended_addr),
47 TP_STRUCT__entry(
48 WPAN_PHY_ENTRY
49 __string(vir_intf_name, name ? name : "<noname>")
50 __field(enum nl802154_iftype, type)
51 __field(__le64, extended_addr)
52 ),
53 TP_fast_assign(
54 WPAN_PHY_ASSIGN;
55 __assign_str(vir_intf_name, name ? name : "<noname>");
56 __entry->type = type;
57 __entry->extended_addr = extended_addr;
58 ),
Varka Bhadram07bd77f2015-06-03 09:21:47 +053059 TP_printk(WPAN_PHY_PR_FMT ", virtual intf name: %s, type: %d, extended addr: 0x%llx",
Guido Günther1cc800e2015-04-30 17:44:55 +020060 WPAN_PHY_PR_ARG, __get_str(vir_intf_name), __entry->type,
Alexander Aring1add1562015-04-30 17:45:04 +020061 __le64_to_cpu(__entry->extended_addr))
Guido Günther1cc800e2015-04-30 17:44:55 +020062);
63
64TRACE_EVENT(802154_rdev_del_virtual_intf,
65 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
66 TP_ARGS(wpan_phy, wpan_dev),
67 TP_STRUCT__entry(
68 WPAN_PHY_ENTRY
69 WPAN_DEV_ENTRY
70 ),
71 TP_fast_assign(
72 WPAN_PHY_ASSIGN;
73 WPAN_DEV_ASSIGN;
74 ),
75 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT, WPAN_PHY_PR_ARG,
76 WPAN_DEV_PR_ARG)
77);
78
79TRACE_EVENT(802154_rdev_set_channel,
80 TP_PROTO(struct wpan_phy *wpan_phy, u8 page, u8 channel),
81 TP_ARGS(wpan_phy, page, channel),
82 TP_STRUCT__entry(
83 WPAN_PHY_ENTRY
84 __field(u8, page)
85 __field(u8, channel)
86 ),
87 TP_fast_assign(
88 WPAN_PHY_ASSIGN;
89 __entry->page = page;
90 __entry->channel = channel;
91 ),
92 TP_printk(WPAN_PHY_PR_FMT ", page: %d, channel: %d", WPAN_PHY_PR_ARG,
93 __entry->page, __entry->channel)
94);
95
Varka Bhadram0f999b02015-05-27 09:10:54 +053096TRACE_EVENT(802154_rdev_set_tx_power,
97 TP_PROTO(struct wpan_phy *wpan_phy, s32 power),
98 TP_ARGS(wpan_phy, power),
99 TP_STRUCT__entry(
100 WPAN_PHY_ENTRY
101 __field(s32, power)
102 ),
103 TP_fast_assign(
104 WPAN_PHY_ASSIGN;
105 __entry->power = power;
106 ),
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530107 TP_printk(WPAN_PHY_PR_FMT ", mbm: %d", WPAN_PHY_PR_ARG,
Varka Bhadram0f999b02015-05-27 09:10:54 +0530108 __entry->power)
109);
110
Guido Günther1cc800e2015-04-30 17:44:55 +0200111TRACE_EVENT(802154_rdev_set_cca_mode,
112 TP_PROTO(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca),
113 TP_ARGS(wpan_phy, cca),
114 TP_STRUCT__entry(
115 WPAN_PHY_ENTRY
116 WPAN_CCA_ENTRY
117 ),
118 TP_fast_assign(
119 WPAN_PHY_ASSIGN;
120 WPAN_CCA_ASSIGN;
121 ),
122 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
123 WPAN_CCA_PR_ARG)
124);
125
Alexander Aringb69644c2015-05-27 13:42:10 +0200126TRACE_EVENT(802154_rdev_set_cca_ed_level,
127 TP_PROTO(struct wpan_phy *wpan_phy, s32 ed_level),
128 TP_ARGS(wpan_phy, ed_level),
129 TP_STRUCT__entry(
130 WPAN_PHY_ENTRY
131 __field(s32, ed_level)
132 ),
133 TP_fast_assign(
134 WPAN_PHY_ASSIGN;
135 __entry->ed_level = ed_level;
136 ),
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530137 TP_printk(WPAN_PHY_PR_FMT ", ed level: %d", WPAN_PHY_PR_ARG,
Alexander Aringb69644c2015-05-27 13:42:10 +0200138 __entry->ed_level)
139);
140
Guido Günther1cc800e2015-04-30 17:44:55 +0200141DECLARE_EVENT_CLASS(802154_le16_template,
142 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
143 __le16 le16arg),
144 TP_ARGS(wpan_phy, wpan_dev, le16arg),
145 TP_STRUCT__entry(
146 WPAN_PHY_ENTRY
147 WPAN_DEV_ENTRY
148 __field(__le16, le16arg)
149 ),
150 TP_fast_assign(
151 WPAN_PHY_ASSIGN;
152 WPAN_DEV_ASSIGN;
153 __entry->le16arg = le16arg;
154 ),
155 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
156 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
157 __le16_to_cpu(__entry->le16arg))
158);
159
160DEFINE_EVENT(802154_le16_template, 802154_rdev_set_pan_id,
161 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
162 __le16 le16arg),
163 TP_ARGS(wpan_phy, wpan_dev, le16arg)
164);
165
166DEFINE_EVENT_PRINT(802154_le16_template, 802154_rdev_set_short_addr,
167 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
168 __le16 le16arg),
169 TP_ARGS(wpan_phy, wpan_dev, le16arg),
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530170 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", short addr: 0x%04x",
Alexander Aring1add1562015-04-30 17:45:04 +0200171 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
172 __le16_to_cpu(__entry->le16arg))
Guido Günther1cc800e2015-04-30 17:44:55 +0200173);
174
175TRACE_EVENT(802154_rdev_set_backoff_exponent,
176 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
177 u8 min_be, u8 max_be),
178 TP_ARGS(wpan_phy, wpan_dev, min_be, max_be),
179 TP_STRUCT__entry(
180 WPAN_PHY_ENTRY
181 WPAN_DEV_ENTRY
182 __field(u8, min_be)
183 __field(u8, max_be)
184 ),
185 TP_fast_assign(
186 WPAN_PHY_ASSIGN;
187 WPAN_DEV_ASSIGN;
188 __entry->min_be = min_be;
189 __entry->max_be = max_be;
190 ),
191
192 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
Varka Bhadram07bd77f2015-06-03 09:21:47 +0530193 ", min be: %d, max be: %d", WPAN_PHY_PR_ARG,
Guido Günther1cc800e2015-04-30 17:44:55 +0200194 WPAN_DEV_PR_ARG, __entry->min_be, __entry->max_be)
195);
196
197TRACE_EVENT(802154_rdev_set_csma_backoffs,
198 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
199 u8 max_csma_backoffs),
200 TP_ARGS(wpan_phy, wpan_dev, max_csma_backoffs),
201 TP_STRUCT__entry(
202 WPAN_PHY_ENTRY
203 WPAN_DEV_ENTRY
204 __field(u8, max_csma_backoffs)
205 ),
206 TP_fast_assign(
207 WPAN_PHY_ASSIGN;
208 WPAN_DEV_ASSIGN;
209 __entry->max_csma_backoffs = max_csma_backoffs;
210 ),
211
212 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
213 ", max csma backoffs: %d", WPAN_PHY_PR_ARG,
214 WPAN_DEV_PR_ARG, __entry->max_csma_backoffs)
215);
216
217TRACE_EVENT(802154_rdev_set_max_frame_retries,
218 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
219 s8 max_frame_retries),
220 TP_ARGS(wpan_phy, wpan_dev, max_frame_retries),
221 TP_STRUCT__entry(
222 WPAN_PHY_ENTRY
223 WPAN_DEV_ENTRY
224 __field(s8, max_frame_retries)
225 ),
226 TP_fast_assign(
227 WPAN_PHY_ASSIGN;
228 WPAN_DEV_ASSIGN;
229 __entry->max_frame_retries = max_frame_retries;
230 ),
231
232 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
233 ", max frame retries: %d", WPAN_PHY_PR_ARG,
234 WPAN_DEV_PR_ARG, __entry->max_frame_retries)
235);
236
237TRACE_EVENT(802154_rdev_set_lbt_mode,
238 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
239 bool mode),
240 TP_ARGS(wpan_phy, wpan_dev, mode),
241 TP_STRUCT__entry(
242 WPAN_PHY_ENTRY
243 WPAN_DEV_ENTRY
244 __field(bool, mode)
245 ),
246 TP_fast_assign(
247 WPAN_PHY_ASSIGN;
248 WPAN_DEV_ASSIGN;
249 __entry->mode = mode;
250 ),
251 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
252 ", lbt mode: %s", WPAN_PHY_PR_ARG,
253 WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->mode))
254);
255
256TRACE_EVENT(802154_rdev_return_int,
257 TP_PROTO(struct wpan_phy *wpan_phy, int ret),
258 TP_ARGS(wpan_phy, ret),
259 TP_STRUCT__entry(
260 WPAN_PHY_ENTRY
261 __field(int, ret)
262 ),
263 TP_fast_assign(
264 WPAN_PHY_ASSIGN;
265 __entry->ret = ret;
266 ),
267 TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
268 __entry->ret)
269);
270
271#endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
272
273#undef TRACE_INCLUDE_PATH
274#define TRACE_INCLUDE_PATH .
275#undef TRACE_INCLUDE_FILE
276#define TRACE_INCLUDE_FILE trace
277#include <trace/define_trace.h>