xref: /openbmc/linux/net/mac80211/trace.h (revision 4161b450)
1 #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
2 #define __MAC80211_DRIVER_TRACE
3 
4 #include <linux/tracepoint.h>
5 #include <net/mac80211.h>
6 #include "ieee80211_i.h"
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM mac80211
10 
11 #define MAXNAME		32
12 #define LOCAL_ENTRY	__array(char, wiphy_name, 32)
13 #define LOCAL_ASSIGN	strlcpy(__entry->wiphy_name, wiphy_name(local->hw.wiphy), MAXNAME)
14 #define LOCAL_PR_FMT	"%s"
15 #define LOCAL_PR_ARG	__entry->wiphy_name
16 
17 #define STA_ENTRY	__array(char, sta_addr, ETH_ALEN)
18 #define STA_ASSIGN	(sta ? memcpy(__entry->sta_addr, sta->addr, ETH_ALEN) : memset(__entry->sta_addr, 0, ETH_ALEN))
19 #define STA_NAMED_ASSIGN(s)	memcpy(__entry->sta_addr, (s)->addr, ETH_ALEN)
20 #define STA_PR_FMT	" sta:%pM"
21 #define STA_PR_ARG	__entry->sta_addr
22 
23 #define VIF_ENTRY	__field(enum nl80211_iftype, vif_type) __field(void *, sdata)	\
24 			__field(bool, p2p)						\
25 			__string(vif_name, sdata->name)
26 #define VIF_ASSIGN	__entry->vif_type = sdata->vif.type; __entry->sdata = sdata;	\
27 			__entry->p2p = sdata->vif.p2p;					\
28 			__assign_str(vif_name, sdata->name)
29 #define VIF_PR_FMT	" vif:%s(%d%s)"
30 #define VIF_PR_ARG	__get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
31 
32 #define CHANDEF_ENTRY	__field(u32, control_freq)					\
33 			__field(u32, chan_width)					\
34 			__field(u32, center_freq1)					\
35 			__field(u32, center_freq2)
36 #define CHANDEF_ASSIGN(c)								\
37 			__entry->control_freq = (c)->chan ? (c)->chan->center_freq : 0;	\
38 			__entry->chan_width = (c)->width;				\
39 			__entry->center_freq1 = (c)->center_freq1;			\
40 			__entry->center_freq2 = (c)->center_freq2;
41 #define CHANDEF_PR_FMT	" control:%d MHz width:%d center: %d/%d MHz"
42 #define CHANDEF_PR_ARG	__entry->control_freq, __entry->chan_width,			\
43 			__entry->center_freq1, __entry->center_freq2
44 
45 #define MIN_CHANDEF_ENTRY								\
46 			__field(u32, min_control_freq)					\
47 			__field(u32, min_chan_width)					\
48 			__field(u32, min_center_freq1)					\
49 			__field(u32, min_center_freq2)
50 
51 #define MIN_CHANDEF_ASSIGN(c)								\
52 			__entry->min_control_freq = (c)->chan ? (c)->chan->center_freq : 0;	\
53 			__entry->min_chan_width = (c)->width;				\
54 			__entry->min_center_freq1 = (c)->center_freq1;			\
55 			__entry->min_center_freq2 = (c)->center_freq2;
56 #define MIN_CHANDEF_PR_FMT	" min_control:%d MHz min_width:%d min_center: %d/%d MHz"
57 #define MIN_CHANDEF_PR_ARG	__entry->min_control_freq, __entry->min_chan_width,	\
58 			__entry->min_center_freq1, __entry->min_center_freq2
59 
60 #define CHANCTX_ENTRY	CHANDEF_ENTRY							\
61 			MIN_CHANDEF_ENTRY						\
62 			__field(u8, rx_chains_static)					\
63 			__field(u8, rx_chains_dynamic)
64 #define CHANCTX_ASSIGN	CHANDEF_ASSIGN(&ctx->conf.def)					\
65 			MIN_CHANDEF_ASSIGN(&ctx->conf.min_def)				\
66 			__entry->rx_chains_static = ctx->conf.rx_chains_static;		\
67 			__entry->rx_chains_dynamic = ctx->conf.rx_chains_dynamic
68 #define CHANCTX_PR_FMT	CHANDEF_PR_FMT MIN_CHANDEF_PR_FMT " chains:%d/%d"
69 #define CHANCTX_PR_ARG	CHANDEF_PR_ARG,	MIN_CHANDEF_PR_ARG,				\
70 			__entry->rx_chains_static, __entry->rx_chains_dynamic
71 
72 
73 
74 /*
75  * Tracing for driver callbacks.
76  */
77 
78 DECLARE_EVENT_CLASS(local_only_evt,
79 	TP_PROTO(struct ieee80211_local *local),
80 	TP_ARGS(local),
81 	TP_STRUCT__entry(
82 		LOCAL_ENTRY
83 	),
84 	TP_fast_assign(
85 		LOCAL_ASSIGN;
86 	),
87 	TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
88 );
89 
90 DECLARE_EVENT_CLASS(local_sdata_addr_evt,
91 	TP_PROTO(struct ieee80211_local *local,
92 		 struct ieee80211_sub_if_data *sdata),
93 	TP_ARGS(local, sdata),
94 
95 	TP_STRUCT__entry(
96 		LOCAL_ENTRY
97 		VIF_ENTRY
98 		__array(char, addr, ETH_ALEN)
99 	),
100 
101 	TP_fast_assign(
102 		LOCAL_ASSIGN;
103 		VIF_ASSIGN;
104 		memcpy(__entry->addr, sdata->vif.addr, ETH_ALEN);
105 	),
106 
107 	TP_printk(
108 		LOCAL_PR_FMT  VIF_PR_FMT " addr:%pM",
109 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->addr
110 	)
111 );
112 
113 DECLARE_EVENT_CLASS(local_u32_evt,
114 	TP_PROTO(struct ieee80211_local *local, u32 value),
115 	TP_ARGS(local, value),
116 
117 	TP_STRUCT__entry(
118 		LOCAL_ENTRY
119 		__field(u32, value)
120 	),
121 
122 	TP_fast_assign(
123 		LOCAL_ASSIGN;
124 		__entry->value = value;
125 	),
126 
127 	TP_printk(
128 		LOCAL_PR_FMT " value:%d",
129 		LOCAL_PR_ARG, __entry->value
130 	)
131 );
132 
133 DECLARE_EVENT_CLASS(local_sdata_evt,
134 	TP_PROTO(struct ieee80211_local *local,
135 		 struct ieee80211_sub_if_data *sdata),
136 	TP_ARGS(local, sdata),
137 
138 	TP_STRUCT__entry(
139 		LOCAL_ENTRY
140 		VIF_ENTRY
141 	),
142 
143 	TP_fast_assign(
144 		LOCAL_ASSIGN;
145 		VIF_ASSIGN;
146 	),
147 
148 	TP_printk(
149 		LOCAL_PR_FMT VIF_PR_FMT,
150 		LOCAL_PR_ARG, VIF_PR_ARG
151 	)
152 );
153 
154 DEFINE_EVENT(local_only_evt, drv_return_void,
155 	TP_PROTO(struct ieee80211_local *local),
156 	TP_ARGS(local)
157 );
158 
159 TRACE_EVENT(drv_return_int,
160 	TP_PROTO(struct ieee80211_local *local, int ret),
161 	TP_ARGS(local, ret),
162 	TP_STRUCT__entry(
163 		LOCAL_ENTRY
164 		__field(int, ret)
165 	),
166 	TP_fast_assign(
167 		LOCAL_ASSIGN;
168 		__entry->ret = ret;
169 	),
170 	TP_printk(LOCAL_PR_FMT " - %d", LOCAL_PR_ARG, __entry->ret)
171 );
172 
173 TRACE_EVENT(drv_return_bool,
174 	TP_PROTO(struct ieee80211_local *local, bool ret),
175 	TP_ARGS(local, ret),
176 	TP_STRUCT__entry(
177 		LOCAL_ENTRY
178 		__field(bool, ret)
179 	),
180 	TP_fast_assign(
181 		LOCAL_ASSIGN;
182 		__entry->ret = ret;
183 	),
184 	TP_printk(LOCAL_PR_FMT " - %s", LOCAL_PR_ARG, (__entry->ret) ?
185 		  "true" : "false")
186 );
187 
188 TRACE_EVENT(drv_return_u32,
189 	TP_PROTO(struct ieee80211_local *local, u32 ret),
190 	TP_ARGS(local, ret),
191 	TP_STRUCT__entry(
192 		LOCAL_ENTRY
193 		__field(u32, ret)
194 	),
195 	TP_fast_assign(
196 		LOCAL_ASSIGN;
197 		__entry->ret = ret;
198 	),
199 	TP_printk(LOCAL_PR_FMT " - %u", LOCAL_PR_ARG, __entry->ret)
200 );
201 
202 TRACE_EVENT(drv_return_u64,
203 	TP_PROTO(struct ieee80211_local *local, u64 ret),
204 	TP_ARGS(local, ret),
205 	TP_STRUCT__entry(
206 		LOCAL_ENTRY
207 		__field(u64, ret)
208 	),
209 	TP_fast_assign(
210 		LOCAL_ASSIGN;
211 		__entry->ret = ret;
212 	),
213 	TP_printk(LOCAL_PR_FMT " - %llu", LOCAL_PR_ARG, __entry->ret)
214 );
215 
216 DEFINE_EVENT(local_only_evt, drv_start,
217 	TP_PROTO(struct ieee80211_local *local),
218 	TP_ARGS(local)
219 );
220 
221 DEFINE_EVENT(local_u32_evt, drv_get_et_strings,
222 	     TP_PROTO(struct ieee80211_local *local, u32 sset),
223 	     TP_ARGS(local, sset)
224 );
225 
226 DEFINE_EVENT(local_u32_evt, drv_get_et_sset_count,
227 	     TP_PROTO(struct ieee80211_local *local, u32 sset),
228 	     TP_ARGS(local, sset)
229 );
230 
231 DEFINE_EVENT(local_only_evt, drv_get_et_stats,
232 	     TP_PROTO(struct ieee80211_local *local),
233 	     TP_ARGS(local)
234 );
235 
236 DEFINE_EVENT(local_only_evt, drv_suspend,
237 	TP_PROTO(struct ieee80211_local *local),
238 	TP_ARGS(local)
239 );
240 
241 DEFINE_EVENT(local_only_evt, drv_resume,
242 	TP_PROTO(struct ieee80211_local *local),
243 	TP_ARGS(local)
244 );
245 
246 TRACE_EVENT(drv_set_wakeup,
247 	TP_PROTO(struct ieee80211_local *local, bool enabled),
248 	TP_ARGS(local, enabled),
249 	TP_STRUCT__entry(
250 		LOCAL_ENTRY
251 		__field(bool, enabled)
252 	),
253 	TP_fast_assign(
254 		LOCAL_ASSIGN;
255 		__entry->enabled = enabled;
256 	),
257 	TP_printk(LOCAL_PR_FMT " enabled:%d", LOCAL_PR_ARG, __entry->enabled)
258 );
259 
260 DEFINE_EVENT(local_only_evt, drv_stop,
261 	TP_PROTO(struct ieee80211_local *local),
262 	TP_ARGS(local)
263 );
264 
265 DEFINE_EVENT(local_sdata_addr_evt, drv_add_interface,
266 	TP_PROTO(struct ieee80211_local *local,
267 		 struct ieee80211_sub_if_data *sdata),
268 	TP_ARGS(local, sdata)
269 );
270 
271 TRACE_EVENT(drv_change_interface,
272 	TP_PROTO(struct ieee80211_local *local,
273 		 struct ieee80211_sub_if_data *sdata,
274 		 enum nl80211_iftype type, bool p2p),
275 
276 	TP_ARGS(local, sdata, type, p2p),
277 
278 	TP_STRUCT__entry(
279 		LOCAL_ENTRY
280 		VIF_ENTRY
281 		__field(u32, new_type)
282 		__field(bool, new_p2p)
283 	),
284 
285 	TP_fast_assign(
286 		LOCAL_ASSIGN;
287 		VIF_ASSIGN;
288 		__entry->new_type = type;
289 		__entry->new_p2p = p2p;
290 	),
291 
292 	TP_printk(
293 		LOCAL_PR_FMT  VIF_PR_FMT " new type:%d%s",
294 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type,
295 		__entry->new_p2p ? "/p2p" : ""
296 	)
297 );
298 
299 DEFINE_EVENT(local_sdata_addr_evt, drv_remove_interface,
300 	TP_PROTO(struct ieee80211_local *local,
301 		 struct ieee80211_sub_if_data *sdata),
302 	TP_ARGS(local, sdata)
303 );
304 
305 TRACE_EVENT(drv_config,
306 	TP_PROTO(struct ieee80211_local *local,
307 		 u32 changed),
308 
309 	TP_ARGS(local, changed),
310 
311 	TP_STRUCT__entry(
312 		LOCAL_ENTRY
313 		__field(u32, changed)
314 		__field(u32, flags)
315 		__field(int, power_level)
316 		__field(int, dynamic_ps_timeout)
317 		__field(int, max_sleep_period)
318 		__field(u16, listen_interval)
319 		__field(u8, long_frame_max_tx_count)
320 		__field(u8, short_frame_max_tx_count)
321 		CHANDEF_ENTRY
322 		__field(int, smps)
323 	),
324 
325 	TP_fast_assign(
326 		LOCAL_ASSIGN;
327 		__entry->changed = changed;
328 		__entry->flags = local->hw.conf.flags;
329 		__entry->power_level = local->hw.conf.power_level;
330 		__entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout;
331 		__entry->max_sleep_period = local->hw.conf.max_sleep_period;
332 		__entry->listen_interval = local->hw.conf.listen_interval;
333 		__entry->long_frame_max_tx_count =
334 			local->hw.conf.long_frame_max_tx_count;
335 		__entry->short_frame_max_tx_count =
336 			local->hw.conf.short_frame_max_tx_count;
337 		CHANDEF_ASSIGN(&local->hw.conf.chandef)
338 		__entry->smps = local->hw.conf.smps_mode;
339 	),
340 
341 	TP_printk(
342 		LOCAL_PR_FMT " ch:%#x" CHANDEF_PR_FMT,
343 		LOCAL_PR_ARG, __entry->changed, CHANDEF_PR_ARG
344 	)
345 );
346 
347 TRACE_EVENT(drv_bss_info_changed,
348 	TP_PROTO(struct ieee80211_local *local,
349 		 struct ieee80211_sub_if_data *sdata,
350 		 struct ieee80211_bss_conf *info,
351 		 u32 changed),
352 
353 	TP_ARGS(local, sdata, info, changed),
354 
355 	TP_STRUCT__entry(
356 		LOCAL_ENTRY
357 		VIF_ENTRY
358 		__field(u32, changed)
359 		__field(bool, assoc)
360 		__field(bool, ibss_joined)
361 		__field(bool, ibss_creator)
362 		__field(u16, aid)
363 		__field(bool, cts)
364 		__field(bool, shortpre)
365 		__field(bool, shortslot)
366 		__field(bool, enable_beacon)
367 		__field(u8, dtimper)
368 		__field(u16, bcnint)
369 		__field(u16, assoc_cap)
370 		__field(u64, sync_tsf)
371 		__field(u32, sync_device_ts)
372 		__field(u8, sync_dtim_count)
373 		__field(u32, basic_rates)
374 		__array(int, mcast_rate, IEEE80211_NUM_BANDS)
375 		__field(u16, ht_operation_mode)
376 		__field(s32, cqm_rssi_thold);
377 		__field(s32, cqm_rssi_hyst);
378 		__field(u32, channel_width);
379 		__field(u32, channel_cfreq1);
380 		__dynamic_array(u32, arp_addr_list,
381 				info->arp_addr_cnt > IEEE80211_BSS_ARP_ADDR_LIST_LEN ?
382 					IEEE80211_BSS_ARP_ADDR_LIST_LEN :
383 					info->arp_addr_cnt);
384 		__field(int, arp_addr_cnt);
385 		__field(bool, qos);
386 		__field(bool, idle);
387 		__field(bool, ps);
388 		__dynamic_array(u8, ssid, info->ssid_len);
389 		__field(bool, hidden_ssid);
390 		__field(int, txpower)
391 		__field(u8, p2p_oppps_ctwindow)
392 	),
393 
394 	TP_fast_assign(
395 		LOCAL_ASSIGN;
396 		VIF_ASSIGN;
397 		__entry->changed = changed;
398 		__entry->aid = info->aid;
399 		__entry->assoc = info->assoc;
400 		__entry->ibss_joined = info->ibss_joined;
401 		__entry->ibss_creator = info->ibss_creator;
402 		__entry->shortpre = info->use_short_preamble;
403 		__entry->cts = info->use_cts_prot;
404 		__entry->shortslot = info->use_short_slot;
405 		__entry->enable_beacon = info->enable_beacon;
406 		__entry->dtimper = info->dtim_period;
407 		__entry->bcnint = info->beacon_int;
408 		__entry->assoc_cap = info->assoc_capability;
409 		__entry->sync_tsf = info->sync_tsf;
410 		__entry->sync_device_ts = info->sync_device_ts;
411 		__entry->sync_dtim_count = info->sync_dtim_count;
412 		__entry->basic_rates = info->basic_rates;
413 		memcpy(__entry->mcast_rate, info->mcast_rate,
414 		       sizeof(__entry->mcast_rate));
415 		__entry->ht_operation_mode = info->ht_operation_mode;
416 		__entry->cqm_rssi_thold = info->cqm_rssi_thold;
417 		__entry->cqm_rssi_hyst = info->cqm_rssi_hyst;
418 		__entry->channel_width = info->chandef.width;
419 		__entry->channel_cfreq1 = info->chandef.center_freq1;
420 		__entry->arp_addr_cnt = info->arp_addr_cnt;
421 		memcpy(__get_dynamic_array(arp_addr_list), info->arp_addr_list,
422 		       sizeof(u32) * (info->arp_addr_cnt > IEEE80211_BSS_ARP_ADDR_LIST_LEN ?
423 					IEEE80211_BSS_ARP_ADDR_LIST_LEN :
424 					info->arp_addr_cnt));
425 		__entry->qos = info->qos;
426 		__entry->idle = info->idle;
427 		__entry->ps = info->ps;
428 		memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len);
429 		__entry->hidden_ssid = info->hidden_ssid;
430 		__entry->txpower = info->txpower;
431 		__entry->p2p_oppps_ctwindow = info->p2p_noa_attr.oppps_ctwindow;
432 	),
433 
434 	TP_printk(
435 		LOCAL_PR_FMT  VIF_PR_FMT " changed:%#x",
436 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->changed
437 	)
438 );
439 
440 TRACE_EVENT(drv_prepare_multicast,
441 	TP_PROTO(struct ieee80211_local *local, int mc_count),
442 
443 	TP_ARGS(local, mc_count),
444 
445 	TP_STRUCT__entry(
446 		LOCAL_ENTRY
447 		__field(int, mc_count)
448 	),
449 
450 	TP_fast_assign(
451 		LOCAL_ASSIGN;
452 		__entry->mc_count = mc_count;
453 	),
454 
455 	TP_printk(
456 		LOCAL_PR_FMT " prepare mc (%d)",
457 		LOCAL_PR_ARG, __entry->mc_count
458 	)
459 );
460 
461 TRACE_EVENT(drv_configure_filter,
462 	TP_PROTO(struct ieee80211_local *local,
463 		 unsigned int changed_flags,
464 		 unsigned int *total_flags,
465 		 u64 multicast),
466 
467 	TP_ARGS(local, changed_flags, total_flags, multicast),
468 
469 	TP_STRUCT__entry(
470 		LOCAL_ENTRY
471 		__field(unsigned int, changed)
472 		__field(unsigned int, total)
473 		__field(u64, multicast)
474 	),
475 
476 	TP_fast_assign(
477 		LOCAL_ASSIGN;
478 		__entry->changed = changed_flags;
479 		__entry->total = *total_flags;
480 		__entry->multicast = multicast;
481 	),
482 
483 	TP_printk(
484 		LOCAL_PR_FMT " changed:%#x total:%#x",
485 		LOCAL_PR_ARG, __entry->changed, __entry->total
486 	)
487 );
488 
489 TRACE_EVENT(drv_set_tim,
490 	TP_PROTO(struct ieee80211_local *local,
491 		 struct ieee80211_sta *sta, bool set),
492 
493 	TP_ARGS(local, sta, set),
494 
495 	TP_STRUCT__entry(
496 		LOCAL_ENTRY
497 		STA_ENTRY
498 		__field(bool, set)
499 	),
500 
501 	TP_fast_assign(
502 		LOCAL_ASSIGN;
503 		STA_ASSIGN;
504 		__entry->set = set;
505 	),
506 
507 	TP_printk(
508 		LOCAL_PR_FMT STA_PR_FMT " set:%d",
509 		LOCAL_PR_ARG, STA_PR_ARG, __entry->set
510 	)
511 );
512 
513 TRACE_EVENT(drv_set_key,
514 	TP_PROTO(struct ieee80211_local *local,
515 		 enum set_key_cmd cmd, struct ieee80211_sub_if_data *sdata,
516 		 struct ieee80211_sta *sta,
517 		 struct ieee80211_key_conf *key),
518 
519 	TP_ARGS(local, cmd, sdata, sta, key),
520 
521 	TP_STRUCT__entry(
522 		LOCAL_ENTRY
523 		VIF_ENTRY
524 		STA_ENTRY
525 		__field(u32, cipher)
526 		__field(u8, hw_key_idx)
527 		__field(u8, flags)
528 		__field(s8, keyidx)
529 	),
530 
531 	TP_fast_assign(
532 		LOCAL_ASSIGN;
533 		VIF_ASSIGN;
534 		STA_ASSIGN;
535 		__entry->cipher = key->cipher;
536 		__entry->flags = key->flags;
537 		__entry->keyidx = key->keyidx;
538 		__entry->hw_key_idx = key->hw_key_idx;
539 	),
540 
541 	TP_printk(
542 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT,
543 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
544 	)
545 );
546 
547 TRACE_EVENT(drv_update_tkip_key,
548 	TP_PROTO(struct ieee80211_local *local,
549 		 struct ieee80211_sub_if_data *sdata,
550 		 struct ieee80211_key_conf *conf,
551 		 struct ieee80211_sta *sta, u32 iv32),
552 
553 	TP_ARGS(local, sdata, conf, sta, iv32),
554 
555 	TP_STRUCT__entry(
556 		LOCAL_ENTRY
557 		VIF_ENTRY
558 		STA_ENTRY
559 		__field(u32, iv32)
560 	),
561 
562 	TP_fast_assign(
563 		LOCAL_ASSIGN;
564 		VIF_ASSIGN;
565 		STA_ASSIGN;
566 		__entry->iv32 = iv32;
567 	),
568 
569 	TP_printk(
570 		LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x",
571 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->iv32
572 	)
573 );
574 
575 DEFINE_EVENT(local_sdata_evt, drv_hw_scan,
576 	TP_PROTO(struct ieee80211_local *local,
577 		 struct ieee80211_sub_if_data *sdata),
578 	TP_ARGS(local, sdata)
579 );
580 
581 DEFINE_EVENT(local_sdata_evt, drv_cancel_hw_scan,
582 	TP_PROTO(struct ieee80211_local *local,
583 		 struct ieee80211_sub_if_data *sdata),
584 	TP_ARGS(local, sdata)
585 );
586 
587 DEFINE_EVENT(local_sdata_evt, drv_sched_scan_start,
588 	TP_PROTO(struct ieee80211_local *local,
589 		 struct ieee80211_sub_if_data *sdata),
590 	TP_ARGS(local, sdata)
591 );
592 
593 DEFINE_EVENT(local_sdata_evt, drv_sched_scan_stop,
594 	TP_PROTO(struct ieee80211_local *local,
595 		 struct ieee80211_sub_if_data *sdata),
596 	TP_ARGS(local, sdata)
597 );
598 
599 TRACE_EVENT(drv_sw_scan_start,
600 	TP_PROTO(struct ieee80211_local *local,
601 		 struct ieee80211_sub_if_data *sdata,
602 		 const u8 *mac_addr),
603 
604 	TP_ARGS(local, sdata, mac_addr),
605 
606 	TP_STRUCT__entry(
607 		LOCAL_ENTRY
608 		VIF_ENTRY
609 		__array(char, mac_addr, ETH_ALEN)
610 	),
611 
612 	TP_fast_assign(
613 		LOCAL_ASSIGN;
614 		VIF_ASSIGN;
615 		memcpy(__entry->mac_addr, mac_addr, ETH_ALEN);
616 	),
617 
618 	TP_printk(LOCAL_PR_FMT ", " VIF_PR_FMT ", addr:%pM",
619 		  LOCAL_PR_ARG, VIF_PR_ARG, __entry->mac_addr)
620 );
621 
622 DEFINE_EVENT(local_sdata_evt, drv_sw_scan_complete,
623 	TP_PROTO(struct ieee80211_local *local,
624 		 struct ieee80211_sub_if_data *sdata),
625 	TP_ARGS(local, sdata)
626 );
627 
628 TRACE_EVENT(drv_get_stats,
629 	TP_PROTO(struct ieee80211_local *local,
630 		 struct ieee80211_low_level_stats *stats,
631 		 int ret),
632 
633 	TP_ARGS(local, stats, ret),
634 
635 	TP_STRUCT__entry(
636 		LOCAL_ENTRY
637 		__field(int, ret)
638 		__field(unsigned int, ackfail)
639 		__field(unsigned int, rtsfail)
640 		__field(unsigned int, fcserr)
641 		__field(unsigned int, rtssucc)
642 	),
643 
644 	TP_fast_assign(
645 		LOCAL_ASSIGN;
646 		__entry->ret = ret;
647 		__entry->ackfail = stats->dot11ACKFailureCount;
648 		__entry->rtsfail = stats->dot11RTSFailureCount;
649 		__entry->fcserr = stats->dot11FCSErrorCount;
650 		__entry->rtssucc = stats->dot11RTSSuccessCount;
651 	),
652 
653 	TP_printk(
654 		LOCAL_PR_FMT " ret:%d",
655 		LOCAL_PR_ARG, __entry->ret
656 	)
657 );
658 
659 TRACE_EVENT(drv_get_tkip_seq,
660 	TP_PROTO(struct ieee80211_local *local,
661 		 u8 hw_key_idx, u32 *iv32, u16 *iv16),
662 
663 	TP_ARGS(local, hw_key_idx, iv32, iv16),
664 
665 	TP_STRUCT__entry(
666 		LOCAL_ENTRY
667 		__field(u8, hw_key_idx)
668 		__field(u32, iv32)
669 		__field(u16, iv16)
670 	),
671 
672 	TP_fast_assign(
673 		LOCAL_ASSIGN;
674 		__entry->hw_key_idx = hw_key_idx;
675 		__entry->iv32 = *iv32;
676 		__entry->iv16 = *iv16;
677 	),
678 
679 	TP_printk(
680 		LOCAL_PR_FMT, LOCAL_PR_ARG
681 	)
682 );
683 
684 DEFINE_EVENT(local_u32_evt, drv_set_frag_threshold,
685 	TP_PROTO(struct ieee80211_local *local, u32 value),
686 	TP_ARGS(local, value)
687 );
688 
689 DEFINE_EVENT(local_u32_evt, drv_set_rts_threshold,
690 	TP_PROTO(struct ieee80211_local *local, u32 value),
691 	TP_ARGS(local, value)
692 );
693 
694 TRACE_EVENT(drv_set_coverage_class,
695 	TP_PROTO(struct ieee80211_local *local, s16 value),
696 
697 	TP_ARGS(local, value),
698 
699 	TP_STRUCT__entry(
700 		LOCAL_ENTRY
701 		__field(s16, value)
702 	),
703 
704 	TP_fast_assign(
705 		LOCAL_ASSIGN;
706 		__entry->value = value;
707 	),
708 
709 	TP_printk(
710 		LOCAL_PR_FMT " value:%d",
711 		LOCAL_PR_ARG, __entry->value
712 	)
713 );
714 
715 TRACE_EVENT(drv_sta_notify,
716 	TP_PROTO(struct ieee80211_local *local,
717 		 struct ieee80211_sub_if_data *sdata,
718 		 enum sta_notify_cmd cmd,
719 		 struct ieee80211_sta *sta),
720 
721 	TP_ARGS(local, sdata, cmd, sta),
722 
723 	TP_STRUCT__entry(
724 		LOCAL_ENTRY
725 		VIF_ENTRY
726 		STA_ENTRY
727 		__field(u32, cmd)
728 	),
729 
730 	TP_fast_assign(
731 		LOCAL_ASSIGN;
732 		VIF_ASSIGN;
733 		STA_ASSIGN;
734 		__entry->cmd = cmd;
735 	),
736 
737 	TP_printk(
738 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT " cmd:%d",
739 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->cmd
740 	)
741 );
742 
743 TRACE_EVENT(drv_sta_state,
744 	TP_PROTO(struct ieee80211_local *local,
745 		 struct ieee80211_sub_if_data *sdata,
746 		 struct ieee80211_sta *sta,
747 		 enum ieee80211_sta_state old_state,
748 		 enum ieee80211_sta_state new_state),
749 
750 	TP_ARGS(local, sdata, sta, old_state, new_state),
751 
752 	TP_STRUCT__entry(
753 		LOCAL_ENTRY
754 		VIF_ENTRY
755 		STA_ENTRY
756 		__field(u32, old_state)
757 		__field(u32, new_state)
758 	),
759 
760 	TP_fast_assign(
761 		LOCAL_ASSIGN;
762 		VIF_ASSIGN;
763 		STA_ASSIGN;
764 		__entry->old_state = old_state;
765 		__entry->new_state = new_state;
766 	),
767 
768 	TP_printk(
769 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT " state: %d->%d",
770 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG,
771 		__entry->old_state, __entry->new_state
772 	)
773 );
774 
775 TRACE_EVENT(drv_sta_rc_update,
776 	TP_PROTO(struct ieee80211_local *local,
777 		 struct ieee80211_sub_if_data *sdata,
778 		 struct ieee80211_sta *sta,
779 		 u32 changed),
780 
781 	TP_ARGS(local, sdata, sta, changed),
782 
783 	TP_STRUCT__entry(
784 		LOCAL_ENTRY
785 		VIF_ENTRY
786 		STA_ENTRY
787 		__field(u32, changed)
788 	),
789 
790 	TP_fast_assign(
791 		LOCAL_ASSIGN;
792 		VIF_ASSIGN;
793 		STA_ASSIGN;
794 		__entry->changed = changed;
795 	),
796 
797 	TP_printk(
798 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT " changed: 0x%x",
799 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->changed
800 	)
801 );
802 
803 DECLARE_EVENT_CLASS(sta_event,
804 	TP_PROTO(struct ieee80211_local *local,
805 		 struct ieee80211_sub_if_data *sdata,
806 		 struct ieee80211_sta *sta),
807 
808 	TP_ARGS(local, sdata, sta),
809 
810 	TP_STRUCT__entry(
811 		LOCAL_ENTRY
812 		VIF_ENTRY
813 		STA_ENTRY
814 	),
815 
816 	TP_fast_assign(
817 		LOCAL_ASSIGN;
818 		VIF_ASSIGN;
819 		STA_ASSIGN;
820 	),
821 
822 	TP_printk(
823 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT,
824 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
825 	)
826 );
827 
828 DEFINE_EVENT(sta_event, drv_sta_add,
829 	TP_PROTO(struct ieee80211_local *local,
830 		 struct ieee80211_sub_if_data *sdata,
831 		 struct ieee80211_sta *sta),
832 	TP_ARGS(local, sdata, sta)
833 );
834 
835 DEFINE_EVENT(sta_event, drv_sta_remove,
836 	TP_PROTO(struct ieee80211_local *local,
837 		 struct ieee80211_sub_if_data *sdata,
838 		 struct ieee80211_sta *sta),
839 	TP_ARGS(local, sdata, sta)
840 );
841 
842 DEFINE_EVENT(sta_event, drv_sta_pre_rcu_remove,
843 	TP_PROTO(struct ieee80211_local *local,
844 		 struct ieee80211_sub_if_data *sdata,
845 		 struct ieee80211_sta *sta),
846 	TP_ARGS(local, sdata, sta)
847 );
848 
849 DEFINE_EVENT(sta_event, drv_sta_rate_tbl_update,
850 	TP_PROTO(struct ieee80211_local *local,
851 		 struct ieee80211_sub_if_data *sdata,
852 		 struct ieee80211_sta *sta),
853 	TP_ARGS(local, sdata, sta)
854 );
855 
856 TRACE_EVENT(drv_conf_tx,
857 	TP_PROTO(struct ieee80211_local *local,
858 		 struct ieee80211_sub_if_data *sdata,
859 		 u16 ac, const struct ieee80211_tx_queue_params *params),
860 
861 	TP_ARGS(local, sdata, ac, params),
862 
863 	TP_STRUCT__entry(
864 		LOCAL_ENTRY
865 		VIF_ENTRY
866 		__field(u16, ac)
867 		__field(u16, txop)
868 		__field(u16, cw_min)
869 		__field(u16, cw_max)
870 		__field(u8, aifs)
871 		__field(bool, uapsd)
872 	),
873 
874 	TP_fast_assign(
875 		LOCAL_ASSIGN;
876 		VIF_ASSIGN;
877 		__entry->ac = ac;
878 		__entry->txop = params->txop;
879 		__entry->cw_max = params->cw_max;
880 		__entry->cw_min = params->cw_min;
881 		__entry->aifs = params->aifs;
882 		__entry->uapsd = params->uapsd;
883 	),
884 
885 	TP_printk(
886 		LOCAL_PR_FMT  VIF_PR_FMT  " AC:%d",
887 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->ac
888 	)
889 );
890 
891 DEFINE_EVENT(local_sdata_evt, drv_get_tsf,
892 	TP_PROTO(struct ieee80211_local *local,
893 		 struct ieee80211_sub_if_data *sdata),
894 	TP_ARGS(local, sdata)
895 );
896 
897 TRACE_EVENT(drv_set_tsf,
898 	TP_PROTO(struct ieee80211_local *local,
899 		 struct ieee80211_sub_if_data *sdata,
900 		 u64 tsf),
901 
902 	TP_ARGS(local, sdata, tsf),
903 
904 	TP_STRUCT__entry(
905 		LOCAL_ENTRY
906 		VIF_ENTRY
907 		__field(u64, tsf)
908 	),
909 
910 	TP_fast_assign(
911 		LOCAL_ASSIGN;
912 		VIF_ASSIGN;
913 		__entry->tsf = tsf;
914 	),
915 
916 	TP_printk(
917 		LOCAL_PR_FMT  VIF_PR_FMT  " tsf:%llu",
918 		LOCAL_PR_ARG, VIF_PR_ARG, (unsigned long long)__entry->tsf
919 	)
920 );
921 
922 DEFINE_EVENT(local_sdata_evt, drv_reset_tsf,
923 	TP_PROTO(struct ieee80211_local *local,
924 		 struct ieee80211_sub_if_data *sdata),
925 	TP_ARGS(local, sdata)
926 );
927 
928 DEFINE_EVENT(local_only_evt, drv_tx_last_beacon,
929 	TP_PROTO(struct ieee80211_local *local),
930 	TP_ARGS(local)
931 );
932 
933 TRACE_EVENT(drv_ampdu_action,
934 	TP_PROTO(struct ieee80211_local *local,
935 		 struct ieee80211_sub_if_data *sdata,
936 		 enum ieee80211_ampdu_mlme_action action,
937 		 struct ieee80211_sta *sta, u16 tid,
938 		 u16 *ssn, u8 buf_size),
939 
940 	TP_ARGS(local, sdata, action, sta, tid, ssn, buf_size),
941 
942 	TP_STRUCT__entry(
943 		LOCAL_ENTRY
944 		STA_ENTRY
945 		__field(u32, action)
946 		__field(u16, tid)
947 		__field(u16, ssn)
948 		__field(u8, buf_size)
949 		VIF_ENTRY
950 	),
951 
952 	TP_fast_assign(
953 		LOCAL_ASSIGN;
954 		VIF_ASSIGN;
955 		STA_ASSIGN;
956 		__entry->action = action;
957 		__entry->tid = tid;
958 		__entry->ssn = ssn ? *ssn : 0;
959 		__entry->buf_size = buf_size;
960 	),
961 
962 	TP_printk(
963 		LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " action:%d tid:%d buf:%d",
964 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->action,
965 		__entry->tid, __entry->buf_size
966 	)
967 );
968 
969 TRACE_EVENT(drv_get_survey,
970 	TP_PROTO(struct ieee80211_local *local, int idx,
971 		 struct survey_info *survey),
972 
973 	TP_ARGS(local, idx, survey),
974 
975 	TP_STRUCT__entry(
976 		LOCAL_ENTRY
977 		__field(int, idx)
978 	),
979 
980 	TP_fast_assign(
981 		LOCAL_ASSIGN;
982 		__entry->idx = idx;
983 	),
984 
985 	TP_printk(
986 		LOCAL_PR_FMT " idx:%d",
987 		LOCAL_PR_ARG, __entry->idx
988 	)
989 );
990 
991 TRACE_EVENT(drv_flush,
992 	TP_PROTO(struct ieee80211_local *local,
993 		 u32 queues, bool drop),
994 
995 	TP_ARGS(local, queues, drop),
996 
997 	TP_STRUCT__entry(
998 		LOCAL_ENTRY
999 		__field(bool, drop)
1000 		__field(u32, queues)
1001 	),
1002 
1003 	TP_fast_assign(
1004 		LOCAL_ASSIGN;
1005 		__entry->drop = drop;
1006 		__entry->queues = queues;
1007 	),
1008 
1009 	TP_printk(
1010 		LOCAL_PR_FMT " queues:0x%x drop:%d",
1011 		LOCAL_PR_ARG, __entry->queues, __entry->drop
1012 	)
1013 );
1014 
1015 TRACE_EVENT(drv_channel_switch,
1016 	TP_PROTO(struct ieee80211_local *local,
1017 		 struct ieee80211_sub_if_data *sdata,
1018 		 struct ieee80211_channel_switch *ch_switch),
1019 
1020 	TP_ARGS(local, sdata, ch_switch),
1021 
1022 	TP_STRUCT__entry(
1023 		LOCAL_ENTRY
1024 		VIF_ENTRY
1025 		CHANDEF_ENTRY
1026 		__field(u64, timestamp)
1027 		__field(u32, device_timestamp)
1028 		__field(bool, block_tx)
1029 		__field(u8, count)
1030 	),
1031 
1032 	TP_fast_assign(
1033 		LOCAL_ASSIGN;
1034 		VIF_ASSIGN;
1035 		CHANDEF_ASSIGN(&ch_switch->chandef)
1036 		__entry->timestamp = ch_switch->timestamp;
1037 		__entry->device_timestamp = ch_switch->device_timestamp;
1038 		__entry->block_tx = ch_switch->block_tx;
1039 		__entry->count = ch_switch->count;
1040 	),
1041 
1042 	TP_printk(
1043 		LOCAL_PR_FMT VIF_PR_FMT " new " CHANDEF_PR_FMT " count:%d",
1044 		LOCAL_PR_ARG, VIF_PR_ARG, CHANDEF_PR_ARG, __entry->count
1045 	)
1046 );
1047 
1048 TRACE_EVENT(drv_set_antenna,
1049 	TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret),
1050 
1051 	TP_ARGS(local, tx_ant, rx_ant, ret),
1052 
1053 	TP_STRUCT__entry(
1054 		LOCAL_ENTRY
1055 		__field(u32, tx_ant)
1056 		__field(u32, rx_ant)
1057 		__field(int, ret)
1058 	),
1059 
1060 	TP_fast_assign(
1061 		LOCAL_ASSIGN;
1062 		__entry->tx_ant = tx_ant;
1063 		__entry->rx_ant = rx_ant;
1064 		__entry->ret = ret;
1065 	),
1066 
1067 	TP_printk(
1068 		LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d",
1069 		LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret
1070 	)
1071 );
1072 
1073 TRACE_EVENT(drv_get_antenna,
1074 	TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret),
1075 
1076 	TP_ARGS(local, tx_ant, rx_ant, ret),
1077 
1078 	TP_STRUCT__entry(
1079 		LOCAL_ENTRY
1080 		__field(u32, tx_ant)
1081 		__field(u32, rx_ant)
1082 		__field(int, ret)
1083 	),
1084 
1085 	TP_fast_assign(
1086 		LOCAL_ASSIGN;
1087 		__entry->tx_ant = tx_ant;
1088 		__entry->rx_ant = rx_ant;
1089 		__entry->ret = ret;
1090 	),
1091 
1092 	TP_printk(
1093 		LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d",
1094 		LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret
1095 	)
1096 );
1097 
1098 TRACE_EVENT(drv_remain_on_channel,
1099 	TP_PROTO(struct ieee80211_local *local,
1100 		 struct ieee80211_sub_if_data *sdata,
1101 		 struct ieee80211_channel *chan,
1102 		 unsigned int duration,
1103 		 enum ieee80211_roc_type type),
1104 
1105 	TP_ARGS(local, sdata, chan, duration, type),
1106 
1107 	TP_STRUCT__entry(
1108 		LOCAL_ENTRY
1109 		VIF_ENTRY
1110 		__field(int, center_freq)
1111 		__field(unsigned int, duration)
1112 		__field(u32, type)
1113 	),
1114 
1115 	TP_fast_assign(
1116 		LOCAL_ASSIGN;
1117 		VIF_ASSIGN;
1118 		__entry->center_freq = chan->center_freq;
1119 		__entry->duration = duration;
1120 		__entry->type = type;
1121 	),
1122 
1123 	TP_printk(
1124 		LOCAL_PR_FMT  VIF_PR_FMT " freq:%dMHz duration:%dms type=%d",
1125 		LOCAL_PR_ARG, VIF_PR_ARG,
1126 		__entry->center_freq, __entry->duration, __entry->type
1127 	)
1128 );
1129 
1130 DEFINE_EVENT(local_only_evt, drv_cancel_remain_on_channel,
1131 	TP_PROTO(struct ieee80211_local *local),
1132 	TP_ARGS(local)
1133 );
1134 
1135 TRACE_EVENT(drv_set_ringparam,
1136 	TP_PROTO(struct ieee80211_local *local, u32 tx, u32 rx),
1137 
1138 	TP_ARGS(local, tx, rx),
1139 
1140 	TP_STRUCT__entry(
1141 		LOCAL_ENTRY
1142 		__field(u32, tx)
1143 		__field(u32, rx)
1144 	),
1145 
1146 	TP_fast_assign(
1147 		LOCAL_ASSIGN;
1148 		__entry->tx = tx;
1149 		__entry->rx = rx;
1150 	),
1151 
1152 	TP_printk(
1153 		LOCAL_PR_FMT " tx:%d rx %d",
1154 		LOCAL_PR_ARG, __entry->tx, __entry->rx
1155 	)
1156 );
1157 
1158 TRACE_EVENT(drv_get_ringparam,
1159 	TP_PROTO(struct ieee80211_local *local, u32 *tx, u32 *tx_max,
1160 		 u32 *rx, u32 *rx_max),
1161 
1162 	TP_ARGS(local, tx, tx_max, rx, rx_max),
1163 
1164 	TP_STRUCT__entry(
1165 		LOCAL_ENTRY
1166 		__field(u32, tx)
1167 		__field(u32, tx_max)
1168 		__field(u32, rx)
1169 		__field(u32, rx_max)
1170 	),
1171 
1172 	TP_fast_assign(
1173 		LOCAL_ASSIGN;
1174 		__entry->tx = *tx;
1175 		__entry->tx_max = *tx_max;
1176 		__entry->rx = *rx;
1177 		__entry->rx_max = *rx_max;
1178 	),
1179 
1180 	TP_printk(
1181 		LOCAL_PR_FMT " tx:%d tx_max %d rx %d rx_max %d",
1182 		LOCAL_PR_ARG,
1183 		__entry->tx, __entry->tx_max, __entry->rx, __entry->rx_max
1184 	)
1185 );
1186 
1187 DEFINE_EVENT(local_only_evt, drv_tx_frames_pending,
1188 	TP_PROTO(struct ieee80211_local *local),
1189 	TP_ARGS(local)
1190 );
1191 
1192 DEFINE_EVENT(local_only_evt, drv_offchannel_tx_cancel_wait,
1193 	TP_PROTO(struct ieee80211_local *local),
1194 	TP_ARGS(local)
1195 );
1196 
1197 TRACE_EVENT(drv_set_bitrate_mask,
1198 	TP_PROTO(struct ieee80211_local *local,
1199 		 struct ieee80211_sub_if_data *sdata,
1200 		 const struct cfg80211_bitrate_mask *mask),
1201 
1202 	TP_ARGS(local, sdata, mask),
1203 
1204 	TP_STRUCT__entry(
1205 		LOCAL_ENTRY
1206 		VIF_ENTRY
1207 		__field(u32, legacy_2g)
1208 		__field(u32, legacy_5g)
1209 	),
1210 
1211 	TP_fast_assign(
1212 		LOCAL_ASSIGN;
1213 		VIF_ASSIGN;
1214 		__entry->legacy_2g = mask->control[IEEE80211_BAND_2GHZ].legacy;
1215 		__entry->legacy_5g = mask->control[IEEE80211_BAND_5GHZ].legacy;
1216 	),
1217 
1218 	TP_printk(
1219 		LOCAL_PR_FMT  VIF_PR_FMT " 2G Mask:0x%x 5G Mask:0x%x",
1220 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->legacy_2g, __entry->legacy_5g
1221 	)
1222 );
1223 
1224 TRACE_EVENT(drv_set_rekey_data,
1225 	TP_PROTO(struct ieee80211_local *local,
1226 		 struct ieee80211_sub_if_data *sdata,
1227 		 struct cfg80211_gtk_rekey_data *data),
1228 
1229 	TP_ARGS(local, sdata, data),
1230 
1231 	TP_STRUCT__entry(
1232 		LOCAL_ENTRY
1233 		VIF_ENTRY
1234 		__array(u8, kek, NL80211_KEK_LEN)
1235 		__array(u8, kck, NL80211_KCK_LEN)
1236 		__array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN)
1237 	),
1238 
1239 	TP_fast_assign(
1240 		LOCAL_ASSIGN;
1241 		VIF_ASSIGN;
1242 		memcpy(__entry->kek, data->kek, NL80211_KEK_LEN);
1243 		memcpy(__entry->kck, data->kck, NL80211_KCK_LEN);
1244 		memcpy(__entry->replay_ctr, data->replay_ctr,
1245 		       NL80211_REPLAY_CTR_LEN);
1246 	),
1247 
1248 	TP_printk(LOCAL_PR_FMT VIF_PR_FMT,
1249 		  LOCAL_PR_ARG, VIF_PR_ARG)
1250 );
1251 
1252 TRACE_EVENT(drv_rssi_callback,
1253 	TP_PROTO(struct ieee80211_local *local,
1254 		 struct ieee80211_sub_if_data *sdata,
1255 		 enum ieee80211_rssi_event rssi_event),
1256 
1257 	TP_ARGS(local, sdata, rssi_event),
1258 
1259 	TP_STRUCT__entry(
1260 		LOCAL_ENTRY
1261 		VIF_ENTRY
1262 		__field(u32, rssi_event)
1263 	),
1264 
1265 	TP_fast_assign(
1266 		LOCAL_ASSIGN;
1267 		VIF_ASSIGN;
1268 		__entry->rssi_event = rssi_event;
1269 	),
1270 
1271 	TP_printk(
1272 		LOCAL_PR_FMT VIF_PR_FMT " rssi_event:%d",
1273 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->rssi_event
1274 	)
1275 );
1276 
1277 DECLARE_EVENT_CLASS(release_evt,
1278 	TP_PROTO(struct ieee80211_local *local,
1279 		 struct ieee80211_sta *sta,
1280 		 u16 tids, int num_frames,
1281 		 enum ieee80211_frame_release_type reason,
1282 		 bool more_data),
1283 
1284 	TP_ARGS(local, sta, tids, num_frames, reason, more_data),
1285 
1286 	TP_STRUCT__entry(
1287 		LOCAL_ENTRY
1288 		STA_ENTRY
1289 		__field(u16, tids)
1290 		__field(int, num_frames)
1291 		__field(int, reason)
1292 		__field(bool, more_data)
1293 	),
1294 
1295 	TP_fast_assign(
1296 		LOCAL_ASSIGN;
1297 		STA_ASSIGN;
1298 		__entry->tids = tids;
1299 		__entry->num_frames = num_frames;
1300 		__entry->reason = reason;
1301 		__entry->more_data = more_data;
1302 	),
1303 
1304 	TP_printk(
1305 		LOCAL_PR_FMT STA_PR_FMT
1306 		" TIDs:0x%.4x frames:%d reason:%d more:%d",
1307 		LOCAL_PR_ARG, STA_PR_ARG, __entry->tids, __entry->num_frames,
1308 		__entry->reason, __entry->more_data
1309 	)
1310 );
1311 
1312 DEFINE_EVENT(release_evt, drv_release_buffered_frames,
1313 	TP_PROTO(struct ieee80211_local *local,
1314 		 struct ieee80211_sta *sta,
1315 		 u16 tids, int num_frames,
1316 		 enum ieee80211_frame_release_type reason,
1317 		 bool more_data),
1318 
1319 	TP_ARGS(local, sta, tids, num_frames, reason, more_data)
1320 );
1321 
1322 DEFINE_EVENT(release_evt, drv_allow_buffered_frames,
1323 	TP_PROTO(struct ieee80211_local *local,
1324 		 struct ieee80211_sta *sta,
1325 		 u16 tids, int num_frames,
1326 		 enum ieee80211_frame_release_type reason,
1327 		 bool more_data),
1328 
1329 	TP_ARGS(local, sta, tids, num_frames, reason, more_data)
1330 );
1331 
1332 TRACE_EVENT(drv_get_rssi,
1333 	TP_PROTO(struct ieee80211_local *local, struct ieee80211_sta *sta,
1334 		 s8 rssi, int ret),
1335 
1336 	TP_ARGS(local, sta, rssi, ret),
1337 
1338 	TP_STRUCT__entry(
1339 		LOCAL_ENTRY
1340 		STA_ENTRY
1341 		__field(s8, rssi)
1342 		__field(int, ret)
1343 	),
1344 
1345 	TP_fast_assign(
1346 		LOCAL_ASSIGN;
1347 		STA_ASSIGN;
1348 		__entry->rssi = rssi;
1349 		__entry->ret = ret;
1350 	),
1351 
1352 	TP_printk(
1353 		LOCAL_PR_FMT STA_PR_FMT " rssi:%d ret:%d",
1354 		LOCAL_PR_ARG, STA_PR_ARG, __entry->rssi, __entry->ret
1355 	)
1356 );
1357 
1358 DEFINE_EVENT(local_sdata_evt, drv_mgd_prepare_tx,
1359 	TP_PROTO(struct ieee80211_local *local,
1360 		 struct ieee80211_sub_if_data *sdata),
1361 
1362 	TP_ARGS(local, sdata)
1363 );
1364 
1365 DEFINE_EVENT(local_sdata_evt, drv_mgd_protect_tdls_discover,
1366 	TP_PROTO(struct ieee80211_local *local,
1367 		 struct ieee80211_sub_if_data *sdata),
1368 
1369 	TP_ARGS(local, sdata)
1370 );
1371 
1372 DECLARE_EVENT_CLASS(local_chanctx,
1373 	TP_PROTO(struct ieee80211_local *local,
1374 		 struct ieee80211_chanctx *ctx),
1375 
1376 	TP_ARGS(local, ctx),
1377 
1378 	TP_STRUCT__entry(
1379 		LOCAL_ENTRY
1380 		CHANCTX_ENTRY
1381 	),
1382 
1383 	TP_fast_assign(
1384 		LOCAL_ASSIGN;
1385 		CHANCTX_ASSIGN;
1386 	),
1387 
1388 	TP_printk(
1389 		LOCAL_PR_FMT CHANCTX_PR_FMT,
1390 		LOCAL_PR_ARG, CHANCTX_PR_ARG
1391 	)
1392 );
1393 
1394 DEFINE_EVENT(local_chanctx, drv_add_chanctx,
1395 	TP_PROTO(struct ieee80211_local *local,
1396 		 struct ieee80211_chanctx *ctx),
1397 	TP_ARGS(local, ctx)
1398 );
1399 
1400 DEFINE_EVENT(local_chanctx, drv_remove_chanctx,
1401 	TP_PROTO(struct ieee80211_local *local,
1402 		 struct ieee80211_chanctx *ctx),
1403 	TP_ARGS(local, ctx)
1404 );
1405 
1406 TRACE_EVENT(drv_change_chanctx,
1407 	TP_PROTO(struct ieee80211_local *local,
1408 		 struct ieee80211_chanctx *ctx,
1409 		 u32 changed),
1410 
1411 	TP_ARGS(local, ctx, changed),
1412 
1413 	TP_STRUCT__entry(
1414 		LOCAL_ENTRY
1415 		CHANCTX_ENTRY
1416 		__field(u32, changed)
1417 	),
1418 
1419 	TP_fast_assign(
1420 		LOCAL_ASSIGN;
1421 		CHANCTX_ASSIGN;
1422 		__entry->changed = changed;
1423 	),
1424 
1425 	TP_printk(
1426 		LOCAL_PR_FMT CHANCTX_PR_FMT " changed:%#x",
1427 		LOCAL_PR_ARG, CHANCTX_PR_ARG, __entry->changed
1428 	)
1429 );
1430 
1431 #if !defined(__TRACE_VIF_ENTRY)
1432 #define __TRACE_VIF_ENTRY
1433 struct trace_vif_entry {
1434 	enum nl80211_iftype vif_type;
1435 	bool p2p;
1436 	char vif_name[IFNAMSIZ];
1437 } __packed;
1438 
1439 struct trace_chandef_entry {
1440 	u32 control_freq;
1441 	u32 chan_width;
1442 	u32 center_freq1;
1443 	u32 center_freq2;
1444 } __packed;
1445 
1446 struct trace_switch_entry {
1447 	struct trace_vif_entry vif;
1448 	struct trace_chandef_entry old_chandef;
1449 	struct trace_chandef_entry new_chandef;
1450 } __packed;
1451 
1452 #define SWITCH_ENTRY_ASSIGN(to, from) local_vifs[i].to = vifs[i].from
1453 #endif
1454 
1455 TRACE_EVENT(drv_switch_vif_chanctx,
1456 	TP_PROTO(struct ieee80211_local *local,
1457 		 struct ieee80211_vif_chanctx_switch *vifs,
1458 		 int n_vifs, enum ieee80211_chanctx_switch_mode mode),
1459 	    TP_ARGS(local, vifs, n_vifs, mode),
1460 
1461 	TP_STRUCT__entry(
1462 		LOCAL_ENTRY
1463 		__field(int, n_vifs)
1464 		__field(u32, mode)
1465 		__dynamic_array(u8, vifs,
1466 				sizeof(struct trace_switch_entry) * n_vifs)
1467 	),
1468 
1469 	TP_fast_assign(
1470 		LOCAL_ASSIGN;
1471 		__entry->n_vifs = n_vifs;
1472 		__entry->mode = mode;
1473 		{
1474 			struct trace_switch_entry *local_vifs =
1475 				__get_dynamic_array(vifs);
1476 			int i;
1477 
1478 			for (i = 0; i < n_vifs; i++) {
1479 				struct ieee80211_sub_if_data *sdata;
1480 
1481 				sdata = container_of(vifs[i].vif,
1482 						struct ieee80211_sub_if_data,
1483 						vif);
1484 
1485 				SWITCH_ENTRY_ASSIGN(vif.vif_type, vif->type);
1486 				SWITCH_ENTRY_ASSIGN(vif.p2p, vif->p2p);
1487 				strncpy(local_vifs[i].vif.vif_name,
1488 					sdata->name,
1489 					sizeof(local_vifs[i].vif.vif_name));
1490 				SWITCH_ENTRY_ASSIGN(old_chandef.control_freq,
1491 						old_ctx->def.chan->center_freq);
1492 				SWITCH_ENTRY_ASSIGN(old_chandef.chan_width,
1493 						    old_ctx->def.width);
1494 				SWITCH_ENTRY_ASSIGN(old_chandef.center_freq1,
1495 						    old_ctx->def.center_freq1);
1496 				SWITCH_ENTRY_ASSIGN(old_chandef.center_freq2,
1497 						    old_ctx->def.center_freq2);
1498 				SWITCH_ENTRY_ASSIGN(new_chandef.control_freq,
1499 						new_ctx->def.chan->center_freq);
1500 				SWITCH_ENTRY_ASSIGN(new_chandef.chan_width,
1501 						    new_ctx->def.width);
1502 				SWITCH_ENTRY_ASSIGN(new_chandef.center_freq1,
1503 						    new_ctx->def.center_freq1);
1504 				SWITCH_ENTRY_ASSIGN(new_chandef.center_freq2,
1505 						    new_ctx->def.center_freq2);
1506 			}
1507 		}
1508 	),
1509 
1510 	TP_printk(
1511 		LOCAL_PR_FMT " n_vifs:%d mode:%d",
1512 		LOCAL_PR_ARG, __entry->n_vifs, __entry->mode
1513 	)
1514 );
1515 
1516 DECLARE_EVENT_CLASS(local_sdata_chanctx,
1517 	TP_PROTO(struct ieee80211_local *local,
1518 		 struct ieee80211_sub_if_data *sdata,
1519 		 struct ieee80211_chanctx *ctx),
1520 
1521 	TP_ARGS(local, sdata, ctx),
1522 
1523 	TP_STRUCT__entry(
1524 		LOCAL_ENTRY
1525 		VIF_ENTRY
1526 		CHANCTX_ENTRY
1527 	),
1528 
1529 	TP_fast_assign(
1530 		LOCAL_ASSIGN;
1531 		VIF_ASSIGN;
1532 		CHANCTX_ASSIGN;
1533 	),
1534 
1535 	TP_printk(
1536 		LOCAL_PR_FMT VIF_PR_FMT CHANCTX_PR_FMT,
1537 		LOCAL_PR_ARG, VIF_PR_ARG, CHANCTX_PR_ARG
1538 	)
1539 );
1540 
1541 DEFINE_EVENT(local_sdata_chanctx, drv_assign_vif_chanctx,
1542 	TP_PROTO(struct ieee80211_local *local,
1543 		 struct ieee80211_sub_if_data *sdata,
1544 		 struct ieee80211_chanctx *ctx),
1545 	TP_ARGS(local, sdata, ctx)
1546 );
1547 
1548 DEFINE_EVENT(local_sdata_chanctx, drv_unassign_vif_chanctx,
1549 	TP_PROTO(struct ieee80211_local *local,
1550 		 struct ieee80211_sub_if_data *sdata,
1551 		 struct ieee80211_chanctx *ctx),
1552 	TP_ARGS(local, sdata, ctx)
1553 );
1554 
1555 TRACE_EVENT(drv_start_ap,
1556 	TP_PROTO(struct ieee80211_local *local,
1557 		 struct ieee80211_sub_if_data *sdata,
1558 		 struct ieee80211_bss_conf *info),
1559 
1560 	TP_ARGS(local, sdata, info),
1561 
1562 	TP_STRUCT__entry(
1563 		LOCAL_ENTRY
1564 		VIF_ENTRY
1565 		__field(u8, dtimper)
1566 		__field(u16, bcnint)
1567 		__dynamic_array(u8, ssid, info->ssid_len);
1568 		__field(bool, hidden_ssid);
1569 	),
1570 
1571 	TP_fast_assign(
1572 		LOCAL_ASSIGN;
1573 		VIF_ASSIGN;
1574 		__entry->dtimper = info->dtim_period;
1575 		__entry->bcnint = info->beacon_int;
1576 		memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len);
1577 		__entry->hidden_ssid = info->hidden_ssid;
1578 	),
1579 
1580 	TP_printk(
1581 		LOCAL_PR_FMT  VIF_PR_FMT,
1582 		LOCAL_PR_ARG, VIF_PR_ARG
1583 	)
1584 );
1585 
1586 DEFINE_EVENT(local_sdata_evt, drv_stop_ap,
1587 	TP_PROTO(struct ieee80211_local *local,
1588 		 struct ieee80211_sub_if_data *sdata),
1589 	TP_ARGS(local, sdata)
1590 );
1591 
1592 TRACE_EVENT(drv_reconfig_complete,
1593 	TP_PROTO(struct ieee80211_local *local,
1594 		 enum ieee80211_reconfig_type reconfig_type),
1595 	TP_ARGS(local, reconfig_type),
1596 
1597 	TP_STRUCT__entry(
1598 		LOCAL_ENTRY
1599 		__field(u8, reconfig_type)
1600 	),
1601 
1602 	TP_fast_assign(
1603 		LOCAL_ASSIGN;
1604 		__entry->reconfig_type = reconfig_type;
1605 	),
1606 
1607 	TP_printk(
1608 		LOCAL_PR_FMT  " reconfig_type:%d",
1609 		LOCAL_PR_ARG, __entry->reconfig_type
1610 	)
1611 
1612 );
1613 
1614 #if IS_ENABLED(CONFIG_IPV6)
1615 DEFINE_EVENT(local_sdata_evt, drv_ipv6_addr_change,
1616 	TP_PROTO(struct ieee80211_local *local,
1617 		 struct ieee80211_sub_if_data *sdata),
1618 	TP_ARGS(local, sdata)
1619 );
1620 #endif
1621 
1622 TRACE_EVENT(drv_join_ibss,
1623 	TP_PROTO(struct ieee80211_local *local,
1624 		 struct ieee80211_sub_if_data *sdata,
1625 		 struct ieee80211_bss_conf *info),
1626 
1627 	TP_ARGS(local, sdata, info),
1628 
1629 	TP_STRUCT__entry(
1630 		LOCAL_ENTRY
1631 		VIF_ENTRY
1632 		__field(u8, dtimper)
1633 		__field(u16, bcnint)
1634 		__dynamic_array(u8, ssid, info->ssid_len);
1635 	),
1636 
1637 	TP_fast_assign(
1638 		LOCAL_ASSIGN;
1639 		VIF_ASSIGN;
1640 		__entry->dtimper = info->dtim_period;
1641 		__entry->bcnint = info->beacon_int;
1642 		memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len);
1643 	),
1644 
1645 	TP_printk(
1646 		LOCAL_PR_FMT  VIF_PR_FMT,
1647 		LOCAL_PR_ARG, VIF_PR_ARG
1648 	)
1649 );
1650 
1651 DEFINE_EVENT(local_sdata_evt, drv_leave_ibss,
1652 	TP_PROTO(struct ieee80211_local *local,
1653 		 struct ieee80211_sub_if_data *sdata),
1654 	TP_ARGS(local, sdata)
1655 );
1656 
1657 TRACE_EVENT(drv_get_expected_throughput,
1658 	TP_PROTO(struct ieee80211_sta *sta),
1659 
1660 	TP_ARGS(sta),
1661 
1662 	TP_STRUCT__entry(
1663 		STA_ENTRY
1664 	),
1665 
1666 	TP_fast_assign(
1667 		STA_ASSIGN;
1668 	),
1669 
1670 	TP_printk(
1671 		STA_PR_FMT, STA_PR_ARG
1672 	)
1673 );
1674 
1675 /*
1676  * Tracing for API calls that drivers call.
1677  */
1678 
1679 TRACE_EVENT(api_start_tx_ba_session,
1680 	TP_PROTO(struct ieee80211_sta *sta, u16 tid),
1681 
1682 	TP_ARGS(sta, tid),
1683 
1684 	TP_STRUCT__entry(
1685 		STA_ENTRY
1686 		__field(u16, tid)
1687 	),
1688 
1689 	TP_fast_assign(
1690 		STA_ASSIGN;
1691 		__entry->tid = tid;
1692 	),
1693 
1694 	TP_printk(
1695 		STA_PR_FMT " tid:%d",
1696 		STA_PR_ARG, __entry->tid
1697 	)
1698 );
1699 
1700 TRACE_EVENT(api_start_tx_ba_cb,
1701 	TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid),
1702 
1703 	TP_ARGS(sdata, ra, tid),
1704 
1705 	TP_STRUCT__entry(
1706 		VIF_ENTRY
1707 		__array(u8, ra, ETH_ALEN)
1708 		__field(u16, tid)
1709 	),
1710 
1711 	TP_fast_assign(
1712 		VIF_ASSIGN;
1713 		memcpy(__entry->ra, ra, ETH_ALEN);
1714 		__entry->tid = tid;
1715 	),
1716 
1717 	TP_printk(
1718 		VIF_PR_FMT " ra:%pM tid:%d",
1719 		VIF_PR_ARG, __entry->ra, __entry->tid
1720 	)
1721 );
1722 
1723 TRACE_EVENT(api_stop_tx_ba_session,
1724 	TP_PROTO(struct ieee80211_sta *sta, u16 tid),
1725 
1726 	TP_ARGS(sta, tid),
1727 
1728 	TP_STRUCT__entry(
1729 		STA_ENTRY
1730 		__field(u16, tid)
1731 	),
1732 
1733 	TP_fast_assign(
1734 		STA_ASSIGN;
1735 		__entry->tid = tid;
1736 	),
1737 
1738 	TP_printk(
1739 		STA_PR_FMT " tid:%d",
1740 		STA_PR_ARG, __entry->tid
1741 	)
1742 );
1743 
1744 TRACE_EVENT(api_stop_tx_ba_cb,
1745 	TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid),
1746 
1747 	TP_ARGS(sdata, ra, tid),
1748 
1749 	TP_STRUCT__entry(
1750 		VIF_ENTRY
1751 		__array(u8, ra, ETH_ALEN)
1752 		__field(u16, tid)
1753 	),
1754 
1755 	TP_fast_assign(
1756 		VIF_ASSIGN;
1757 		memcpy(__entry->ra, ra, ETH_ALEN);
1758 		__entry->tid = tid;
1759 	),
1760 
1761 	TP_printk(
1762 		VIF_PR_FMT " ra:%pM tid:%d",
1763 		VIF_PR_ARG, __entry->ra, __entry->tid
1764 	)
1765 );
1766 
1767 DEFINE_EVENT(local_only_evt, api_restart_hw,
1768 	TP_PROTO(struct ieee80211_local *local),
1769 	TP_ARGS(local)
1770 );
1771 
1772 TRACE_EVENT(api_beacon_loss,
1773 	TP_PROTO(struct ieee80211_sub_if_data *sdata),
1774 
1775 	TP_ARGS(sdata),
1776 
1777 	TP_STRUCT__entry(
1778 		VIF_ENTRY
1779 	),
1780 
1781 	TP_fast_assign(
1782 		VIF_ASSIGN;
1783 	),
1784 
1785 	TP_printk(
1786 		VIF_PR_FMT,
1787 		VIF_PR_ARG
1788 	)
1789 );
1790 
1791 TRACE_EVENT(api_connection_loss,
1792 	TP_PROTO(struct ieee80211_sub_if_data *sdata),
1793 
1794 	TP_ARGS(sdata),
1795 
1796 	TP_STRUCT__entry(
1797 		VIF_ENTRY
1798 	),
1799 
1800 	TP_fast_assign(
1801 		VIF_ASSIGN;
1802 	),
1803 
1804 	TP_printk(
1805 		VIF_PR_FMT,
1806 		VIF_PR_ARG
1807 	)
1808 );
1809 
1810 TRACE_EVENT(api_cqm_rssi_notify,
1811 	TP_PROTO(struct ieee80211_sub_if_data *sdata,
1812 		 enum nl80211_cqm_rssi_threshold_event rssi_event),
1813 
1814 	TP_ARGS(sdata, rssi_event),
1815 
1816 	TP_STRUCT__entry(
1817 		VIF_ENTRY
1818 		__field(u32, rssi_event)
1819 	),
1820 
1821 	TP_fast_assign(
1822 		VIF_ASSIGN;
1823 		__entry->rssi_event = rssi_event;
1824 	),
1825 
1826 	TP_printk(
1827 		VIF_PR_FMT " event:%d",
1828 		VIF_PR_ARG, __entry->rssi_event
1829 	)
1830 );
1831 
1832 DEFINE_EVENT(local_sdata_evt, api_cqm_beacon_loss_notify,
1833 	TP_PROTO(struct ieee80211_local *local,
1834 		 struct ieee80211_sub_if_data *sdata),
1835 	TP_ARGS(local, sdata)
1836 );
1837 
1838 TRACE_EVENT(api_scan_completed,
1839 	TP_PROTO(struct ieee80211_local *local, bool aborted),
1840 
1841 	TP_ARGS(local, aborted),
1842 
1843 	TP_STRUCT__entry(
1844 		LOCAL_ENTRY
1845 		__field(bool, aborted)
1846 	),
1847 
1848 	TP_fast_assign(
1849 		LOCAL_ASSIGN;
1850 		__entry->aborted = aborted;
1851 	),
1852 
1853 	TP_printk(
1854 		LOCAL_PR_FMT " aborted:%d",
1855 		LOCAL_PR_ARG, __entry->aborted
1856 	)
1857 );
1858 
1859 TRACE_EVENT(api_sched_scan_results,
1860 	TP_PROTO(struct ieee80211_local *local),
1861 
1862 	TP_ARGS(local),
1863 
1864 	TP_STRUCT__entry(
1865 		LOCAL_ENTRY
1866 	),
1867 
1868 	TP_fast_assign(
1869 		LOCAL_ASSIGN;
1870 	),
1871 
1872 	TP_printk(
1873 		LOCAL_PR_FMT, LOCAL_PR_ARG
1874 	)
1875 );
1876 
1877 TRACE_EVENT(api_sched_scan_stopped,
1878 	TP_PROTO(struct ieee80211_local *local),
1879 
1880 	TP_ARGS(local),
1881 
1882 	TP_STRUCT__entry(
1883 		LOCAL_ENTRY
1884 	),
1885 
1886 	TP_fast_assign(
1887 		LOCAL_ASSIGN;
1888 	),
1889 
1890 	TP_printk(
1891 		LOCAL_PR_FMT, LOCAL_PR_ARG
1892 	)
1893 );
1894 
1895 TRACE_EVENT(api_sta_block_awake,
1896 	TP_PROTO(struct ieee80211_local *local,
1897 		 struct ieee80211_sta *sta, bool block),
1898 
1899 	TP_ARGS(local, sta, block),
1900 
1901 	TP_STRUCT__entry(
1902 		LOCAL_ENTRY
1903 		STA_ENTRY
1904 		__field(bool, block)
1905 	),
1906 
1907 	TP_fast_assign(
1908 		LOCAL_ASSIGN;
1909 		STA_ASSIGN;
1910 		__entry->block = block;
1911 	),
1912 
1913 	TP_printk(
1914 		LOCAL_PR_FMT STA_PR_FMT " block:%d",
1915 		LOCAL_PR_ARG, STA_PR_ARG, __entry->block
1916 	)
1917 );
1918 
1919 TRACE_EVENT(api_chswitch_done,
1920 	TP_PROTO(struct ieee80211_sub_if_data *sdata, bool success),
1921 
1922 	TP_ARGS(sdata, success),
1923 
1924 	TP_STRUCT__entry(
1925 		VIF_ENTRY
1926 		__field(bool, success)
1927 	),
1928 
1929 	TP_fast_assign(
1930 		VIF_ASSIGN;
1931 		__entry->success = success;
1932 	),
1933 
1934 	TP_printk(
1935 		VIF_PR_FMT " success=%d",
1936 		VIF_PR_ARG, __entry->success
1937 	)
1938 );
1939 
1940 DEFINE_EVENT(local_only_evt, api_ready_on_channel,
1941 	TP_PROTO(struct ieee80211_local *local),
1942 	TP_ARGS(local)
1943 );
1944 
1945 DEFINE_EVENT(local_only_evt, api_remain_on_channel_expired,
1946 	TP_PROTO(struct ieee80211_local *local),
1947 	TP_ARGS(local)
1948 );
1949 
1950 TRACE_EVENT(api_gtk_rekey_notify,
1951 	TP_PROTO(struct ieee80211_sub_if_data *sdata,
1952 		 const u8 *bssid, const u8 *replay_ctr),
1953 
1954 	TP_ARGS(sdata, bssid, replay_ctr),
1955 
1956 	TP_STRUCT__entry(
1957 		VIF_ENTRY
1958 		__array(u8, bssid, ETH_ALEN)
1959 		__array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN)
1960 	),
1961 
1962 	TP_fast_assign(
1963 		VIF_ASSIGN;
1964 		memcpy(__entry->bssid, bssid, ETH_ALEN);
1965 		memcpy(__entry->replay_ctr, replay_ctr, NL80211_REPLAY_CTR_LEN);
1966 	),
1967 
1968 	TP_printk(VIF_PR_FMT, VIF_PR_ARG)
1969 );
1970 
1971 TRACE_EVENT(api_enable_rssi_reports,
1972 	TP_PROTO(struct ieee80211_sub_if_data *sdata,
1973 		 int rssi_min_thold, int rssi_max_thold),
1974 
1975 	TP_ARGS(sdata, rssi_min_thold, rssi_max_thold),
1976 
1977 	TP_STRUCT__entry(
1978 		VIF_ENTRY
1979 		__field(int, rssi_min_thold)
1980 		__field(int, rssi_max_thold)
1981 	),
1982 
1983 	TP_fast_assign(
1984 		VIF_ASSIGN;
1985 		__entry->rssi_min_thold = rssi_min_thold;
1986 		__entry->rssi_max_thold = rssi_max_thold;
1987 	),
1988 
1989 	TP_printk(
1990 		VIF_PR_FMT " rssi_min_thold =%d, rssi_max_thold = %d",
1991 		VIF_PR_ARG, __entry->rssi_min_thold, __entry->rssi_max_thold
1992 	)
1993 );
1994 
1995 TRACE_EVENT(api_eosp,
1996 	TP_PROTO(struct ieee80211_local *local,
1997 		 struct ieee80211_sta *sta),
1998 
1999 	TP_ARGS(local, sta),
2000 
2001 	TP_STRUCT__entry(
2002 		LOCAL_ENTRY
2003 		STA_ENTRY
2004 	),
2005 
2006 	TP_fast_assign(
2007 		LOCAL_ASSIGN;
2008 		STA_ASSIGN;
2009 	),
2010 
2011 	TP_printk(
2012 		LOCAL_PR_FMT STA_PR_FMT,
2013 		LOCAL_PR_ARG, STA_PR_ARG
2014 	)
2015 );
2016 
2017 TRACE_EVENT(api_sta_set_buffered,
2018 	TP_PROTO(struct ieee80211_local *local,
2019 		 struct ieee80211_sta *sta,
2020 		 u8 tid, bool buffered),
2021 
2022 	TP_ARGS(local, sta, tid, buffered),
2023 
2024 	TP_STRUCT__entry(
2025 		LOCAL_ENTRY
2026 		STA_ENTRY
2027 		__field(u8, tid)
2028 		__field(bool, buffered)
2029 	),
2030 
2031 	TP_fast_assign(
2032 		LOCAL_ASSIGN;
2033 		STA_ASSIGN;
2034 		__entry->tid = tid;
2035 		__entry->buffered = buffered;
2036 	),
2037 
2038 	TP_printk(
2039 		LOCAL_PR_FMT STA_PR_FMT " tid:%d buffered:%d",
2040 		LOCAL_PR_ARG, STA_PR_ARG, __entry->tid, __entry->buffered
2041 	)
2042 );
2043 
2044 /*
2045  * Tracing for internal functions
2046  * (which may also be called in response to driver calls)
2047  */
2048 
2049 TRACE_EVENT(wake_queue,
2050 	TP_PROTO(struct ieee80211_local *local, u16 queue,
2051 		 enum queue_stop_reason reason),
2052 
2053 	TP_ARGS(local, queue, reason),
2054 
2055 	TP_STRUCT__entry(
2056 		LOCAL_ENTRY
2057 		__field(u16, queue)
2058 		__field(u32, reason)
2059 	),
2060 
2061 	TP_fast_assign(
2062 		LOCAL_ASSIGN;
2063 		__entry->queue = queue;
2064 		__entry->reason = reason;
2065 	),
2066 
2067 	TP_printk(
2068 		LOCAL_PR_FMT " queue:%d, reason:%d",
2069 		LOCAL_PR_ARG, __entry->queue, __entry->reason
2070 	)
2071 );
2072 
2073 TRACE_EVENT(stop_queue,
2074 	TP_PROTO(struct ieee80211_local *local, u16 queue,
2075 		 enum queue_stop_reason reason),
2076 
2077 	TP_ARGS(local, queue, reason),
2078 
2079 	TP_STRUCT__entry(
2080 		LOCAL_ENTRY
2081 		__field(u16, queue)
2082 		__field(u32, reason)
2083 	),
2084 
2085 	TP_fast_assign(
2086 		LOCAL_ASSIGN;
2087 		__entry->queue = queue;
2088 		__entry->reason = reason;
2089 	),
2090 
2091 	TP_printk(
2092 		LOCAL_PR_FMT " queue:%d, reason:%d",
2093 		LOCAL_PR_ARG, __entry->queue, __entry->reason
2094 	)
2095 );
2096 
2097 TRACE_EVENT(drv_set_default_unicast_key,
2098 	TP_PROTO(struct ieee80211_local *local,
2099 		 struct ieee80211_sub_if_data *sdata,
2100 		 int key_idx),
2101 
2102 	TP_ARGS(local, sdata, key_idx),
2103 
2104 	TP_STRUCT__entry(
2105 		LOCAL_ENTRY
2106 		VIF_ENTRY
2107 		__field(int, key_idx)
2108 	),
2109 
2110 	TP_fast_assign(
2111 		LOCAL_ASSIGN;
2112 		VIF_ASSIGN;
2113 		__entry->key_idx = key_idx;
2114 	),
2115 
2116 	TP_printk(LOCAL_PR_FMT VIF_PR_FMT " key_idx:%d",
2117 		  LOCAL_PR_ARG, VIF_PR_ARG, __entry->key_idx)
2118 );
2119 
2120 TRACE_EVENT(api_radar_detected,
2121 	TP_PROTO(struct ieee80211_local *local),
2122 
2123 	TP_ARGS(local),
2124 
2125 	TP_STRUCT__entry(
2126 		LOCAL_ENTRY
2127 	),
2128 
2129 	TP_fast_assign(
2130 		LOCAL_ASSIGN;
2131 	),
2132 
2133 	TP_printk(
2134 		LOCAL_PR_FMT " radar detected",
2135 		LOCAL_PR_ARG
2136 	)
2137 );
2138 
2139 TRACE_EVENT(drv_channel_switch_beacon,
2140 	TP_PROTO(struct ieee80211_local *local,
2141 		 struct ieee80211_sub_if_data *sdata,
2142 		 struct cfg80211_chan_def *chandef),
2143 
2144 	TP_ARGS(local, sdata, chandef),
2145 
2146 	TP_STRUCT__entry(
2147 		LOCAL_ENTRY
2148 		VIF_ENTRY
2149 		CHANDEF_ENTRY
2150 	),
2151 
2152 	TP_fast_assign(
2153 		LOCAL_ASSIGN;
2154 		VIF_ASSIGN;
2155 		CHANDEF_ASSIGN(chandef);
2156 	),
2157 
2158 	TP_printk(
2159 		LOCAL_PR_FMT VIF_PR_FMT " channel switch to " CHANDEF_PR_FMT,
2160 		LOCAL_PR_ARG, VIF_PR_ARG, CHANDEF_PR_ARG
2161 	)
2162 );
2163 
2164 TRACE_EVENT(drv_pre_channel_switch,
2165 	TP_PROTO(struct ieee80211_local *local,
2166 		 struct ieee80211_sub_if_data *sdata,
2167 		 struct ieee80211_channel_switch *ch_switch),
2168 
2169 	TP_ARGS(local, sdata, ch_switch),
2170 
2171 	TP_STRUCT__entry(
2172 		LOCAL_ENTRY
2173 		VIF_ENTRY
2174 		CHANDEF_ENTRY
2175 		__field(u64, timestamp)
2176 		__field(u32, device_timestamp)
2177 		__field(bool, block_tx)
2178 		__field(u8, count)
2179 	),
2180 
2181 	TP_fast_assign(
2182 		LOCAL_ASSIGN;
2183 		VIF_ASSIGN;
2184 		CHANDEF_ASSIGN(&ch_switch->chandef)
2185 		__entry->timestamp = ch_switch->timestamp;
2186 		__entry->device_timestamp = ch_switch->device_timestamp;
2187 		__entry->block_tx = ch_switch->block_tx;
2188 		__entry->count = ch_switch->count;
2189 	),
2190 
2191 	TP_printk(
2192 		LOCAL_PR_FMT VIF_PR_FMT " prepare channel switch to "
2193 		CHANDEF_PR_FMT  " count:%d block_tx:%d timestamp:%llu",
2194 		LOCAL_PR_ARG, VIF_PR_ARG, CHANDEF_PR_ARG, __entry->count,
2195 		__entry->block_tx, __entry->timestamp
2196 	)
2197 );
2198 
2199 DEFINE_EVENT(local_sdata_evt, drv_post_channel_switch,
2200 	     TP_PROTO(struct ieee80211_local *local,
2201 		      struct ieee80211_sub_if_data *sdata),
2202 	     TP_ARGS(local, sdata)
2203 );
2204 
2205 TRACE_EVENT(drv_get_txpower,
2206 	TP_PROTO(struct ieee80211_local *local,
2207 		 struct ieee80211_sub_if_data *sdata,
2208 		 int dbm, int ret),
2209 
2210 	TP_ARGS(local, sdata, dbm, ret),
2211 
2212 	TP_STRUCT__entry(
2213 		LOCAL_ENTRY
2214 		VIF_ENTRY
2215 		__field(int, dbm)
2216 		__field(int, ret)
2217 	),
2218 
2219 	TP_fast_assign(
2220 		LOCAL_ASSIGN;
2221 		VIF_ASSIGN;
2222 		__entry->dbm = dbm;
2223 		__entry->ret = ret;
2224 	),
2225 
2226 	TP_printk(
2227 		LOCAL_PR_FMT VIF_PR_FMT " dbm:%d ret:%d",
2228 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->dbm, __entry->ret
2229 	)
2230 );
2231 
2232 TRACE_EVENT(drv_tdls_channel_switch,
2233 	TP_PROTO(struct ieee80211_local *local,
2234 		 struct ieee80211_sub_if_data *sdata,
2235 		 struct ieee80211_sta *sta, u8 oper_class,
2236 		 struct cfg80211_chan_def *chandef),
2237 
2238 	TP_ARGS(local, sdata, sta, oper_class, chandef),
2239 
2240 	TP_STRUCT__entry(
2241 		LOCAL_ENTRY
2242 		VIF_ENTRY
2243 		STA_ENTRY
2244 		__field(u8, oper_class)
2245 		CHANDEF_ENTRY
2246 	),
2247 
2248 	TP_fast_assign(
2249 		LOCAL_ASSIGN;
2250 		VIF_ASSIGN;
2251 		STA_ASSIGN;
2252 		__entry->oper_class = oper_class;
2253 		CHANDEF_ASSIGN(chandef)
2254 	),
2255 
2256 	TP_printk(
2257 		LOCAL_PR_FMT VIF_PR_FMT " tdls channel switch to"
2258 		CHANDEF_PR_FMT  " oper_class:%d " STA_PR_FMT,
2259 		LOCAL_PR_ARG, VIF_PR_ARG, CHANDEF_PR_ARG, __entry->oper_class,
2260 		STA_PR_ARG
2261 	)
2262 );
2263 
2264 TRACE_EVENT(drv_tdls_cancel_channel_switch,
2265 	TP_PROTO(struct ieee80211_local *local,
2266 		 struct ieee80211_sub_if_data *sdata,
2267 		 struct ieee80211_sta *sta),
2268 
2269 	TP_ARGS(local, sdata, sta),
2270 
2271 	TP_STRUCT__entry(
2272 		LOCAL_ENTRY
2273 		VIF_ENTRY
2274 		STA_ENTRY
2275 	),
2276 
2277 	TP_fast_assign(
2278 		LOCAL_ASSIGN;
2279 		VIF_ASSIGN;
2280 		STA_ASSIGN;
2281 	),
2282 
2283 	TP_printk(
2284 		LOCAL_PR_FMT VIF_PR_FMT
2285 		" tdls cancel channel switch with " STA_PR_FMT,
2286 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
2287 	)
2288 );
2289 
2290 TRACE_EVENT(drv_tdls_recv_channel_switch,
2291 	TP_PROTO(struct ieee80211_local *local,
2292 		 struct ieee80211_sub_if_data *sdata,
2293 		 struct ieee80211_tdls_ch_sw_params *params),
2294 
2295 	TP_ARGS(local, sdata, params),
2296 
2297 	TP_STRUCT__entry(
2298 		LOCAL_ENTRY
2299 		VIF_ENTRY
2300 		__field(u8, action_code)
2301 		STA_ENTRY
2302 		CHANDEF_ENTRY
2303 		__field(u32, status)
2304 		__field(bool, peer_initiator)
2305 		__field(u32, timestamp)
2306 		__field(u16, switch_time)
2307 		__field(u16, switch_timeout)
2308 	),
2309 
2310 	TP_fast_assign(
2311 		LOCAL_ASSIGN;
2312 		VIF_ASSIGN;
2313 		STA_NAMED_ASSIGN(params->sta);
2314 		CHANDEF_ASSIGN(params->chandef)
2315 		__entry->peer_initiator = params->sta->tdls_initiator;
2316 		__entry->action_code = params->action_code;
2317 		__entry->status = params->status;
2318 		__entry->timestamp = params->timestamp;
2319 		__entry->switch_time = params->switch_time;
2320 		__entry->switch_timeout = params->switch_timeout;
2321 	),
2322 
2323 	TP_printk(
2324 		LOCAL_PR_FMT VIF_PR_FMT " received tdls channel switch packet"
2325 		" action:%d status:%d time:%d switch time:%d switch"
2326 		" timeout:%d initiator: %d chan:" CHANDEF_PR_FMT STA_PR_FMT,
2327 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->action_code, __entry->status,
2328 		__entry->timestamp, __entry->switch_time,
2329 		__entry->switch_timeout, __entry->peer_initiator,
2330 		CHANDEF_PR_ARG, STA_PR_ARG
2331 	)
2332 );
2333 
2334 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
2335 #undef TRACE_SYSTEM
2336 #define TRACE_SYSTEM mac80211_msg
2337 
2338 #define MAX_MSG_LEN	100
2339 
2340 DECLARE_EVENT_CLASS(mac80211_msg_event,
2341 	TP_PROTO(struct va_format *vaf),
2342 
2343 	TP_ARGS(vaf),
2344 
2345 	TP_STRUCT__entry(
2346 		__dynamic_array(char, msg, MAX_MSG_LEN)
2347 	),
2348 
2349 	TP_fast_assign(
2350 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
2351 				       MAX_MSG_LEN, vaf->fmt,
2352 				       *vaf->va) >= MAX_MSG_LEN);
2353 	),
2354 
2355 	TP_printk("%s", __get_str(msg))
2356 );
2357 
2358 DEFINE_EVENT(mac80211_msg_event, mac80211_info,
2359 	TP_PROTO(struct va_format *vaf),
2360 	TP_ARGS(vaf)
2361 );
2362 DEFINE_EVENT(mac80211_msg_event, mac80211_dbg,
2363 	TP_PROTO(struct va_format *vaf),
2364 	TP_ARGS(vaf)
2365 );
2366 DEFINE_EVENT(mac80211_msg_event, mac80211_err,
2367 	TP_PROTO(struct va_format *vaf),
2368 	TP_ARGS(vaf)
2369 );
2370 #endif
2371 
2372 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
2373 
2374 #undef TRACE_INCLUDE_PATH
2375 #define TRACE_INCLUDE_PATH .
2376 #undef TRACE_INCLUDE_FILE
2377 #define TRACE_INCLUDE_FILE trace
2378 #include <trace/define_trace.h>
2379