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