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 #if !defined(CONFIG_MAC80211_DRIVER_API_TRACER) || defined(__CHECKER__)
9 #undef TRACE_EVENT
10 #define TRACE_EVENT(name, proto, ...) \
11 static inline void trace_ ## name(proto) {}
12 #undef DECLARE_EVENT_CLASS
13 #define DECLARE_EVENT_CLASS(...)
14 #undef DEFINE_EVENT
15 #define DEFINE_EVENT(evt_class, name, proto, ...) \
16 static inline void trace_ ## name(proto) {}
17 #endif
18 
19 #undef TRACE_SYSTEM
20 #define TRACE_SYSTEM mac80211
21 
22 #define MAXNAME		32
23 #define LOCAL_ENTRY	__array(char, wiphy_name, 32)
24 #define LOCAL_ASSIGN	strlcpy(__entry->wiphy_name, wiphy_name(local->hw.wiphy), MAXNAME)
25 #define LOCAL_PR_FMT	"%s"
26 #define LOCAL_PR_ARG	__entry->wiphy_name
27 
28 #define STA_ENTRY	__array(char, sta_addr, ETH_ALEN)
29 #define STA_ASSIGN	(sta ? memcpy(__entry->sta_addr, sta->addr, ETH_ALEN) : memset(__entry->sta_addr, 0, ETH_ALEN))
30 #define STA_PR_FMT	" sta:%pM"
31 #define STA_PR_ARG	__entry->sta_addr
32 
33 #define VIF_ENTRY	__field(enum nl80211_iftype, vif_type) __field(void *, sdata)	\
34 			__field(bool, p2p)						\
35 			__string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
36 #define VIF_ASSIGN	__entry->vif_type = sdata->vif.type; __entry->sdata = sdata;	\
37 			__entry->p2p = sdata->vif.p2p;					\
38 			__assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
39 #define VIF_PR_FMT	" vif:%s(%d%s)"
40 #define VIF_PR_ARG	__get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
41 
42 /*
43  * Tracing for driver callbacks.
44  */
45 
46 DECLARE_EVENT_CLASS(local_only_evt,
47 	TP_PROTO(struct ieee80211_local *local),
48 	TP_ARGS(local),
49 	TP_STRUCT__entry(
50 		LOCAL_ENTRY
51 	),
52 	TP_fast_assign(
53 		LOCAL_ASSIGN;
54 	),
55 	TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
56 );
57 
58 DEFINE_EVENT(local_only_evt, drv_return_void,
59 	TP_PROTO(struct ieee80211_local *local),
60 	TP_ARGS(local)
61 );
62 
63 TRACE_EVENT(drv_return_int,
64 	TP_PROTO(struct ieee80211_local *local, int ret),
65 	TP_ARGS(local, ret),
66 	TP_STRUCT__entry(
67 		LOCAL_ENTRY
68 		__field(int, ret)
69 	),
70 	TP_fast_assign(
71 		LOCAL_ASSIGN;
72 		__entry->ret = ret;
73 	),
74 	TP_printk(LOCAL_PR_FMT " - %d", LOCAL_PR_ARG, __entry->ret)
75 );
76 
77 TRACE_EVENT(drv_return_u64,
78 	TP_PROTO(struct ieee80211_local *local, u64 ret),
79 	TP_ARGS(local, ret),
80 	TP_STRUCT__entry(
81 		LOCAL_ENTRY
82 		__field(u64, ret)
83 	),
84 	TP_fast_assign(
85 		LOCAL_ASSIGN;
86 		__entry->ret = ret;
87 	),
88 	TP_printk(LOCAL_PR_FMT " - %llu", LOCAL_PR_ARG, __entry->ret)
89 );
90 
91 DEFINE_EVENT(local_only_evt, drv_start,
92 	TP_PROTO(struct ieee80211_local *local),
93 	TP_ARGS(local)
94 );
95 
96 DEFINE_EVENT(local_only_evt, drv_stop,
97 	TP_PROTO(struct ieee80211_local *local),
98 	TP_ARGS(local)
99 );
100 
101 TRACE_EVENT(drv_add_interface,
102 	TP_PROTO(struct ieee80211_local *local,
103 		 struct ieee80211_sub_if_data *sdata),
104 
105 	TP_ARGS(local, sdata),
106 
107 	TP_STRUCT__entry(
108 		LOCAL_ENTRY
109 		VIF_ENTRY
110 		__array(char, addr, 6)
111 	),
112 
113 	TP_fast_assign(
114 		LOCAL_ASSIGN;
115 		VIF_ASSIGN;
116 		memcpy(__entry->addr, sdata->vif.addr, 6);
117 	),
118 
119 	TP_printk(
120 		LOCAL_PR_FMT  VIF_PR_FMT " addr:%pM",
121 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->addr
122 	)
123 );
124 
125 TRACE_EVENT(drv_change_interface,
126 	TP_PROTO(struct ieee80211_local *local,
127 		 struct ieee80211_sub_if_data *sdata,
128 		 enum nl80211_iftype type, bool p2p),
129 
130 	TP_ARGS(local, sdata, type, p2p),
131 
132 	TP_STRUCT__entry(
133 		LOCAL_ENTRY
134 		VIF_ENTRY
135 		__field(u32, new_type)
136 		__field(bool, new_p2p)
137 	),
138 
139 	TP_fast_assign(
140 		LOCAL_ASSIGN;
141 		VIF_ASSIGN;
142 		__entry->new_type = type;
143 		__entry->new_p2p = p2p;
144 	),
145 
146 	TP_printk(
147 		LOCAL_PR_FMT  VIF_PR_FMT " new type:%d%s",
148 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type,
149 		__entry->new_p2p ? "/p2p" : ""
150 	)
151 );
152 
153 TRACE_EVENT(drv_remove_interface,
154 	TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata),
155 
156 	TP_ARGS(local, sdata),
157 
158 	TP_STRUCT__entry(
159 		LOCAL_ENTRY
160 		VIF_ENTRY
161 		__array(char, addr, 6)
162 	),
163 
164 	TP_fast_assign(
165 		LOCAL_ASSIGN;
166 		VIF_ASSIGN;
167 		memcpy(__entry->addr, sdata->vif.addr, 6);
168 	),
169 
170 	TP_printk(
171 		LOCAL_PR_FMT  VIF_PR_FMT " addr:%pM",
172 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->addr
173 	)
174 );
175 
176 TRACE_EVENT(drv_config,
177 	TP_PROTO(struct ieee80211_local *local,
178 		 u32 changed),
179 
180 	TP_ARGS(local, changed),
181 
182 	TP_STRUCT__entry(
183 		LOCAL_ENTRY
184 		__field(u32, changed)
185 		__field(u32, flags)
186 		__field(int, power_level)
187 		__field(int, dynamic_ps_timeout)
188 		__field(int, max_sleep_period)
189 		__field(u16, listen_interval)
190 		__field(u8, long_frame_max_tx_count)
191 		__field(u8, short_frame_max_tx_count)
192 		__field(int, center_freq)
193 		__field(int, channel_type)
194 		__field(int, smps)
195 	),
196 
197 	TP_fast_assign(
198 		LOCAL_ASSIGN;
199 		__entry->changed = changed;
200 		__entry->flags = local->hw.conf.flags;
201 		__entry->power_level = local->hw.conf.power_level;
202 		__entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout;
203 		__entry->max_sleep_period = local->hw.conf.max_sleep_period;
204 		__entry->listen_interval = local->hw.conf.listen_interval;
205 		__entry->long_frame_max_tx_count = local->hw.conf.long_frame_max_tx_count;
206 		__entry->short_frame_max_tx_count = local->hw.conf.short_frame_max_tx_count;
207 		__entry->center_freq = local->hw.conf.channel->center_freq;
208 		__entry->channel_type = local->hw.conf.channel_type;
209 		__entry->smps = local->hw.conf.smps_mode;
210 	),
211 
212 	TP_printk(
213 		LOCAL_PR_FMT " ch:%#x freq:%d",
214 		LOCAL_PR_ARG, __entry->changed, __entry->center_freq
215 	)
216 );
217 
218 TRACE_EVENT(drv_bss_info_changed,
219 	TP_PROTO(struct ieee80211_local *local,
220 		 struct ieee80211_sub_if_data *sdata,
221 		 struct ieee80211_bss_conf *info,
222 		 u32 changed),
223 
224 	TP_ARGS(local, sdata, info, changed),
225 
226 	TP_STRUCT__entry(
227 		LOCAL_ENTRY
228 		VIF_ENTRY
229 		__field(bool, assoc)
230 		__field(u16, aid)
231 		__field(bool, cts)
232 		__field(bool, shortpre)
233 		__field(bool, shortslot)
234 		__field(u8, dtimper)
235 		__field(u16, bcnint)
236 		__field(u16, assoc_cap)
237 		__field(u64, timestamp)
238 		__field(u32, basic_rates)
239 		__field(u32, changed)
240 		__field(bool, enable_beacon)
241 		__field(u16, ht_operation_mode)
242 	),
243 
244 	TP_fast_assign(
245 		LOCAL_ASSIGN;
246 		VIF_ASSIGN;
247 		__entry->changed = changed;
248 		__entry->aid = info->aid;
249 		__entry->assoc = info->assoc;
250 		__entry->shortpre = info->use_short_preamble;
251 		__entry->cts = info->use_cts_prot;
252 		__entry->shortslot = info->use_short_slot;
253 		__entry->dtimper = info->dtim_period;
254 		__entry->bcnint = info->beacon_int;
255 		__entry->assoc_cap = info->assoc_capability;
256 		__entry->timestamp = info->timestamp;
257 		__entry->basic_rates = info->basic_rates;
258 		__entry->enable_beacon = info->enable_beacon;
259 		__entry->ht_operation_mode = info->ht_operation_mode;
260 	),
261 
262 	TP_printk(
263 		LOCAL_PR_FMT  VIF_PR_FMT " changed:%#x",
264 		LOCAL_PR_ARG, VIF_PR_ARG, __entry->changed
265 	)
266 );
267 
268 TRACE_EVENT(drv_prepare_multicast,
269 	TP_PROTO(struct ieee80211_local *local, int mc_count),
270 
271 	TP_ARGS(local, mc_count),
272 
273 	TP_STRUCT__entry(
274 		LOCAL_ENTRY
275 		__field(int, mc_count)
276 	),
277 
278 	TP_fast_assign(
279 		LOCAL_ASSIGN;
280 		__entry->mc_count = mc_count;
281 	),
282 
283 	TP_printk(
284 		LOCAL_PR_FMT " prepare mc (%d)",
285 		LOCAL_PR_ARG, __entry->mc_count
286 	)
287 );
288 
289 TRACE_EVENT(drv_configure_filter,
290 	TP_PROTO(struct ieee80211_local *local,
291 		 unsigned int changed_flags,
292 		 unsigned int *total_flags,
293 		 u64 multicast),
294 
295 	TP_ARGS(local, changed_flags, total_flags, multicast),
296 
297 	TP_STRUCT__entry(
298 		LOCAL_ENTRY
299 		__field(unsigned int, changed)
300 		__field(unsigned int, total)
301 		__field(u64, multicast)
302 	),
303 
304 	TP_fast_assign(
305 		LOCAL_ASSIGN;
306 		__entry->changed = changed_flags;
307 		__entry->total = *total_flags;
308 		__entry->multicast = multicast;
309 	),
310 
311 	TP_printk(
312 		LOCAL_PR_FMT " changed:%#x total:%#x",
313 		LOCAL_PR_ARG, __entry->changed, __entry->total
314 	)
315 );
316 
317 TRACE_EVENT(drv_set_tim,
318 	TP_PROTO(struct ieee80211_local *local,
319 		 struct ieee80211_sta *sta, bool set),
320 
321 	TP_ARGS(local, sta, set),
322 
323 	TP_STRUCT__entry(
324 		LOCAL_ENTRY
325 		STA_ENTRY
326 		__field(bool, set)
327 	),
328 
329 	TP_fast_assign(
330 		LOCAL_ASSIGN;
331 		STA_ASSIGN;
332 		__entry->set = set;
333 	),
334 
335 	TP_printk(
336 		LOCAL_PR_FMT STA_PR_FMT " set:%d",
337 		LOCAL_PR_ARG, STA_PR_FMT, __entry->set
338 	)
339 );
340 
341 TRACE_EVENT(drv_set_key,
342 	TP_PROTO(struct ieee80211_local *local,
343 		 enum set_key_cmd cmd, struct ieee80211_sub_if_data *sdata,
344 		 struct ieee80211_sta *sta,
345 		 struct ieee80211_key_conf *key),
346 
347 	TP_ARGS(local, cmd, sdata, sta, key),
348 
349 	TP_STRUCT__entry(
350 		LOCAL_ENTRY
351 		VIF_ENTRY
352 		STA_ENTRY
353 		__field(u32, cipher)
354 		__field(u8, hw_key_idx)
355 		__field(u8, flags)
356 		__field(s8, keyidx)
357 	),
358 
359 	TP_fast_assign(
360 		LOCAL_ASSIGN;
361 		VIF_ASSIGN;
362 		STA_ASSIGN;
363 		__entry->cipher = key->cipher;
364 		__entry->flags = key->flags;
365 		__entry->keyidx = key->keyidx;
366 		__entry->hw_key_idx = key->hw_key_idx;
367 	),
368 
369 	TP_printk(
370 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT,
371 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
372 	)
373 );
374 
375 TRACE_EVENT(drv_update_tkip_key,
376 	TP_PROTO(struct ieee80211_local *local,
377 		 struct ieee80211_sub_if_data *sdata,
378 		 struct ieee80211_key_conf *conf,
379 		 struct ieee80211_sta *sta, u32 iv32),
380 
381 	TP_ARGS(local, sdata, conf, sta, iv32),
382 
383 	TP_STRUCT__entry(
384 		LOCAL_ENTRY
385 		VIF_ENTRY
386 		STA_ENTRY
387 		__field(u32, iv32)
388 	),
389 
390 	TP_fast_assign(
391 		LOCAL_ASSIGN;
392 		VIF_ASSIGN;
393 		STA_ASSIGN;
394 		__entry->iv32 = iv32;
395 	),
396 
397 	TP_printk(
398 		LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x",
399 		LOCAL_PR_ARG,VIF_PR_ARG,STA_PR_ARG, __entry->iv32
400 	)
401 );
402 
403 TRACE_EVENT(drv_hw_scan,
404 	TP_PROTO(struct ieee80211_local *local,
405 		 struct ieee80211_sub_if_data *sdata,
406 		 struct cfg80211_scan_request *req),
407 
408 	TP_ARGS(local, sdata, req),
409 
410 	TP_STRUCT__entry(
411 		LOCAL_ENTRY
412 		VIF_ENTRY
413 	),
414 
415 	TP_fast_assign(
416 		LOCAL_ASSIGN;
417 		VIF_ASSIGN;
418 	),
419 
420 	TP_printk(
421 		LOCAL_PR_FMT VIF_PR_FMT,
422 		LOCAL_PR_ARG,VIF_PR_ARG
423 	)
424 );
425 
426 DEFINE_EVENT(local_only_evt, drv_sw_scan_start,
427 	TP_PROTO(struct ieee80211_local *local),
428 	TP_ARGS(local)
429 );
430 
431 DEFINE_EVENT(local_only_evt, drv_sw_scan_complete,
432 	TP_PROTO(struct ieee80211_local *local),
433 	TP_ARGS(local)
434 );
435 
436 TRACE_EVENT(drv_get_stats,
437 	TP_PROTO(struct ieee80211_local *local,
438 		 struct ieee80211_low_level_stats *stats,
439 		 int ret),
440 
441 	TP_ARGS(local, stats, ret),
442 
443 	TP_STRUCT__entry(
444 		LOCAL_ENTRY
445 		__field(int, ret)
446 		__field(unsigned int, ackfail)
447 		__field(unsigned int, rtsfail)
448 		__field(unsigned int, fcserr)
449 		__field(unsigned int, rtssucc)
450 	),
451 
452 	TP_fast_assign(
453 		LOCAL_ASSIGN;
454 		__entry->ret = ret;
455 		__entry->ackfail = stats->dot11ACKFailureCount;
456 		__entry->rtsfail = stats->dot11RTSFailureCount;
457 		__entry->fcserr = stats->dot11FCSErrorCount;
458 		__entry->rtssucc = stats->dot11RTSSuccessCount;
459 	),
460 
461 	TP_printk(
462 		LOCAL_PR_FMT " ret:%d",
463 		LOCAL_PR_ARG, __entry->ret
464 	)
465 );
466 
467 TRACE_EVENT(drv_get_tkip_seq,
468 	TP_PROTO(struct ieee80211_local *local,
469 		 u8 hw_key_idx, u32 *iv32, u16 *iv16),
470 
471 	TP_ARGS(local, hw_key_idx, iv32, iv16),
472 
473 	TP_STRUCT__entry(
474 		LOCAL_ENTRY
475 		__field(u8, hw_key_idx)
476 		__field(u32, iv32)
477 		__field(u16, iv16)
478 	),
479 
480 	TP_fast_assign(
481 		LOCAL_ASSIGN;
482 		__entry->hw_key_idx = hw_key_idx;
483 		__entry->iv32 = *iv32;
484 		__entry->iv16 = *iv16;
485 	),
486 
487 	TP_printk(
488 		LOCAL_PR_FMT, LOCAL_PR_ARG
489 	)
490 );
491 
492 TRACE_EVENT(drv_set_frag_threshold,
493 	TP_PROTO(struct ieee80211_local *local, u32 value),
494 
495 	TP_ARGS(local, value),
496 
497 	TP_STRUCT__entry(
498 		LOCAL_ENTRY
499 		__field(u32, value)
500 	),
501 
502 	TP_fast_assign(
503 		LOCAL_ASSIGN;
504 		__entry->value = value;
505 	),
506 
507 	TP_printk(
508 		LOCAL_PR_FMT " value:%d",
509 		LOCAL_PR_ARG, __entry->value
510 	)
511 );
512 
513 TRACE_EVENT(drv_set_rts_threshold,
514 	TP_PROTO(struct ieee80211_local *local, u32 value),
515 
516 	TP_ARGS(local, value),
517 
518 	TP_STRUCT__entry(
519 		LOCAL_ENTRY
520 		__field(u32, value)
521 	),
522 
523 	TP_fast_assign(
524 		LOCAL_ASSIGN;
525 		__entry->value = value;
526 	),
527 
528 	TP_printk(
529 		LOCAL_PR_FMT " value:%d",
530 		LOCAL_PR_ARG, __entry->value
531 	)
532 );
533 
534 TRACE_EVENT(drv_set_coverage_class,
535 	TP_PROTO(struct ieee80211_local *local, u8 value),
536 
537 	TP_ARGS(local, value),
538 
539 	TP_STRUCT__entry(
540 		LOCAL_ENTRY
541 		__field(u8, value)
542 	),
543 
544 	TP_fast_assign(
545 		LOCAL_ASSIGN;
546 		__entry->value = value;
547 	),
548 
549 	TP_printk(
550 		LOCAL_PR_FMT " value:%d",
551 		LOCAL_PR_ARG, __entry->value
552 	)
553 );
554 
555 TRACE_EVENT(drv_sta_notify,
556 	TP_PROTO(struct ieee80211_local *local,
557 		 struct ieee80211_sub_if_data *sdata,
558 		 enum sta_notify_cmd cmd,
559 		 struct ieee80211_sta *sta),
560 
561 	TP_ARGS(local, sdata, cmd, sta),
562 
563 	TP_STRUCT__entry(
564 		LOCAL_ENTRY
565 		VIF_ENTRY
566 		STA_ENTRY
567 		__field(u32, cmd)
568 	),
569 
570 	TP_fast_assign(
571 		LOCAL_ASSIGN;
572 		VIF_ASSIGN;
573 		STA_ASSIGN;
574 		__entry->cmd = cmd;
575 	),
576 
577 	TP_printk(
578 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT " cmd:%d",
579 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->cmd
580 	)
581 );
582 
583 TRACE_EVENT(drv_sta_add,
584 	TP_PROTO(struct ieee80211_local *local,
585 		 struct ieee80211_sub_if_data *sdata,
586 		 struct ieee80211_sta *sta),
587 
588 	TP_ARGS(local, sdata, sta),
589 
590 	TP_STRUCT__entry(
591 		LOCAL_ENTRY
592 		VIF_ENTRY
593 		STA_ENTRY
594 	),
595 
596 	TP_fast_assign(
597 		LOCAL_ASSIGN;
598 		VIF_ASSIGN;
599 		STA_ASSIGN;
600 	),
601 
602 	TP_printk(
603 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT,
604 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
605 	)
606 );
607 
608 TRACE_EVENT(drv_sta_remove,
609 	TP_PROTO(struct ieee80211_local *local,
610 		 struct ieee80211_sub_if_data *sdata,
611 		 struct ieee80211_sta *sta),
612 
613 	TP_ARGS(local, sdata, sta),
614 
615 	TP_STRUCT__entry(
616 		LOCAL_ENTRY
617 		VIF_ENTRY
618 		STA_ENTRY
619 	),
620 
621 	TP_fast_assign(
622 		LOCAL_ASSIGN;
623 		VIF_ASSIGN;
624 		STA_ASSIGN;
625 	),
626 
627 	TP_printk(
628 		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT,
629 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG
630 	)
631 );
632 
633 TRACE_EVENT(drv_conf_tx,
634 	TP_PROTO(struct ieee80211_local *local, u16 queue,
635 		 const struct ieee80211_tx_queue_params *params),
636 
637 	TP_ARGS(local, queue, params),
638 
639 	TP_STRUCT__entry(
640 		LOCAL_ENTRY
641 		__field(u16, queue)
642 		__field(u16, txop)
643 		__field(u16, cw_min)
644 		__field(u16, cw_max)
645 		__field(u8, aifs)
646 	),
647 
648 	TP_fast_assign(
649 		LOCAL_ASSIGN;
650 		__entry->queue = queue;
651 		__entry->txop = params->txop;
652 		__entry->cw_max = params->cw_max;
653 		__entry->cw_min = params->cw_min;
654 		__entry->aifs = params->aifs;
655 	),
656 
657 	TP_printk(
658 		LOCAL_PR_FMT " queue:%d",
659 		LOCAL_PR_ARG, __entry->queue
660 	)
661 );
662 
663 DEFINE_EVENT(local_only_evt, drv_get_tsf,
664 	TP_PROTO(struct ieee80211_local *local),
665 	TP_ARGS(local)
666 );
667 
668 TRACE_EVENT(drv_set_tsf,
669 	TP_PROTO(struct ieee80211_local *local, u64 tsf),
670 
671 	TP_ARGS(local, tsf),
672 
673 	TP_STRUCT__entry(
674 		LOCAL_ENTRY
675 		__field(u64, tsf)
676 	),
677 
678 	TP_fast_assign(
679 		LOCAL_ASSIGN;
680 		__entry->tsf = tsf;
681 	),
682 
683 	TP_printk(
684 		LOCAL_PR_FMT " tsf:%llu",
685 		LOCAL_PR_ARG, (unsigned long long)__entry->tsf
686 	)
687 );
688 
689 DEFINE_EVENT(local_only_evt, drv_reset_tsf,
690 	TP_PROTO(struct ieee80211_local *local),
691 	TP_ARGS(local)
692 );
693 
694 DEFINE_EVENT(local_only_evt, drv_tx_last_beacon,
695 	TP_PROTO(struct ieee80211_local *local),
696 	TP_ARGS(local)
697 );
698 
699 TRACE_EVENT(drv_ampdu_action,
700 	TP_PROTO(struct ieee80211_local *local,
701 		 struct ieee80211_sub_if_data *sdata,
702 		 enum ieee80211_ampdu_mlme_action action,
703 		 struct ieee80211_sta *sta, u16 tid,
704 		 u16 *ssn, u8 buf_size),
705 
706 	TP_ARGS(local, sdata, action, sta, tid, ssn, buf_size),
707 
708 	TP_STRUCT__entry(
709 		LOCAL_ENTRY
710 		STA_ENTRY
711 		__field(u32, action)
712 		__field(u16, tid)
713 		__field(u16, ssn)
714 		__field(u8, buf_size)
715 		VIF_ENTRY
716 	),
717 
718 	TP_fast_assign(
719 		LOCAL_ASSIGN;
720 		VIF_ASSIGN;
721 		STA_ASSIGN;
722 		__entry->action = action;
723 		__entry->tid = tid;
724 		__entry->ssn = ssn ? *ssn : 0;
725 		__entry->buf_size = buf_size;
726 	),
727 
728 	TP_printk(
729 		LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " action:%d tid:%d buf:%d",
730 		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->action,
731 		__entry->tid, __entry->buf_size
732 	)
733 );
734 
735 TRACE_EVENT(drv_get_survey,
736 	TP_PROTO(struct ieee80211_local *local, int idx,
737 		 struct survey_info *survey),
738 
739 	TP_ARGS(local, idx, survey),
740 
741 	TP_STRUCT__entry(
742 		LOCAL_ENTRY
743 		__field(int, idx)
744 	),
745 
746 	TP_fast_assign(
747 		LOCAL_ASSIGN;
748 		__entry->idx = idx;
749 	),
750 
751 	TP_printk(
752 		LOCAL_PR_FMT " idx:%d",
753 		LOCAL_PR_ARG, __entry->idx
754 	)
755 );
756 
757 TRACE_EVENT(drv_flush,
758 	TP_PROTO(struct ieee80211_local *local, bool drop),
759 
760 	TP_ARGS(local, drop),
761 
762 	TP_STRUCT__entry(
763 		LOCAL_ENTRY
764 		__field(bool, drop)
765 	),
766 
767 	TP_fast_assign(
768 		LOCAL_ASSIGN;
769 		__entry->drop = drop;
770 	),
771 
772 	TP_printk(
773 		LOCAL_PR_FMT " drop:%d",
774 		LOCAL_PR_ARG, __entry->drop
775 	)
776 );
777 
778 TRACE_EVENT(drv_channel_switch,
779 	TP_PROTO(struct ieee80211_local *local,
780 		 struct ieee80211_channel_switch *ch_switch),
781 
782 	TP_ARGS(local, ch_switch),
783 
784 	TP_STRUCT__entry(
785 		LOCAL_ENTRY
786 		__field(u64, timestamp)
787 		__field(bool, block_tx)
788 		__field(u16, freq)
789 		__field(u8, count)
790 	),
791 
792 	TP_fast_assign(
793 		LOCAL_ASSIGN;
794 		__entry->timestamp = ch_switch->timestamp;
795 		__entry->block_tx = ch_switch->block_tx;
796 		__entry->freq = ch_switch->channel->center_freq;
797 		__entry->count = ch_switch->count;
798 	),
799 
800 	TP_printk(
801 		LOCAL_PR_FMT " new freq:%u count:%d",
802 		LOCAL_PR_ARG, __entry->freq, __entry->count
803 	)
804 );
805 
806 TRACE_EVENT(drv_set_antenna,
807 	TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret),
808 
809 	TP_ARGS(local, tx_ant, rx_ant, ret),
810 
811 	TP_STRUCT__entry(
812 		LOCAL_ENTRY
813 		__field(u32, tx_ant)
814 		__field(u32, rx_ant)
815 		__field(int, ret)
816 	),
817 
818 	TP_fast_assign(
819 		LOCAL_ASSIGN;
820 		__entry->tx_ant = tx_ant;
821 		__entry->rx_ant = rx_ant;
822 		__entry->ret = ret;
823 	),
824 
825 	TP_printk(
826 		LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d",
827 		LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret
828 	)
829 );
830 
831 TRACE_EVENT(drv_get_antenna,
832 	TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret),
833 
834 	TP_ARGS(local, tx_ant, rx_ant, ret),
835 
836 	TP_STRUCT__entry(
837 		LOCAL_ENTRY
838 		__field(u32, tx_ant)
839 		__field(u32, rx_ant)
840 		__field(int, ret)
841 	),
842 
843 	TP_fast_assign(
844 		LOCAL_ASSIGN;
845 		__entry->tx_ant = tx_ant;
846 		__entry->rx_ant = rx_ant;
847 		__entry->ret = ret;
848 	),
849 
850 	TP_printk(
851 		LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d",
852 		LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret
853 	)
854 );
855 
856 TRACE_EVENT(drv_remain_on_channel,
857 	TP_PROTO(struct ieee80211_local *local, struct ieee80211_channel *chan,
858 		 enum nl80211_channel_type chantype, unsigned int duration),
859 
860 	TP_ARGS(local, chan, chantype, duration),
861 
862 	TP_STRUCT__entry(
863 		LOCAL_ENTRY
864 		__field(int, center_freq)
865 		__field(int, channel_type)
866 		__field(unsigned int, duration)
867 	),
868 
869 	TP_fast_assign(
870 		LOCAL_ASSIGN;
871 		__entry->center_freq = chan->center_freq;
872 		__entry->channel_type = chantype;
873 		__entry->duration = duration;
874 	),
875 
876 	TP_printk(
877 		LOCAL_PR_FMT " freq:%dMHz duration:%dms",
878 		LOCAL_PR_ARG, __entry->center_freq, __entry->duration
879 	)
880 );
881 
882 DEFINE_EVENT(local_only_evt, drv_cancel_remain_on_channel,
883 	TP_PROTO(struct ieee80211_local *local),
884 	TP_ARGS(local)
885 );
886 
887 TRACE_EVENT(drv_offchannel_tx,
888 	TP_PROTO(struct ieee80211_local *local, struct sk_buff *skb,
889 		 struct ieee80211_channel *chan,
890 		 enum nl80211_channel_type channel_type,
891 		 unsigned int wait),
892 
893 	TP_ARGS(local, skb, chan, channel_type, wait),
894 
895 	TP_STRUCT__entry(
896 		LOCAL_ENTRY
897 		__field(int, center_freq)
898 		__field(int, channel_type)
899 		__field(unsigned int, wait)
900 	),
901 
902 	TP_fast_assign(
903 		LOCAL_ASSIGN;
904 		__entry->center_freq = chan->center_freq;
905 		__entry->channel_type = channel_type;
906 		__entry->wait = wait;
907 	),
908 
909 	TP_printk(
910 		LOCAL_PR_FMT " freq:%dMHz, wait:%dms",
911 		LOCAL_PR_ARG, __entry->center_freq, __entry->wait
912 	)
913 );
914 
915 TRACE_EVENT(drv_set_ringparam,
916 	TP_PROTO(struct ieee80211_local *local, u32 tx, u32 rx),
917 
918 	TP_ARGS(local, tx, rx),
919 
920 	TP_STRUCT__entry(
921 		LOCAL_ENTRY
922 		__field(u32, tx)
923 		__field(u32, rx)
924 	),
925 
926 	TP_fast_assign(
927 		LOCAL_ASSIGN;
928 		__entry->tx = tx;
929 		__entry->rx = rx;
930 	),
931 
932 	TP_printk(
933 		LOCAL_PR_FMT " tx:%d rx %d",
934 		LOCAL_PR_ARG, __entry->tx, __entry->rx
935 	)
936 );
937 
938 TRACE_EVENT(drv_get_ringparam,
939 	TP_PROTO(struct ieee80211_local *local, u32 *tx, u32 *tx_max,
940 		 u32 *rx, u32 *rx_max),
941 
942 	TP_ARGS(local, tx, tx_max, rx, rx_max),
943 
944 	TP_STRUCT__entry(
945 		LOCAL_ENTRY
946 		__field(u32, tx)
947 		__field(u32, tx_max)
948 		__field(u32, rx)
949 		__field(u32, rx_max)
950 	),
951 
952 	TP_fast_assign(
953 		LOCAL_ASSIGN;
954 		__entry->tx = *tx;
955 		__entry->tx_max = *tx_max;
956 		__entry->rx = *rx;
957 		__entry->rx_max = *rx_max;
958 	),
959 
960 	TP_printk(
961 		LOCAL_PR_FMT " tx:%d tx_max %d rx %d rx_max %d",
962 		LOCAL_PR_ARG,
963 		__entry->tx, __entry->tx_max, __entry->rx, __entry->rx_max
964 	)
965 );
966 
967 DEFINE_EVENT(local_only_evt, drv_offchannel_tx_cancel_wait,
968 	TP_PROTO(struct ieee80211_local *local),
969 	TP_ARGS(local)
970 );
971 
972 /*
973  * Tracing for API calls that drivers call.
974  */
975 
976 TRACE_EVENT(api_start_tx_ba_session,
977 	TP_PROTO(struct ieee80211_sta *sta, u16 tid),
978 
979 	TP_ARGS(sta, tid),
980 
981 	TP_STRUCT__entry(
982 		STA_ENTRY
983 		__field(u16, tid)
984 	),
985 
986 	TP_fast_assign(
987 		STA_ASSIGN;
988 		__entry->tid = tid;
989 	),
990 
991 	TP_printk(
992 		STA_PR_FMT " tid:%d",
993 		STA_PR_ARG, __entry->tid
994 	)
995 );
996 
997 TRACE_EVENT(api_start_tx_ba_cb,
998 	TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid),
999 
1000 	TP_ARGS(sdata, ra, tid),
1001 
1002 	TP_STRUCT__entry(
1003 		VIF_ENTRY
1004 		__array(u8, ra, ETH_ALEN)
1005 		__field(u16, tid)
1006 	),
1007 
1008 	TP_fast_assign(
1009 		VIF_ASSIGN;
1010 		memcpy(__entry->ra, ra, ETH_ALEN);
1011 		__entry->tid = tid;
1012 	),
1013 
1014 	TP_printk(
1015 		VIF_PR_FMT " ra:%pM tid:%d",
1016 		VIF_PR_ARG, __entry->ra, __entry->tid
1017 	)
1018 );
1019 
1020 TRACE_EVENT(api_stop_tx_ba_session,
1021 	TP_PROTO(struct ieee80211_sta *sta, u16 tid),
1022 
1023 	TP_ARGS(sta, tid),
1024 
1025 	TP_STRUCT__entry(
1026 		STA_ENTRY
1027 		__field(u16, tid)
1028 	),
1029 
1030 	TP_fast_assign(
1031 		STA_ASSIGN;
1032 		__entry->tid = tid;
1033 	),
1034 
1035 	TP_printk(
1036 		STA_PR_FMT " tid:%d",
1037 		STA_PR_ARG, __entry->tid
1038 	)
1039 );
1040 
1041 TRACE_EVENT(api_stop_tx_ba_cb,
1042 	TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid),
1043 
1044 	TP_ARGS(sdata, ra, tid),
1045 
1046 	TP_STRUCT__entry(
1047 		VIF_ENTRY
1048 		__array(u8, ra, ETH_ALEN)
1049 		__field(u16, tid)
1050 	),
1051 
1052 	TP_fast_assign(
1053 		VIF_ASSIGN;
1054 		memcpy(__entry->ra, ra, ETH_ALEN);
1055 		__entry->tid = tid;
1056 	),
1057 
1058 	TP_printk(
1059 		VIF_PR_FMT " ra:%pM tid:%d",
1060 		VIF_PR_ARG, __entry->ra, __entry->tid
1061 	)
1062 );
1063 
1064 DEFINE_EVENT(local_only_evt, api_restart_hw,
1065 	TP_PROTO(struct ieee80211_local *local),
1066 	TP_ARGS(local)
1067 );
1068 
1069 TRACE_EVENT(api_beacon_loss,
1070 	TP_PROTO(struct ieee80211_sub_if_data *sdata),
1071 
1072 	TP_ARGS(sdata),
1073 
1074 	TP_STRUCT__entry(
1075 		VIF_ENTRY
1076 	),
1077 
1078 	TP_fast_assign(
1079 		VIF_ASSIGN;
1080 	),
1081 
1082 	TP_printk(
1083 		VIF_PR_FMT,
1084 		VIF_PR_ARG
1085 	)
1086 );
1087 
1088 TRACE_EVENT(api_connection_loss,
1089 	TP_PROTO(struct ieee80211_sub_if_data *sdata),
1090 
1091 	TP_ARGS(sdata),
1092 
1093 	TP_STRUCT__entry(
1094 		VIF_ENTRY
1095 	),
1096 
1097 	TP_fast_assign(
1098 		VIF_ASSIGN;
1099 	),
1100 
1101 	TP_printk(
1102 		VIF_PR_FMT,
1103 		VIF_PR_ARG
1104 	)
1105 );
1106 
1107 TRACE_EVENT(api_cqm_rssi_notify,
1108 	TP_PROTO(struct ieee80211_sub_if_data *sdata,
1109 		 enum nl80211_cqm_rssi_threshold_event rssi_event),
1110 
1111 	TP_ARGS(sdata, rssi_event),
1112 
1113 	TP_STRUCT__entry(
1114 		VIF_ENTRY
1115 		__field(u32, rssi_event)
1116 	),
1117 
1118 	TP_fast_assign(
1119 		VIF_ASSIGN;
1120 		__entry->rssi_event = rssi_event;
1121 	),
1122 
1123 	TP_printk(
1124 		VIF_PR_FMT " event:%d",
1125 		VIF_PR_ARG, __entry->rssi_event
1126 	)
1127 );
1128 
1129 TRACE_EVENT(api_scan_completed,
1130 	TP_PROTO(struct ieee80211_local *local, bool aborted),
1131 
1132 	TP_ARGS(local, aborted),
1133 
1134 	TP_STRUCT__entry(
1135 		LOCAL_ENTRY
1136 		__field(bool, aborted)
1137 	),
1138 
1139 	TP_fast_assign(
1140 		LOCAL_ASSIGN;
1141 		__entry->aborted = aborted;
1142 	),
1143 
1144 	TP_printk(
1145 		LOCAL_PR_FMT " aborted:%d",
1146 		LOCAL_PR_ARG, __entry->aborted
1147 	)
1148 );
1149 
1150 TRACE_EVENT(api_sta_block_awake,
1151 	TP_PROTO(struct ieee80211_local *local,
1152 		 struct ieee80211_sta *sta, bool block),
1153 
1154 	TP_ARGS(local, sta, block),
1155 
1156 	TP_STRUCT__entry(
1157 		LOCAL_ENTRY
1158 		STA_ENTRY
1159 		__field(bool, block)
1160 	),
1161 
1162 	TP_fast_assign(
1163 		LOCAL_ASSIGN;
1164 		STA_ASSIGN;
1165 		__entry->block = block;
1166 	),
1167 
1168 	TP_printk(
1169 		LOCAL_PR_FMT STA_PR_FMT " block:%d",
1170 		LOCAL_PR_ARG, STA_PR_FMT, __entry->block
1171 	)
1172 );
1173 
1174 TRACE_EVENT(api_chswitch_done,
1175 	TP_PROTO(struct ieee80211_sub_if_data *sdata, bool success),
1176 
1177 	TP_ARGS(sdata, success),
1178 
1179 	TP_STRUCT__entry(
1180 		VIF_ENTRY
1181 		__field(bool, success)
1182 	),
1183 
1184 	TP_fast_assign(
1185 		VIF_ASSIGN;
1186 		__entry->success = success;
1187 	),
1188 
1189 	TP_printk(
1190 		VIF_PR_FMT " success=%d",
1191 		VIF_PR_ARG, __entry->success
1192 	)
1193 );
1194 
1195 DEFINE_EVENT(local_only_evt, api_ready_on_channel,
1196 	TP_PROTO(struct ieee80211_local *local),
1197 	TP_ARGS(local)
1198 );
1199 
1200 DEFINE_EVENT(local_only_evt, api_remain_on_channel_expired,
1201 	TP_PROTO(struct ieee80211_local *local),
1202 	TP_ARGS(local)
1203 );
1204 
1205 /*
1206  * Tracing for internal functions
1207  * (which may also be called in response to driver calls)
1208  */
1209 
1210 TRACE_EVENT(wake_queue,
1211 	TP_PROTO(struct ieee80211_local *local, u16 queue,
1212 		 enum queue_stop_reason reason),
1213 
1214 	TP_ARGS(local, queue, reason),
1215 
1216 	TP_STRUCT__entry(
1217 		LOCAL_ENTRY
1218 		__field(u16, queue)
1219 		__field(u32, reason)
1220 	),
1221 
1222 	TP_fast_assign(
1223 		LOCAL_ASSIGN;
1224 		__entry->queue = queue;
1225 		__entry->reason = reason;
1226 	),
1227 
1228 	TP_printk(
1229 		LOCAL_PR_FMT " queue:%d, reason:%d",
1230 		LOCAL_PR_ARG, __entry->queue, __entry->reason
1231 	)
1232 );
1233 
1234 TRACE_EVENT(stop_queue,
1235 	TP_PROTO(struct ieee80211_local *local, u16 queue,
1236 		 enum queue_stop_reason reason),
1237 
1238 	TP_ARGS(local, queue, reason),
1239 
1240 	TP_STRUCT__entry(
1241 		LOCAL_ENTRY
1242 		__field(u16, queue)
1243 		__field(u32, reason)
1244 	),
1245 
1246 	TP_fast_assign(
1247 		LOCAL_ASSIGN;
1248 		__entry->queue = queue;
1249 		__entry->reason = reason;
1250 	),
1251 
1252 	TP_printk(
1253 		LOCAL_PR_FMT " queue:%d, reason:%d",
1254 		LOCAL_PR_ARG, __entry->queue, __entry->reason
1255 	)
1256 );
1257 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
1258 
1259 #undef TRACE_INCLUDE_PATH
1260 #define TRACE_INCLUDE_PATH .
1261 #undef TRACE_INCLUDE_FILE
1262 #define TRACE_INCLUDE_FILE driver-trace
1263 #include <trace/define_trace.h>
1264