blob: 5ac25eb6ed17869821c83d5a360fcafbf41f4a4b [file] [log] [blame]
Guido Günther1cc800e2015-04-30 17:44:55 +02001/* Based on net/wireless/tracing.h */
2
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 ),
59 TP_printk(WPAN_PHY_PR_FMT ", virtual intf name: %s, type: %d, ea %llx",
60 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
96TRACE_EVENT(802154_rdev_set_cca_mode,
97 TP_PROTO(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca),
98 TP_ARGS(wpan_phy, cca),
99 TP_STRUCT__entry(
100 WPAN_PHY_ENTRY
101 WPAN_CCA_ENTRY
102 ),
103 TP_fast_assign(
104 WPAN_PHY_ASSIGN;
105 WPAN_CCA_ASSIGN;
106 ),
107 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
108 WPAN_CCA_PR_ARG)
109);
110
111DECLARE_EVENT_CLASS(802154_le16_template,
112 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
113 __le16 le16arg),
114 TP_ARGS(wpan_phy, wpan_dev, le16arg),
115 TP_STRUCT__entry(
116 WPAN_PHY_ENTRY
117 WPAN_DEV_ENTRY
118 __field(__le16, le16arg)
119 ),
120 TP_fast_assign(
121 WPAN_PHY_ASSIGN;
122 WPAN_DEV_ASSIGN;
123 __entry->le16arg = le16arg;
124 ),
125 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
126 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
127 __le16_to_cpu(__entry->le16arg))
128);
129
130DEFINE_EVENT(802154_le16_template, 802154_rdev_set_pan_id,
131 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
132 __le16 le16arg),
133 TP_ARGS(wpan_phy, wpan_dev, le16arg)
134);
135
136DEFINE_EVENT_PRINT(802154_le16_template, 802154_rdev_set_short_addr,
137 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
138 __le16 le16arg),
139 TP_ARGS(wpan_phy, wpan_dev, le16arg),
140 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", sa: 0x%04x",
Alexander Aring1add1562015-04-30 17:45:04 +0200141 WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
142 __le16_to_cpu(__entry->le16arg))
Guido Günther1cc800e2015-04-30 17:44:55 +0200143);
144
145TRACE_EVENT(802154_rdev_set_backoff_exponent,
146 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
147 u8 min_be, u8 max_be),
148 TP_ARGS(wpan_phy, wpan_dev, min_be, max_be),
149 TP_STRUCT__entry(
150 WPAN_PHY_ENTRY
151 WPAN_DEV_ENTRY
152 __field(u8, min_be)
153 __field(u8, max_be)
154 ),
155 TP_fast_assign(
156 WPAN_PHY_ASSIGN;
157 WPAN_DEV_ASSIGN;
158 __entry->min_be = min_be;
159 __entry->max_be = max_be;
160 ),
161
162 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
163 ", min be: %d, max_be: %d", WPAN_PHY_PR_ARG,
164 WPAN_DEV_PR_ARG, __entry->min_be, __entry->max_be)
165);
166
167TRACE_EVENT(802154_rdev_set_csma_backoffs,
168 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
169 u8 max_csma_backoffs),
170 TP_ARGS(wpan_phy, wpan_dev, max_csma_backoffs),
171 TP_STRUCT__entry(
172 WPAN_PHY_ENTRY
173 WPAN_DEV_ENTRY
174 __field(u8, max_csma_backoffs)
175 ),
176 TP_fast_assign(
177 WPAN_PHY_ASSIGN;
178 WPAN_DEV_ASSIGN;
179 __entry->max_csma_backoffs = max_csma_backoffs;
180 ),
181
182 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
183 ", max csma backoffs: %d", WPAN_PHY_PR_ARG,
184 WPAN_DEV_PR_ARG, __entry->max_csma_backoffs)
185);
186
187TRACE_EVENT(802154_rdev_set_max_frame_retries,
188 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
189 s8 max_frame_retries),
190 TP_ARGS(wpan_phy, wpan_dev, max_frame_retries),
191 TP_STRUCT__entry(
192 WPAN_PHY_ENTRY
193 WPAN_DEV_ENTRY
194 __field(s8, max_frame_retries)
195 ),
196 TP_fast_assign(
197 WPAN_PHY_ASSIGN;
198 WPAN_DEV_ASSIGN;
199 __entry->max_frame_retries = max_frame_retries;
200 ),
201
202 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
203 ", max frame retries: %d", WPAN_PHY_PR_ARG,
204 WPAN_DEV_PR_ARG, __entry->max_frame_retries)
205);
206
207TRACE_EVENT(802154_rdev_set_lbt_mode,
208 TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
209 bool mode),
210 TP_ARGS(wpan_phy, wpan_dev, mode),
211 TP_STRUCT__entry(
212 WPAN_PHY_ENTRY
213 WPAN_DEV_ENTRY
214 __field(bool, mode)
215 ),
216 TP_fast_assign(
217 WPAN_PHY_ASSIGN;
218 WPAN_DEV_ASSIGN;
219 __entry->mode = mode;
220 ),
221 TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
222 ", lbt mode: %s", WPAN_PHY_PR_ARG,
223 WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->mode))
224);
225
226TRACE_EVENT(802154_rdev_return_int,
227 TP_PROTO(struct wpan_phy *wpan_phy, int ret),
228 TP_ARGS(wpan_phy, ret),
229 TP_STRUCT__entry(
230 WPAN_PHY_ENTRY
231 __field(int, ret)
232 ),
233 TP_fast_assign(
234 WPAN_PHY_ASSIGN;
235 __entry->ret = ret;
236 ),
237 TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
238 __entry->ret)
239);
240
241#endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
242
243#undef TRACE_INCLUDE_PATH
244#define TRACE_INCLUDE_PATH .
245#undef TRACE_INCLUDE_FILE
246#define TRACE_INCLUDE_FILE trace
247#include <trace/define_trace.h>