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