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_start
,
40 TP_PROTO(struct ieee80211_local
*local
, int ret
),
55 LOCAL_PR_FMT
, LOCAL_PR_ARG
60 TP_PROTO(struct ieee80211_local
*local
),
73 LOCAL_PR_FMT
, LOCAL_PR_ARG
77 TRACE_EVENT(drv_add_interface
,
78 TP_PROTO(struct ieee80211_local
*local
,
79 struct ieee80211_sub_if_data
*sdata
,
82 TP_ARGS(local
, sdata
, ret
),
87 __array(char, addr
, 6)
94 memcpy(__entry
->addr
, sdata
->vif
.addr
, 6);
99 LOCAL_PR_FMT VIF_PR_FMT
" addr:%pM ret:%d",
100 LOCAL_PR_ARG
, VIF_PR_ARG
, __entry
->addr
, __entry
->ret
104 TRACE_EVENT(drv_remove_interface
,
105 TP_PROTO(struct ieee80211_local
*local
, struct ieee80211_sub_if_data
*sdata
),
107 TP_ARGS(local
, sdata
),
112 __array(char, addr
, 6)
118 memcpy(__entry
->addr
, sdata
->vif
.addr
, 6);
122 LOCAL_PR_FMT VIF_PR_FMT
" addr:%pM",
123 LOCAL_PR_ARG
, VIF_PR_ARG
, __entry
->addr
127 TRACE_EVENT(drv_config
,
128 TP_PROTO(struct ieee80211_local
*local
,
132 TP_ARGS(local
, changed
, ret
),
136 __field(u32
, changed
)
139 __field(int, power_level
)
140 __field(int, dynamic_ps_timeout
)
141 __field(int, max_sleep_period
)
142 __field(u16
, listen_interval
)
143 __field(u8
, long_frame_max_tx_count
)
144 __field(u8
, short_frame_max_tx_count
)
145 __field(int, center_freq
)
146 __field(int, channel_type
)
152 __entry
->changed
= changed
;
154 __entry
->flags
= local
->hw
.conf
.flags
;
155 __entry
->power_level
= local
->hw
.conf
.power_level
;
156 __entry
->dynamic_ps_timeout
= local
->hw
.conf
.dynamic_ps_timeout
;
157 __entry
->max_sleep_period
= local
->hw
.conf
.max_sleep_period
;
158 __entry
->listen_interval
= local
->hw
.conf
.listen_interval
;
159 __entry
->long_frame_max_tx_count
= local
->hw
.conf
.long_frame_max_tx_count
;
160 __entry
->short_frame_max_tx_count
= local
->hw
.conf
.short_frame_max_tx_count
;
161 __entry
->center_freq
= local
->hw
.conf
.channel
->center_freq
;
162 __entry
->channel_type
= local
->hw
.conf
.channel_type
;
163 __entry
->smps
= local
->hw
.conf
.smps_mode
;
167 LOCAL_PR_FMT
" ch:%#x freq:%d ret:%d",
168 LOCAL_PR_ARG
, __entry
->changed
, __entry
->center_freq
, __entry
->ret
172 TRACE_EVENT(drv_bss_info_changed
,
173 TP_PROTO(struct ieee80211_local
*local
,
174 struct ieee80211_sub_if_data
*sdata
,
175 struct ieee80211_bss_conf
*info
,
178 TP_ARGS(local
, sdata
, info
, changed
),
186 __field(bool, shortpre
)
187 __field(bool, shortslot
)
190 __field(u16
, assoc_cap
)
191 __field(u64
, timestamp
)
192 __field(u32
, basic_rates
)
193 __field(u32
, changed
)
194 __field(bool, enable_beacon
)
195 __field(u16
, ht_operation_mode
)
201 __entry
->changed
= changed
;
202 __entry
->aid
= info
->aid
;
203 __entry
->assoc
= info
->assoc
;
204 __entry
->shortpre
= info
->use_short_preamble
;
205 __entry
->cts
= info
->use_cts_prot
;
206 __entry
->shortslot
= info
->use_short_slot
;
207 __entry
->dtimper
= info
->dtim_period
;
208 __entry
->bcnint
= info
->beacon_int
;
209 __entry
->assoc_cap
= info
->assoc_capability
;
210 __entry
->timestamp
= info
->timestamp
;
211 __entry
->basic_rates
= info
->basic_rates
;
212 __entry
->enable_beacon
= info
->enable_beacon
;
213 __entry
->ht_operation_mode
= info
->ht_operation_mode
;
217 LOCAL_PR_FMT VIF_PR_FMT
" changed:%#x",
218 LOCAL_PR_ARG
, VIF_PR_ARG
, __entry
->changed
222 TRACE_EVENT(drv_prepare_multicast
,
223 TP_PROTO(struct ieee80211_local
*local
, int mc_count
, u64 ret
),
225 TP_ARGS(local
, mc_count
, ret
),
229 __field(int, mc_count
)
235 __entry
->mc_count
= mc_count
;
240 LOCAL_PR_FMT
" prepare mc (%d): %llx",
241 LOCAL_PR_ARG
, __entry
->mc_count
,
242 (unsigned long long) __entry
->ret
246 TRACE_EVENT(drv_configure_filter
,
247 TP_PROTO(struct ieee80211_local
*local
,
248 unsigned int changed_flags
,
249 unsigned int *total_flags
,
252 TP_ARGS(local
, changed_flags
, total_flags
, multicast
),
256 __field(unsigned int, changed
)
257 __field(unsigned int, total
)
258 __field(u64
, multicast
)
263 __entry
->changed
= changed_flags
;
264 __entry
->total
= *total_flags
;
265 __entry
->multicast
= multicast
;
269 LOCAL_PR_FMT
" changed:%#x total:%#x",
270 LOCAL_PR_ARG
, __entry
->changed
, __entry
->total
274 TRACE_EVENT(drv_set_tim
,
275 TP_PROTO(struct ieee80211_local
*local
,
276 struct ieee80211_sta
*sta
, bool set
, int ret
),
278 TP_ARGS(local
, sta
, set
, ret
),
295 LOCAL_PR_FMT STA_PR_FMT
" set:%d ret:%d",
296 LOCAL_PR_ARG
, STA_PR_FMT
, __entry
->set
, __entry
->ret
300 TRACE_EVENT(drv_set_key
,
301 TP_PROTO(struct ieee80211_local
*local
,
302 enum set_key_cmd cmd
, struct ieee80211_sub_if_data
*sdata
,
303 struct ieee80211_sta
*sta
,
304 struct ieee80211_key_conf
*key
, int ret
),
306 TP_ARGS(local
, cmd
, sdata
, sta
, key
, ret
),
312 __field(enum ieee80211_key_alg
, alg
)
313 __field(u8
, hw_key_idx
)
323 __entry
->alg
= key
->alg
;
324 __entry
->flags
= key
->flags
;
325 __entry
->keyidx
= key
->keyidx
;
326 __entry
->hw_key_idx
= key
->hw_key_idx
;
331 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" ret:%d",
332 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
, __entry
->ret
336 TRACE_EVENT(drv_update_tkip_key
,
337 TP_PROTO(struct ieee80211_local
*local
,
338 struct ieee80211_sub_if_data
*sdata
,
339 struct ieee80211_key_conf
*conf
,
340 struct ieee80211_sta
*sta
, u32 iv32
),
342 TP_ARGS(local
, sdata
, conf
, sta
, iv32
),
355 __entry
->iv32
= iv32
;
359 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" iv32:%#x",
360 LOCAL_PR_ARG
,VIF_PR_ARG
,STA_PR_ARG
, __entry
->iv32
364 TRACE_EVENT(drv_hw_scan
,
365 TP_PROTO(struct ieee80211_local
*local
,
366 struct ieee80211_sub_if_data
*sdata
,
367 struct cfg80211_scan_request
*req
, int ret
),
369 TP_ARGS(local
, sdata
, req
, ret
),
384 LOCAL_PR_FMT VIF_PR_FMT
" ret:%d",
385 LOCAL_PR_ARG
,VIF_PR_ARG
, __entry
->ret
389 TRACE_EVENT(drv_sw_scan_start
,
390 TP_PROTO(struct ieee80211_local
*local
),
403 LOCAL_PR_FMT
, LOCAL_PR_ARG
407 TRACE_EVENT(drv_sw_scan_complete
,
408 TP_PROTO(struct ieee80211_local
*local
),
421 LOCAL_PR_FMT
, LOCAL_PR_ARG
425 TRACE_EVENT(drv_get_stats
,
426 TP_PROTO(struct ieee80211_local
*local
,
427 struct ieee80211_low_level_stats
*stats
,
430 TP_ARGS(local
, stats
, ret
),
435 __field(unsigned int, ackfail
)
436 __field(unsigned int, rtsfail
)
437 __field(unsigned int, fcserr
)
438 __field(unsigned int, rtssucc
)
444 __entry
->ackfail
= stats
->dot11ACKFailureCount
;
445 __entry
->rtsfail
= stats
->dot11RTSFailureCount
;
446 __entry
->fcserr
= stats
->dot11FCSErrorCount
;
447 __entry
->rtssucc
= stats
->dot11RTSSuccessCount
;
451 LOCAL_PR_FMT
" ret:%d",
452 LOCAL_PR_ARG
, __entry
->ret
456 TRACE_EVENT(drv_get_tkip_seq
,
457 TP_PROTO(struct ieee80211_local
*local
,
458 u8 hw_key_idx
, u32
*iv32
, u16
*iv16
),
460 TP_ARGS(local
, hw_key_idx
, iv32
, iv16
),
464 __field(u8
, hw_key_idx
)
471 __entry
->hw_key_idx
= hw_key_idx
;
472 __entry
->iv32
= *iv32
;
473 __entry
->iv16
= *iv16
;
477 LOCAL_PR_FMT
, LOCAL_PR_ARG
481 TRACE_EVENT(drv_set_rts_threshold
,
482 TP_PROTO(struct ieee80211_local
*local
, u32 value
, int ret
),
484 TP_ARGS(local
, value
, ret
),
495 __entry
->value
= value
;
499 LOCAL_PR_FMT
" value:%d ret:%d",
500 LOCAL_PR_ARG
, __entry
->value
, __entry
->ret
504 TRACE_EVENT(drv_set_coverage_class
,
505 TP_PROTO(struct ieee80211_local
*local
, u8 value
, int ret
),
507 TP_ARGS(local
, value
, ret
),
518 __entry
->value
= value
;
522 LOCAL_PR_FMT
" value:%d ret:%d",
523 LOCAL_PR_ARG
, __entry
->value
, __entry
->ret
527 TRACE_EVENT(drv_sta_notify
,
528 TP_PROTO(struct ieee80211_local
*local
,
529 struct ieee80211_sub_if_data
*sdata
,
530 enum sta_notify_cmd cmd
,
531 struct ieee80211_sta
*sta
),
533 TP_ARGS(local
, sdata
, cmd
, sta
),
550 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" cmd:%d",
551 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
, __entry
->cmd
555 TRACE_EVENT(drv_sta_add
,
556 TP_PROTO(struct ieee80211_local
*local
,
557 struct ieee80211_sub_if_data
*sdata
,
558 struct ieee80211_sta
*sta
, int ret
),
560 TP_ARGS(local
, sdata
, sta
, ret
),
577 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" ret:%d",
578 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
, __entry
->ret
582 TRACE_EVENT(drv_sta_remove
,
583 TP_PROTO(struct ieee80211_local
*local
,
584 struct ieee80211_sub_if_data
*sdata
,
585 struct ieee80211_sta
*sta
),
587 TP_ARGS(local
, sdata
, sta
),
602 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
,
603 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
607 TRACE_EVENT(drv_conf_tx
,
608 TP_PROTO(struct ieee80211_local
*local
, u16 queue
,
609 const struct ieee80211_tx_queue_params
*params
,
612 TP_ARGS(local
, queue
, params
, ret
),
626 __entry
->queue
= queue
;
628 __entry
->txop
= params
->txop
;
629 __entry
->cw_max
= params
->cw_max
;
630 __entry
->cw_min
= params
->cw_min
;
631 __entry
->aifs
= params
->aifs
;
635 LOCAL_PR_FMT
" queue:%d ret:%d",
636 LOCAL_PR_ARG
, __entry
->queue
, __entry
->ret
640 TRACE_EVENT(drv_get_tsf
,
641 TP_PROTO(struct ieee80211_local
*local
, u64 ret
),
656 LOCAL_PR_FMT
" ret:%llu",
657 LOCAL_PR_ARG
, (unsigned long long)__entry
->ret
661 TRACE_EVENT(drv_set_tsf
,
662 TP_PROTO(struct ieee80211_local
*local
, u64 tsf
),
677 LOCAL_PR_FMT
" tsf:%llu",
678 LOCAL_PR_ARG
, (unsigned long long)__entry
->tsf
682 TRACE_EVENT(drv_reset_tsf
,
683 TP_PROTO(struct ieee80211_local
*local
),
696 LOCAL_PR_FMT
, LOCAL_PR_ARG
700 TRACE_EVENT(drv_tx_last_beacon
,
701 TP_PROTO(struct ieee80211_local
*local
, int ret
),
716 LOCAL_PR_FMT
" ret:%d",
717 LOCAL_PR_ARG
, __entry
->ret
721 TRACE_EVENT(drv_ampdu_action
,
722 TP_PROTO(struct ieee80211_local
*local
,
723 struct ieee80211_sub_if_data
*sdata
,
724 enum ieee80211_ampdu_mlme_action action
,
725 struct ieee80211_sta
*sta
, u16 tid
,
728 TP_ARGS(local
, sdata
, action
, sta
, tid
, ssn
, ret
),
745 __entry
->action
= action
;
747 __entry
->ssn
= ssn
? *ssn
: 0;
751 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
" action:%d tid:%d ret:%d",
752 LOCAL_PR_ARG
, VIF_PR_ARG
, STA_PR_ARG
, __entry
->action
, __entry
->tid
, __entry
->ret
756 TRACE_EVENT(drv_flush
,
757 TP_PROTO(struct ieee80211_local
*local
, bool drop
),
759 TP_ARGS(local
, drop
),
768 __entry
->drop
= drop
;
772 LOCAL_PR_FMT
" drop:%d",
773 LOCAL_PR_ARG
, __entry
->drop
777 TRACE_EVENT(drv_channel_switch
,
778 TP_PROTO(struct ieee80211_local
*local
,
779 struct ieee80211_channel_switch
*ch_switch
),
781 TP_ARGS(local
, ch_switch
),
785 __field(u64
, timestamp
)
786 __field(bool, block_tx
)
793 __entry
->timestamp
= ch_switch
->timestamp
;
794 __entry
->block_tx
= ch_switch
->block_tx
;
795 __entry
->freq
= ch_switch
->channel
->center_freq
;
796 __entry
->count
= ch_switch
->count
;
800 LOCAL_PR_FMT
" new freq:%u count:%d",
801 LOCAL_PR_ARG
, __entry
->freq
, __entry
->count
806 * Tracing for API calls that drivers call.
809 TRACE_EVENT(api_start_tx_ba_session
,
810 TP_PROTO(struct ieee80211_sta
*sta
, u16 tid
),
825 STA_PR_FMT
" tid:%d",
826 STA_PR_ARG
, __entry
->tid
830 TRACE_EVENT(api_start_tx_ba_cb
,
831 TP_PROTO(struct ieee80211_sub_if_data
*sdata
, const u8
*ra
, u16 tid
),
833 TP_ARGS(sdata
, ra
, tid
),
837 __array(u8
, ra
, ETH_ALEN
)
843 memcpy(__entry
->ra
, ra
, ETH_ALEN
);
848 VIF_PR_FMT
" ra:%pM tid:%d",
849 VIF_PR_ARG
, __entry
->ra
, __entry
->tid
853 TRACE_EVENT(api_stop_tx_ba_session
,
854 TP_PROTO(struct ieee80211_sta
*sta
, u16 tid
, u16 initiator
),
856 TP_ARGS(sta
, tid
, initiator
),
861 __field(u16
, initiator
)
867 __entry
->initiator
= initiator
;
871 STA_PR_FMT
" tid:%d initiator:%d",
872 STA_PR_ARG
, __entry
->tid
, __entry
->initiator
876 TRACE_EVENT(api_stop_tx_ba_cb
,
877 TP_PROTO(struct ieee80211_sub_if_data
*sdata
, const u8
*ra
, u16 tid
),
879 TP_ARGS(sdata
, ra
, tid
),
883 __array(u8
, ra
, ETH_ALEN
)
889 memcpy(__entry
->ra
, ra
, ETH_ALEN
);
894 VIF_PR_FMT
" ra:%pM tid:%d",
895 VIF_PR_ARG
, __entry
->ra
, __entry
->tid
899 TRACE_EVENT(api_restart_hw
,
900 TP_PROTO(struct ieee80211_local
*local
),
918 TRACE_EVENT(api_beacon_loss
,
919 TP_PROTO(struct ieee80211_sub_if_data
*sdata
),
937 TRACE_EVENT(api_connection_loss
,
938 TP_PROTO(struct ieee80211_sub_if_data
*sdata
),
956 TRACE_EVENT(api_cqm_rssi_notify
,
957 TP_PROTO(struct ieee80211_sub_if_data
*sdata
,
958 enum nl80211_cqm_rssi_threshold_event rssi_event
),
960 TP_ARGS(sdata
, rssi_event
),
964 __field(u32
, rssi_event
)
969 __entry
->rssi_event
= rssi_event
;
973 VIF_PR_FMT
" event:%d",
974 VIF_PR_ARG
, __entry
->rssi_event
978 TRACE_EVENT(api_scan_completed
,
979 TP_PROTO(struct ieee80211_local
*local
, bool aborted
),
981 TP_ARGS(local
, aborted
),
985 __field(bool, aborted
)
990 __entry
->aborted
= aborted
;
994 LOCAL_PR_FMT
" aborted:%d",
995 LOCAL_PR_ARG
, __entry
->aborted
999 TRACE_EVENT(api_sta_block_awake
,
1000 TP_PROTO(struct ieee80211_local
*local
,
1001 struct ieee80211_sta
*sta
, bool block
),
1003 TP_ARGS(local
, sta
, block
),
1008 __field(bool, block
)
1014 __entry
->block
= block
;
1018 LOCAL_PR_FMT STA_PR_FMT
" block:%d",
1019 LOCAL_PR_ARG
, STA_PR_FMT
, __entry
->block
1023 TRACE_EVENT(api_chswitch_done
,
1024 TP_PROTO(struct ieee80211_sub_if_data
*sdata
, bool success
),
1026 TP_ARGS(sdata
, success
),
1030 __field(bool, success
)
1035 __entry
->success
= success
;
1039 VIF_PR_FMT
" success=%d",
1040 VIF_PR_ARG
, __entry
->success
1045 * Tracing for internal functions
1046 * (which may also be called in response to driver calls)
1049 TRACE_EVENT(wake_queue
,
1050 TP_PROTO(struct ieee80211_local
*local
, u16 queue
,
1051 enum queue_stop_reason reason
),
1053 TP_ARGS(local
, queue
, reason
),
1058 __field(u32
, reason
)
1063 __entry
->queue
= queue
;
1064 __entry
->reason
= reason
;
1068 LOCAL_PR_FMT
" queue:%d, reason:%d",
1069 LOCAL_PR_ARG
, __entry
->queue
, __entry
->reason
1073 TRACE_EVENT(stop_queue
,
1074 TP_PROTO(struct ieee80211_local
*local
, u16 queue
,
1075 enum queue_stop_reason reason
),
1077 TP_ARGS(local
, queue
, reason
),
1082 __field(u32
, reason
)
1087 __entry
->queue
= queue
;
1088 __entry
->reason
= reason
;
1092 LOCAL_PR_FMT
" queue:%d, reason:%d",
1093 LOCAL_PR_ARG
, __entry
->queue
, __entry
->reason
1096 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
1098 #undef TRACE_INCLUDE_PATH
1099 #define TRACE_INCLUDE_PATH .
1100 #undef TRACE_INCLUDE_FILE
1101 #define TRACE_INCLUDE_FILE driver-trace
1102 #include <trace/define_trace.h>