1 #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
2 #define __MAC80211_DRIVER_TRACE
4 #include <linux/tracepoint.h>
5 #include <net/mac80211.h>
6 #include "ieee80211_i.h"
8 #if !defined(CONFIG_MAC80211_DRIVER_API_TRACER) || defined(__CHECKER__)
10 #define TRACE_EVENT(name, proto, ...) \
11 static inline void trace_ ## name(proto) {}
15 #define TRACE_SYSTEM mac80211
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
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_PR_FMT " sta:%pM"
26 #define STA_PR_ARG __entry->sta_addr
28 #define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \
29 __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
30 #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \
31 __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
32 #define VIF_PR_FMT " vif:%s(%d)"
33 #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type
36 * Tracing for driver callbacks.
39 TRACE_EVENT(drv_return_void
,
40 TP_PROTO(struct ieee80211_local
*local
),
48 TP_printk(LOCAL_PR_FMT
, LOCAL_PR_ARG
)
51 TRACE_EVENT(drv_return_int
,
52 TP_PROTO(struct ieee80211_local
*local
, int ret
),
62 TP_printk(LOCAL_PR_FMT
" - %d", LOCAL_PR_ARG
, __entry
->ret
)
65 TRACE_EVENT(drv_return_u64
,
66 TP_PROTO(struct ieee80211_local
*local
, u64 ret
),
76 TP_printk(LOCAL_PR_FMT
" - %llu", LOCAL_PR_ARG
, __entry
->ret
)
79 TRACE_EVENT(drv_start
,
80 TP_PROTO(struct ieee80211_local
*local
),
93 LOCAL_PR_FMT
, LOCAL_PR_ARG
98 TP_PROTO(struct ieee80211_local
*local
),
111 LOCAL_PR_FMT
, LOCAL_PR_ARG
115 TRACE_EVENT(drv_add_interface
,
116 TP_PROTO(struct ieee80211_local
*local
,
117 struct ieee80211_sub_if_data
*sdata
),
119 TP_ARGS(local
, sdata
),
124 __array(char, addr
, 6)
130 memcpy(__entry
->addr
, sdata
->vif
.addr
, 6);
134 LOCAL_PR_FMT VIF_PR_FMT
" addr:%pM",
135 LOCAL_PR_ARG
, VIF_PR_ARG
, __entry
->addr
139 TRACE_EVENT(drv_remove_interface
,
140 TP_PROTO(struct ieee80211_local
*local
, struct ieee80211_sub_if_data
*sdata
),
142 TP_ARGS(local
, sdata
),
147 __array(char, addr
, 6)
153 memcpy(__entry
->addr
, sdata
->vif
.addr
, 6);
157 LOCAL_PR_FMT VIF_PR_FMT
" addr:%pM",
158 LOCAL_PR_ARG
, VIF_PR_ARG
, __entry
->addr
162 TRACE_EVENT(drv_config
,
163 TP_PROTO(struct ieee80211_local
*local
,
166 TP_ARGS(local
, changed
),
170 __field(u32
, changed
)
172 __field(int, power_level
)
173 __field(int, dynamic_ps_timeout
)
174 __field(int, max_sleep_period
)
175 __field(u16
, listen_interval
)
176 __field(u8
, long_frame_max_tx_count
)
177 __field(u8
, short_frame_max_tx_count
)
178 __field(int, center_freq
)
179 __field(int, channel_type
)
185 __entry
->changed
= changed
;
186 __entry
->flags
= local
->hw
.conf
.flags
;
187 __entry
->power_level
= local
->hw
.conf
.power_level
;
188 __entry
->dynamic_ps_timeout
= local
->hw
.conf
.dynamic_ps_timeout
;
189 __entry
->max_sleep_period
= local
->hw
.conf
.max_sleep_period
;
190 __entry
->listen_interval
= local
->hw
.conf
.listen_interval
;
191 __entry
->long_frame_max_tx_count
= local
->hw
.conf
.long_frame_max_tx_count
;
192 __entry
->short_frame_max_tx_count
= local
->hw
.conf
.short_frame_max_tx_count
;
193 __entry
->center_freq
= local
->hw
.conf
.channel
->center_freq
;
194 __entry
->channel_type
= local
->hw
.conf
.channel_type
;
195 __entry
->smps
= local
->hw
.conf
.smps_mode
;
199 LOCAL_PR_FMT
" ch:%#x freq:%d",
200 LOCAL_PR_ARG
, __entry
->changed
, __entry
->center_freq
204 TRACE_EVENT(drv_bss_info_changed
,
205 TP_PROTO(struct ieee80211_local
*local
,
206 struct ieee80211_sub_if_data
*sdata
,
207 struct ieee80211_bss_conf
*info
,
210 TP_ARGS(local
, sdata
, info
, changed
),
218 __field(bool, shortpre
)
219 __field(bool, shortslot
)
222 __field(u16
, assoc_cap
)
223 __field(u64
, timestamp
)
224 __field(u32
, basic_rates
)
225 __field(u32
, changed
)
226 __field(bool, enable_beacon
)
227 __field(u16
, ht_operation_mode
)
233 __entry
->changed
= changed
;
234 __entry
->aid
= info
->aid
;
235 __entry
->assoc
= info
->assoc
;
236 __entry
->shortpre
= info
->use_short_preamble
;
237 __entry
->cts
= info
->use_cts_prot
;
238 __entry
->shortslot
= info
->use_short_slot
;
239 __entry
->dtimper
= info
->dtim_period
;
240 __entry
->bcnint
= info
->beacon_int
;
241 __entry
->assoc_cap
= info
->assoc_capability
;
242 __entry
->timestamp
= info
->timestamp
;
243 __entry
->basic_rates
= info
->basic_rates
;
244 __entry
->enable_beacon
= info
->enable_beacon
;
245 __entry
->ht_operation_mode
= info
->ht_operation_mode
;
249 LOCAL_PR_FMT VIF_PR_FMT
" changed:%#x",
250 LOCAL_PR_ARG
, VIF_PR_ARG
, __entry
->changed
254 TRACE_EVENT(drv_prepare_multicast
,
255 TP_PROTO(struct ieee80211_local
*local
, int mc_count
),
257 TP_ARGS(local
, mc_count
),
261 __field(int, mc_count
)
266 __entry
->mc_count
= mc_count
;
270 LOCAL_PR_FMT
" prepare mc (%d)",
271 LOCAL_PR_ARG
, __entry
->mc_count
275 TRACE_EVENT(drv_configure_filter
,
276 TP_PROTO(struct ieee80211_local
*local
,
277 unsigned int changed_flags
,
278 unsigned int *total_flags
,
281 TP_ARGS(local
, changed_flags
, total_flags
, multicast
),
285 __field(unsigned int, changed
)
286 __field(unsigned int, total
)
287 __field(u64
, multicast
)
292 __entry
->changed
= changed_flags
;
293 __entry
->total
= *total_flags
;
294 __entry
->multicast
= multicast
;
298 LOCAL_PR_FMT
" changed:%#x total:%#x",
299 LOCAL_PR_ARG
, __entry
->changed
, __entry
->total
303 TRACE_EVENT(drv_set_tim
,
304 TP_PROTO(struct ieee80211_local
*local
,
305 struct ieee80211_sta
*sta
, bool set
),
307 TP_ARGS(local
, sta
, set
),
322 LOCAL_PR_FMT STA_PR_FMT
" set:%d",
323 LOCAL_PR_ARG
, STA_PR_FMT
, __entry
->set
327 TRACE_EVENT(drv_set_key
,
328 TP_PROTO(struct ieee80211_local
*local
,
329 enum set_key_cmd cmd
, struct ieee80211_sub_if_data
*sdata
,
330 struct ieee80211_sta
*sta
,
331 struct ieee80211_key_conf
*key
),
333 TP_ARGS(local
, cmd
, sdata
, sta
, key
),
339 __field(enum ieee80211_key_alg
, alg
)
340 __field(u8
, hw_key_idx
)
349 __entry
->alg
= key
->alg
;
350 __entry
->flags
= key
->flags
;
351 __entry
->keyidx
= key
->keyidx
;
352 __entry
->hw_key_idx
= key
->hw_key_idx
;
356 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
,
357 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
361 TRACE_EVENT(drv_update_tkip_key
,
362 TP_PROTO(struct ieee80211_local
*local
,
363 struct ieee80211_sub_if_data
*sdata
,
364 struct ieee80211_key_conf
*conf
,
365 struct ieee80211_sta
*sta
, u32 iv32
),
367 TP_ARGS(local
, sdata
, conf
, sta
, iv32
),
380 __entry
->iv32
= iv32
;
384 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" iv32:%#x",
385 LOCAL_PR_ARG
,VIF_PR_ARG
,STA_PR_ARG
, __entry
->iv32
389 TRACE_EVENT(drv_hw_scan
,
390 TP_PROTO(struct ieee80211_local
*local
,
391 struct ieee80211_sub_if_data
*sdata
,
392 struct cfg80211_scan_request
*req
),
394 TP_ARGS(local
, sdata
, req
),
407 LOCAL_PR_FMT VIF_PR_FMT
,
408 LOCAL_PR_ARG
,VIF_PR_ARG
412 TRACE_EVENT(drv_sw_scan_start
,
413 TP_PROTO(struct ieee80211_local
*local
),
426 LOCAL_PR_FMT
, LOCAL_PR_ARG
430 TRACE_EVENT(drv_sw_scan_complete
,
431 TP_PROTO(struct ieee80211_local
*local
),
444 LOCAL_PR_FMT
, LOCAL_PR_ARG
448 TRACE_EVENT(drv_get_stats
,
449 TP_PROTO(struct ieee80211_local
*local
,
450 struct ieee80211_low_level_stats
*stats
,
453 TP_ARGS(local
, stats
, ret
),
458 __field(unsigned int, ackfail
)
459 __field(unsigned int, rtsfail
)
460 __field(unsigned int, fcserr
)
461 __field(unsigned int, rtssucc
)
467 __entry
->ackfail
= stats
->dot11ACKFailureCount
;
468 __entry
->rtsfail
= stats
->dot11RTSFailureCount
;
469 __entry
->fcserr
= stats
->dot11FCSErrorCount
;
470 __entry
->rtssucc
= stats
->dot11RTSSuccessCount
;
474 LOCAL_PR_FMT
" ret:%d",
475 LOCAL_PR_ARG
, __entry
->ret
479 TRACE_EVENT(drv_get_tkip_seq
,
480 TP_PROTO(struct ieee80211_local
*local
,
481 u8 hw_key_idx
, u32
*iv32
, u16
*iv16
),
483 TP_ARGS(local
, hw_key_idx
, iv32
, iv16
),
487 __field(u8
, hw_key_idx
)
494 __entry
->hw_key_idx
= hw_key_idx
;
495 __entry
->iv32
= *iv32
;
496 __entry
->iv16
= *iv16
;
500 LOCAL_PR_FMT
, LOCAL_PR_ARG
504 TRACE_EVENT(drv_set_rts_threshold
,
505 TP_PROTO(struct ieee80211_local
*local
, u32 value
),
507 TP_ARGS(local
, value
),
516 __entry
->value
= value
;
520 LOCAL_PR_FMT
" value:%d",
521 LOCAL_PR_ARG
, __entry
->value
525 TRACE_EVENT(drv_set_coverage_class
,
526 TP_PROTO(struct ieee80211_local
*local
, u8 value
),
528 TP_ARGS(local
, value
),
537 __entry
->value
= value
;
541 LOCAL_PR_FMT
" value:%d",
542 LOCAL_PR_ARG
, __entry
->value
546 TRACE_EVENT(drv_sta_notify
,
547 TP_PROTO(struct ieee80211_local
*local
,
548 struct ieee80211_sub_if_data
*sdata
,
549 enum sta_notify_cmd cmd
,
550 struct ieee80211_sta
*sta
),
552 TP_ARGS(local
, sdata
, cmd
, sta
),
569 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" cmd:%d",
570 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
, __entry
->cmd
574 TRACE_EVENT(drv_sta_add
,
575 TP_PROTO(struct ieee80211_local
*local
,
576 struct ieee80211_sub_if_data
*sdata
,
577 struct ieee80211_sta
*sta
),
579 TP_ARGS(local
, sdata
, sta
),
594 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
,
595 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
599 TRACE_EVENT(drv_sta_remove
,
600 TP_PROTO(struct ieee80211_local
*local
,
601 struct ieee80211_sub_if_data
*sdata
,
602 struct ieee80211_sta
*sta
),
604 TP_ARGS(local
, sdata
, sta
),
619 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
,
620 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
624 TRACE_EVENT(drv_conf_tx
,
625 TP_PROTO(struct ieee80211_local
*local
, u16 queue
,
626 const struct ieee80211_tx_queue_params
*params
),
628 TP_ARGS(local
, queue
, params
),
641 __entry
->queue
= queue
;
642 __entry
->txop
= params
->txop
;
643 __entry
->cw_max
= params
->cw_max
;
644 __entry
->cw_min
= params
->cw_min
;
645 __entry
->aifs
= params
->aifs
;
649 LOCAL_PR_FMT
" queue:%d",
650 LOCAL_PR_ARG
, __entry
->queue
654 TRACE_EVENT(drv_get_tsf
,
655 TP_PROTO(struct ieee80211_local
*local
),
673 TRACE_EVENT(drv_set_tsf
,
674 TP_PROTO(struct ieee80211_local
*local
, u64 tsf
),
689 LOCAL_PR_FMT
" tsf:%llu",
690 LOCAL_PR_ARG
, (unsigned long long)__entry
->tsf
694 TRACE_EVENT(drv_reset_tsf
,
695 TP_PROTO(struct ieee80211_local
*local
),
708 LOCAL_PR_FMT
, LOCAL_PR_ARG
712 TRACE_EVENT(drv_tx_last_beacon
,
713 TP_PROTO(struct ieee80211_local
*local
),
731 TRACE_EVENT(drv_ampdu_action
,
732 TP_PROTO(struct ieee80211_local
*local
,
733 struct ieee80211_sub_if_data
*sdata
,
734 enum ieee80211_ampdu_mlme_action action
,
735 struct ieee80211_sta
*sta
, u16 tid
,
738 TP_ARGS(local
, sdata
, action
, sta
, tid
, ssn
),
753 __entry
->action
= action
;
755 __entry
->ssn
= ssn
? *ssn
: 0;
759 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" action:%d tid:%d",
760 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
, __entry
->action
, __entry
->tid
764 TRACE_EVENT(drv_get_survey
,
765 TP_PROTO(struct ieee80211_local
*local
, int idx
,
766 struct survey_info
*survey
),
768 TP_ARGS(local
, idx
, survey
),
781 LOCAL_PR_FMT
" idx:%d",
782 LOCAL_PR_ARG
, __entry
->idx
786 TRACE_EVENT(drv_flush
,
787 TP_PROTO(struct ieee80211_local
*local
, bool drop
),
789 TP_ARGS(local
, drop
),
798 __entry
->drop
= drop
;
802 LOCAL_PR_FMT
" drop:%d",
803 LOCAL_PR_ARG
, __entry
->drop
807 TRACE_EVENT(drv_channel_switch
,
808 TP_PROTO(struct ieee80211_local
*local
,
809 struct ieee80211_channel_switch
*ch_switch
),
811 TP_ARGS(local
, ch_switch
),
815 __field(u64
, timestamp
)
816 __field(bool, block_tx
)
823 __entry
->timestamp
= ch_switch
->timestamp
;
824 __entry
->block_tx
= ch_switch
->block_tx
;
825 __entry
->freq
= ch_switch
->channel
->center_freq
;
826 __entry
->count
= ch_switch
->count
;
830 LOCAL_PR_FMT
" new freq:%u count:%d",
831 LOCAL_PR_ARG
, __entry
->freq
, __entry
->count
836 * Tracing for API calls that drivers call.
839 TRACE_EVENT(api_start_tx_ba_session
,
840 TP_PROTO(struct ieee80211_sta
*sta
, u16 tid
),
855 STA_PR_FMT
" tid:%d",
856 STA_PR_ARG
, __entry
->tid
860 TRACE_EVENT(api_start_tx_ba_cb
,
861 TP_PROTO(struct ieee80211_sub_if_data
*sdata
, const u8
*ra
, u16 tid
),
863 TP_ARGS(sdata
, ra
, tid
),
867 __array(u8
, ra
, ETH_ALEN
)
873 memcpy(__entry
->ra
, ra
, ETH_ALEN
);
878 VIF_PR_FMT
" ra:%pM tid:%d",
879 VIF_PR_ARG
, __entry
->ra
, __entry
->tid
883 TRACE_EVENT(api_stop_tx_ba_session
,
884 TP_PROTO(struct ieee80211_sta
*sta
, u16 tid
),
899 STA_PR_FMT
" tid:%d",
900 STA_PR_ARG
, __entry
->tid
904 TRACE_EVENT(api_stop_tx_ba_cb
,
905 TP_PROTO(struct ieee80211_sub_if_data
*sdata
, const u8
*ra
, u16 tid
),
907 TP_ARGS(sdata
, ra
, tid
),
911 __array(u8
, ra
, ETH_ALEN
)
917 memcpy(__entry
->ra
, ra
, ETH_ALEN
);
922 VIF_PR_FMT
" ra:%pM tid:%d",
923 VIF_PR_ARG
, __entry
->ra
, __entry
->tid
927 TRACE_EVENT(api_restart_hw
,
928 TP_PROTO(struct ieee80211_local
*local
),
946 TRACE_EVENT(api_beacon_loss
,
947 TP_PROTO(struct ieee80211_sub_if_data
*sdata
),
965 TRACE_EVENT(api_connection_loss
,
966 TP_PROTO(struct ieee80211_sub_if_data
*sdata
),
984 TRACE_EVENT(api_cqm_rssi_notify
,
985 TP_PROTO(struct ieee80211_sub_if_data
*sdata
,
986 enum nl80211_cqm_rssi_threshold_event rssi_event
),
988 TP_ARGS(sdata
, rssi_event
),
992 __field(u32
, rssi_event
)
997 __entry
->rssi_event
= rssi_event
;
1001 VIF_PR_FMT
" event:%d",
1002 VIF_PR_ARG
, __entry
->rssi_event
1006 TRACE_EVENT(api_scan_completed
,
1007 TP_PROTO(struct ieee80211_local
*local
, bool aborted
),
1009 TP_ARGS(local
, aborted
),
1013 __field(bool, aborted
)
1018 __entry
->aborted
= aborted
;
1022 LOCAL_PR_FMT
" aborted:%d",
1023 LOCAL_PR_ARG
, __entry
->aborted
1027 TRACE_EVENT(api_sta_block_awake
,
1028 TP_PROTO(struct ieee80211_local
*local
,
1029 struct ieee80211_sta
*sta
, bool block
),
1031 TP_ARGS(local
, sta
, block
),
1036 __field(bool, block
)
1042 __entry
->block
= block
;
1046 LOCAL_PR_FMT STA_PR_FMT
" block:%d",
1047 LOCAL_PR_ARG
, STA_PR_FMT
, __entry
->block
1051 TRACE_EVENT(api_chswitch_done
,
1052 TP_PROTO(struct ieee80211_sub_if_data
*sdata
, bool success
),
1054 TP_ARGS(sdata
, success
),
1058 __field(bool, success
)
1063 __entry
->success
= success
;
1067 VIF_PR_FMT
" success=%d",
1068 VIF_PR_ARG
, __entry
->success
1073 * Tracing for internal functions
1074 * (which may also be called in response to driver calls)
1077 TRACE_EVENT(wake_queue
,
1078 TP_PROTO(struct ieee80211_local
*local
, u16 queue
,
1079 enum queue_stop_reason reason
),
1081 TP_ARGS(local
, queue
, reason
),
1086 __field(u32
, reason
)
1091 __entry
->queue
= queue
;
1092 __entry
->reason
= reason
;
1096 LOCAL_PR_FMT
" queue:%d, reason:%d",
1097 LOCAL_PR_ARG
, __entry
->queue
, __entry
->reason
1101 TRACE_EVENT(stop_queue
,
1102 TP_PROTO(struct ieee80211_local
*local
, u16 queue
,
1103 enum queue_stop_reason reason
),
1105 TP_ARGS(local
, queue
, reason
),
1110 __field(u32
, reason
)
1115 __entry
->queue
= queue
;
1116 __entry
->reason
= reason
;
1120 LOCAL_PR_FMT
" queue:%d, reason:%d",
1121 LOCAL_PR_ARG
, __entry
->queue
, __entry
->reason
1124 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
1126 #undef TRACE_INCLUDE_PATH
1127 #define TRACE_INCLUDE_PATH .
1128 #undef TRACE_INCLUDE_FILE
1129 #define TRACE_INCLUDE_FILE driver-trace
1130 #include <trace/define_trace.h>