summaryrefslogtreecommitdiffstats
path: root/kernel/net/mac802154/trace.h
blob: 6f30e0c93a160f9f58cfd3195e4c35fe22d606cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* Based on net/mac80211/trace.h */

#undef TRACE_SYSTEM
#define TRACE_SYSTEM mac802154

#if !defined(__MAC802154_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
#define __MAC802154_DRIVER_TRACE

#include <linux/tracepoint.h>

#include <net/mac802154.h>
#include "ieee802154_i.h"

#define MAXNAME		32
#define LOCAL_ENTRY	__array(char, wpan_phy_name, MAXNAME)
#define LOCAL_ASSIGN	strlcpy(__entry->wpan_phy_name, \
				wpan_phy_name(local->hw.phy), MAXNAME)
#define LOCAL_PR_FMT	"%s"
#define LOCAL_PR_ARG	__entry->wpan_phy_name

#define CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
		  __field(enum nl802154_cca_opts, cca_opt)
#define CCA_ASSIGN \
	do {                                     \
		(__entry->cca_mode) = cca->mode; \
		(__entry->cca_opt) = cca->opt;   \
	} while (0)
#define CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
#define CCA_PR_ARG __entry->cca_mode, __entry->cca_opt

#define BOOL_TO_STR(bo) (bo) ? "true" : "false"

/* Tracing for driver callbacks */

DECLARE_EVENT_CLASS(local_only_evt,
	TP_PROTO(struct ieee802154_local *local),
	TP_ARGS(local),
	TP_STRUCT__entry(
		LOCAL_ENTRY
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
	),
	TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
);

DEFINE_EVENT(local_only_evt, 802154_drv_return_void,
	TP_PROTO(struct ieee802154_local *local),
	TP_ARGS(local)
);

TRACE_EVENT(802154_drv_return_int,
	TP_PROTO(struct ieee802154_local *local, int ret),
	TP_ARGS(local, ret),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(int, ret)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->ret = ret;
	),
	TP_printk(LOCAL_PR_FMT ", returned: %d", LOCAL_PR_ARG,
		  __entry->ret)
);

DEFINE_EVENT(local_only_evt, 802154_drv_start,
	TP_PROTO(struct ieee802154_local *local),
	TP_ARGS(local)
);

DEFINE_EVENT(local_only_evt, 802154_drv_stop,
	TP_PROTO(struct ieee802154_local *local),
	TP_ARGS(local)
);

TRACE_EVENT(802154_drv_set_channel,
	TP_PROTO(struct ieee802154_local *local, u8 page, u8 channel),
	TP_ARGS(local, page, channel),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(u8, page)
		__field(u8, channel)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->page = page;
		__entry->channel = channel;
	),
	TP_printk(LOCAL_PR_FMT ", page: %d, channel: %d", LOCAL_PR_ARG,
		  __entry->page, __entry->channel)
);

TRACE_EVENT(802154_drv_set_cca_mode,
	TP_PROTO(struct ieee802154_local *local,
		 const struct wpan_phy_cca *cca),
	TP_ARGS(local, cca),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		CCA_ENTRY
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		CCA_ASSIGN;
	),
	TP_printk(LOCAL_PR_FMT ", " CCA_PR_FMT, LOCAL_PR_ARG,
		  CCA_PR_ARG)
);

TRACE_EVENT(802154_drv_set_cca_ed_level,
	TP_PROTO(struct ieee802154_local *local, s32 mbm),
	TP_ARGS(local, mbm),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(s32, mbm)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->mbm = mbm;
	),
	TP_printk(LOCAL_PR_FMT ", ed level: %d", LOCAL_PR_ARG,
		  __entry->mbm)
);

TRACE_EVENT(802154_drv_set_tx_power,
	TP_PROTO(struct ieee802154_local *local, s32 power),
	TP_ARGS(local, power),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(s32, power)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->power = power;
	),
	TP_printk(LOCAL_PR_FMT ", mbm: %d", LOCAL_PR_ARG,
		 __entry->power)
);

TRACE_EVENT(802154_drv_set_lbt_mode,
	TP_PROTO(struct ieee802154_local *local, bool mode),
	TP_ARGS(local, mode),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(bool, mode)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->mode = mode;
	),
	TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
		  BOOL_TO_STR(__entry->mode))
);

TRACE_EVENT(802154_drv_set_short_addr,
	TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
	TP_ARGS(local, short_addr),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(__le16, short_addr)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->short_addr = short_addr;
	),
	TP_printk(LOCAL_PR_FMT ", short addr: 0x%04x", LOCAL_PR_ARG,
		  le16_to_cpu(__entry->short_addr))
);

TRACE_EVENT(802154_drv_set_pan_id,
	TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
	TP_ARGS(local, pan_id),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(__le16, pan_id)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->pan_id = pan_id;
	),
	TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
		  le16_to_cpu(__entry->pan_id))
);

TRACE_EVENT(802154_drv_set_extended_addr,
	TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
	TP_ARGS(local, extended_addr),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(__le64, extended_addr)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->extended_addr = extended_addr;
	),
	TP_printk(LOCAL_PR_FMT ", extended addr: 0x%llx", LOCAL_PR_ARG,
		  le64_to_cpu(__entry->extended_addr))
);

TRACE_EVENT(802154_drv_set_pan_coord,
	TP_PROTO(struct ieee802154_local *local, bool is_coord),
	TP_ARGS(local, is_coord),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(bool, is_coord)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->is_coord = is_coord;
	),
	TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
		  BOOL_TO_STR(__entry->is_coord))
);

TRACE_EVENT(802154_drv_set_csma_params,
	TP_PROTO(struct ieee802154_local *local, u8 min_be, u8 max_be,
		 u8 max_csma_backoffs),
	TP_ARGS(local, min_be, max_be, max_csma_backoffs),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(u8, min_be)
		__field(u8, max_be)
		__field(u8, max_csma_backoffs)
	),
	TP_fast_assign(
		LOCAL_ASSIGN,
		__entry->min_be = min_be;
		__entry->max_be = max_be;
		__entry->max_csma_backoffs = max_csma_backoffs;
	),
	TP_printk(LOCAL_PR_FMT ", min be: %d, max be: %d, max csma backoffs: %d",
		  LOCAL_PR_ARG, __entry->min_be, __entry->max_be,
		  __entry->max_csma_backoffs)
);

TRACE_EVENT(802154_drv_set_max_frame_retries,
	TP_PROTO(struct ieee802154_local *local, s8 max_frame_retries),
	TP_ARGS(local, max_frame_retries),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(s8, max_frame_retries)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->max_frame_retries = max_frame_retries;
	),
	TP_printk(LOCAL_PR_FMT ", max frame retries: %d", LOCAL_PR_ARG,
		  __entry->max_frame_retries)
);

TRACE_EVENT(802154_drv_set_promiscuous_mode,
	TP_PROTO(struct ieee802154_local *local, bool on),
	TP_ARGS(local, on),
	TP_STRUCT__entry(
		LOCAL_ENTRY
		__field(bool, on)
	),
	TP_fast_assign(
		LOCAL_ASSIGN;
		__entry->on = on;
	),
	TP_printk(LOCAL_PR_FMT ", promiscuous mode: %s", LOCAL_PR_ARG,
		  BOOL_TO_STR(__entry->on))
);

#endif /* !__MAC802154_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace
#include <trace/define_trace.h>