1 #ifndef __MAC80211_DRIVER_OPS
2 #define __MAC80211_DRIVER_OPS
4 #include <net/mac80211.h>
5 #include "ieee80211_i.h"
8 static inline void check_sdata_in_driver(struct ieee80211_sub_if_data
*sdata
)
10 WARN(!(sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
),
11 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
12 sdata
->dev
? sdata
->dev
->name
: sdata
->name
, sdata
->flags
);
15 static inline struct ieee80211_sub_if_data
*
16 get_bss_sdata(struct ieee80211_sub_if_data
*sdata
)
18 if (sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
)
19 sdata
= container_of(sdata
->bss
, struct ieee80211_sub_if_data
,
25 static inline void drv_tx(struct ieee80211_local
*local
,
26 struct ieee80211_tx_control
*control
,
29 local
->ops
->tx(&local
->hw
, control
, skb
);
32 static inline void drv_get_et_strings(struct ieee80211_sub_if_data
*sdata
,
35 struct ieee80211_local
*local
= sdata
->local
;
36 if (local
->ops
->get_et_strings
) {
37 trace_drv_get_et_strings(local
, sset
);
38 local
->ops
->get_et_strings(&local
->hw
, &sdata
->vif
, sset
, data
);
39 trace_drv_return_void(local
);
43 static inline void drv_get_et_stats(struct ieee80211_sub_if_data
*sdata
,
44 struct ethtool_stats
*stats
,
47 struct ieee80211_local
*local
= sdata
->local
;
48 if (local
->ops
->get_et_stats
) {
49 trace_drv_get_et_stats(local
);
50 local
->ops
->get_et_stats(&local
->hw
, &sdata
->vif
, stats
, data
);
51 trace_drv_return_void(local
);
55 static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data
*sdata
,
58 struct ieee80211_local
*local
= sdata
->local
;
60 if (local
->ops
->get_et_sset_count
) {
61 trace_drv_get_et_sset_count(local
, sset
);
62 rv
= local
->ops
->get_et_sset_count(&local
->hw
, &sdata
->vif
,
64 trace_drv_return_int(local
, rv
);
69 static inline int drv_start(struct ieee80211_local
*local
)
75 trace_drv_start(local
);
76 local
->started
= true;
78 ret
= local
->ops
->start(&local
->hw
);
79 trace_drv_return_int(local
, ret
);
83 static inline void drv_stop(struct ieee80211_local
*local
)
87 trace_drv_stop(local
);
88 local
->ops
->stop(&local
->hw
);
89 trace_drv_return_void(local
);
91 /* sync away all work on the tasklet before clearing started */
92 tasklet_disable(&local
->tasklet
);
93 tasklet_enable(&local
->tasklet
);
97 local
->started
= false;
101 static inline int drv_suspend(struct ieee80211_local
*local
,
102 struct cfg80211_wowlan
*wowlan
)
108 trace_drv_suspend(local
);
109 ret
= local
->ops
->suspend(&local
->hw
, wowlan
);
110 trace_drv_return_int(local
, ret
);
114 static inline int drv_resume(struct ieee80211_local
*local
)
120 trace_drv_resume(local
);
121 ret
= local
->ops
->resume(&local
->hw
);
122 trace_drv_return_int(local
, ret
);
126 static inline void drv_set_wakeup(struct ieee80211_local
*local
,
131 if (!local
->ops
->set_wakeup
)
134 trace_drv_set_wakeup(local
, enabled
);
135 local
->ops
->set_wakeup(&local
->hw
, enabled
);
136 trace_drv_return_void(local
);
140 static inline int drv_add_interface(struct ieee80211_local
*local
,
141 struct ieee80211_sub_if_data
*sdata
)
147 if (WARN_ON(sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
||
148 (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
149 !(local
->hw
.flags
& IEEE80211_HW_WANT_MONITOR_VIF
))))
152 trace_drv_add_interface(local
, sdata
);
153 ret
= local
->ops
->add_interface(&local
->hw
, &sdata
->vif
);
154 trace_drv_return_int(local
, ret
);
157 sdata
->flags
|= IEEE80211_SDATA_IN_DRIVER
;
162 static inline int drv_change_interface(struct ieee80211_local
*local
,
163 struct ieee80211_sub_if_data
*sdata
,
164 enum nl80211_iftype type
, bool p2p
)
170 check_sdata_in_driver(sdata
);
172 trace_drv_change_interface(local
, sdata
, type
, p2p
);
173 ret
= local
->ops
->change_interface(&local
->hw
, &sdata
->vif
, type
, p2p
);
174 trace_drv_return_int(local
, ret
);
178 static inline void drv_remove_interface(struct ieee80211_local
*local
,
179 struct ieee80211_sub_if_data
*sdata
)
183 check_sdata_in_driver(sdata
);
185 trace_drv_remove_interface(local
, sdata
);
186 local
->ops
->remove_interface(&local
->hw
, &sdata
->vif
);
187 sdata
->flags
&= ~IEEE80211_SDATA_IN_DRIVER
;
188 trace_drv_return_void(local
);
191 static inline int drv_config(struct ieee80211_local
*local
, u32 changed
)
197 trace_drv_config(local
, changed
);
198 ret
= local
->ops
->config(&local
->hw
, changed
);
199 trace_drv_return_int(local
, ret
);
203 static inline void drv_bss_info_changed(struct ieee80211_local
*local
,
204 struct ieee80211_sub_if_data
*sdata
,
205 struct ieee80211_bss_conf
*info
,
210 WARN_ON_ONCE(changed
& (BSS_CHANGED_BEACON
|
211 BSS_CHANGED_BEACON_ENABLED
) &&
212 sdata
->vif
.type
!= NL80211_IFTYPE_AP
&&
213 sdata
->vif
.type
!= NL80211_IFTYPE_ADHOC
&&
214 sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
);
215 WARN_ON_ONCE(sdata
->vif
.type
== NL80211_IFTYPE_P2P_DEVICE
&&
216 changed
& ~BSS_CHANGED_IDLE
);
218 check_sdata_in_driver(sdata
);
220 trace_drv_bss_info_changed(local
, sdata
, info
, changed
);
221 if (local
->ops
->bss_info_changed
)
222 local
->ops
->bss_info_changed(&local
->hw
, &sdata
->vif
, info
, changed
);
223 trace_drv_return_void(local
);
226 static inline u64
drv_prepare_multicast(struct ieee80211_local
*local
,
227 struct netdev_hw_addr_list
*mc_list
)
231 trace_drv_prepare_multicast(local
, mc_list
->count
);
233 if (local
->ops
->prepare_multicast
)
234 ret
= local
->ops
->prepare_multicast(&local
->hw
, mc_list
);
236 trace_drv_return_u64(local
, ret
);
241 static inline void drv_configure_filter(struct ieee80211_local
*local
,
242 unsigned int changed_flags
,
243 unsigned int *total_flags
,
248 trace_drv_configure_filter(local
, changed_flags
, total_flags
,
250 local
->ops
->configure_filter(&local
->hw
, changed_flags
, total_flags
,
252 trace_drv_return_void(local
);
255 static inline int drv_set_tim(struct ieee80211_local
*local
,
256 struct ieee80211_sta
*sta
, bool set
)
259 trace_drv_set_tim(local
, sta
, set
);
260 if (local
->ops
->set_tim
)
261 ret
= local
->ops
->set_tim(&local
->hw
, sta
, set
);
262 trace_drv_return_int(local
, ret
);
266 static inline int drv_set_key(struct ieee80211_local
*local
,
267 enum set_key_cmd cmd
,
268 struct ieee80211_sub_if_data
*sdata
,
269 struct ieee80211_sta
*sta
,
270 struct ieee80211_key_conf
*key
)
276 sdata
= get_bss_sdata(sdata
);
277 check_sdata_in_driver(sdata
);
279 trace_drv_set_key(local
, cmd
, sdata
, sta
, key
);
280 ret
= local
->ops
->set_key(&local
->hw
, cmd
, &sdata
->vif
, sta
, key
);
281 trace_drv_return_int(local
, ret
);
285 static inline void drv_update_tkip_key(struct ieee80211_local
*local
,
286 struct ieee80211_sub_if_data
*sdata
,
287 struct ieee80211_key_conf
*conf
,
288 struct sta_info
*sta
, u32 iv32
,
291 struct ieee80211_sta
*ista
= NULL
;
296 sdata
= get_bss_sdata(sdata
);
297 check_sdata_in_driver(sdata
);
299 trace_drv_update_tkip_key(local
, sdata
, conf
, ista
, iv32
);
300 if (local
->ops
->update_tkip_key
)
301 local
->ops
->update_tkip_key(&local
->hw
, &sdata
->vif
, conf
,
302 ista
, iv32
, phase1key
);
303 trace_drv_return_void(local
);
306 static inline int drv_hw_scan(struct ieee80211_local
*local
,
307 struct ieee80211_sub_if_data
*sdata
,
308 struct cfg80211_scan_request
*req
)
314 check_sdata_in_driver(sdata
);
316 trace_drv_hw_scan(local
, sdata
);
317 ret
= local
->ops
->hw_scan(&local
->hw
, &sdata
->vif
, req
);
318 trace_drv_return_int(local
, ret
);
322 static inline void drv_cancel_hw_scan(struct ieee80211_local
*local
,
323 struct ieee80211_sub_if_data
*sdata
)
327 check_sdata_in_driver(sdata
);
329 trace_drv_cancel_hw_scan(local
, sdata
);
330 local
->ops
->cancel_hw_scan(&local
->hw
, &sdata
->vif
);
331 trace_drv_return_void(local
);
335 drv_sched_scan_start(struct ieee80211_local
*local
,
336 struct ieee80211_sub_if_data
*sdata
,
337 struct cfg80211_sched_scan_request
*req
,
338 struct ieee80211_sched_scan_ies
*ies
)
344 check_sdata_in_driver(sdata
);
346 trace_drv_sched_scan_start(local
, sdata
);
347 ret
= local
->ops
->sched_scan_start(&local
->hw
, &sdata
->vif
,
349 trace_drv_return_int(local
, ret
);
353 static inline void drv_sched_scan_stop(struct ieee80211_local
*local
,
354 struct ieee80211_sub_if_data
*sdata
)
358 check_sdata_in_driver(sdata
);
360 trace_drv_sched_scan_stop(local
, sdata
);
361 local
->ops
->sched_scan_stop(&local
->hw
, &sdata
->vif
);
362 trace_drv_return_void(local
);
365 static inline void drv_sw_scan_start(struct ieee80211_local
*local
)
369 trace_drv_sw_scan_start(local
);
370 if (local
->ops
->sw_scan_start
)
371 local
->ops
->sw_scan_start(&local
->hw
);
372 trace_drv_return_void(local
);
375 static inline void drv_sw_scan_complete(struct ieee80211_local
*local
)
379 trace_drv_sw_scan_complete(local
);
380 if (local
->ops
->sw_scan_complete
)
381 local
->ops
->sw_scan_complete(&local
->hw
);
382 trace_drv_return_void(local
);
385 static inline int drv_get_stats(struct ieee80211_local
*local
,
386 struct ieee80211_low_level_stats
*stats
)
388 int ret
= -EOPNOTSUPP
;
392 if (local
->ops
->get_stats
)
393 ret
= local
->ops
->get_stats(&local
->hw
, stats
);
394 trace_drv_get_stats(local
, stats
, ret
);
399 static inline void drv_get_tkip_seq(struct ieee80211_local
*local
,
400 u8 hw_key_idx
, u32
*iv32
, u16
*iv16
)
402 if (local
->ops
->get_tkip_seq
)
403 local
->ops
->get_tkip_seq(&local
->hw
, hw_key_idx
, iv32
, iv16
);
404 trace_drv_get_tkip_seq(local
, hw_key_idx
, iv32
, iv16
);
407 static inline int drv_set_frag_threshold(struct ieee80211_local
*local
,
414 trace_drv_set_frag_threshold(local
, value
);
415 if (local
->ops
->set_frag_threshold
)
416 ret
= local
->ops
->set_frag_threshold(&local
->hw
, value
);
417 trace_drv_return_int(local
, ret
);
421 static inline int drv_set_rts_threshold(struct ieee80211_local
*local
,
428 trace_drv_set_rts_threshold(local
, value
);
429 if (local
->ops
->set_rts_threshold
)
430 ret
= local
->ops
->set_rts_threshold(&local
->hw
, value
);
431 trace_drv_return_int(local
, ret
);
435 static inline int drv_set_coverage_class(struct ieee80211_local
*local
,
441 trace_drv_set_coverage_class(local
, value
);
442 if (local
->ops
->set_coverage_class
)
443 local
->ops
->set_coverage_class(&local
->hw
, value
);
447 trace_drv_return_int(local
, ret
);
451 static inline void drv_sta_notify(struct ieee80211_local
*local
,
452 struct ieee80211_sub_if_data
*sdata
,
453 enum sta_notify_cmd cmd
,
454 struct ieee80211_sta
*sta
)
456 sdata
= get_bss_sdata(sdata
);
457 check_sdata_in_driver(sdata
);
459 trace_drv_sta_notify(local
, sdata
, cmd
, sta
);
460 if (local
->ops
->sta_notify
)
461 local
->ops
->sta_notify(&local
->hw
, &sdata
->vif
, cmd
, sta
);
462 trace_drv_return_void(local
);
465 static inline int drv_sta_add(struct ieee80211_local
*local
,
466 struct ieee80211_sub_if_data
*sdata
,
467 struct ieee80211_sta
*sta
)
473 sdata
= get_bss_sdata(sdata
);
474 check_sdata_in_driver(sdata
);
476 trace_drv_sta_add(local
, sdata
, sta
);
477 if (local
->ops
->sta_add
)
478 ret
= local
->ops
->sta_add(&local
->hw
, &sdata
->vif
, sta
);
480 trace_drv_return_int(local
, ret
);
485 static inline void drv_sta_remove(struct ieee80211_local
*local
,
486 struct ieee80211_sub_if_data
*sdata
,
487 struct ieee80211_sta
*sta
)
491 sdata
= get_bss_sdata(sdata
);
492 check_sdata_in_driver(sdata
);
494 trace_drv_sta_remove(local
, sdata
, sta
);
495 if (local
->ops
->sta_remove
)
496 local
->ops
->sta_remove(&local
->hw
, &sdata
->vif
, sta
);
498 trace_drv_return_void(local
);
501 #ifdef CONFIG_MAC80211_DEBUGFS
502 static inline void drv_sta_add_debugfs(struct ieee80211_local
*local
,
503 struct ieee80211_sub_if_data
*sdata
,
504 struct ieee80211_sta
*sta
,
509 sdata
= get_bss_sdata(sdata
);
510 check_sdata_in_driver(sdata
);
512 if (local
->ops
->sta_add_debugfs
)
513 local
->ops
->sta_add_debugfs(&local
->hw
, &sdata
->vif
,
517 static inline void drv_sta_remove_debugfs(struct ieee80211_local
*local
,
518 struct ieee80211_sub_if_data
*sdata
,
519 struct ieee80211_sta
*sta
,
524 sdata
= get_bss_sdata(sdata
);
525 check_sdata_in_driver(sdata
);
527 if (local
->ops
->sta_remove_debugfs
)
528 local
->ops
->sta_remove_debugfs(&local
->hw
, &sdata
->vif
,
533 static inline __must_check
534 int drv_sta_state(struct ieee80211_local
*local
,
535 struct ieee80211_sub_if_data
*sdata
,
536 struct sta_info
*sta
,
537 enum ieee80211_sta_state old_state
,
538 enum ieee80211_sta_state new_state
)
544 sdata
= get_bss_sdata(sdata
);
545 check_sdata_in_driver(sdata
);
547 trace_drv_sta_state(local
, sdata
, &sta
->sta
, old_state
, new_state
);
548 if (local
->ops
->sta_state
) {
549 ret
= local
->ops
->sta_state(&local
->hw
, &sdata
->vif
, &sta
->sta
,
550 old_state
, new_state
);
551 } else if (old_state
== IEEE80211_STA_AUTH
&&
552 new_state
== IEEE80211_STA_ASSOC
) {
553 ret
= drv_sta_add(local
, sdata
, &sta
->sta
);
555 sta
->uploaded
= true;
556 } else if (old_state
== IEEE80211_STA_ASSOC
&&
557 new_state
== IEEE80211_STA_AUTH
) {
558 drv_sta_remove(local
, sdata
, &sta
->sta
);
560 trace_drv_return_int(local
, ret
);
564 static inline void drv_sta_rc_update(struct ieee80211_local
*local
,
565 struct ieee80211_sub_if_data
*sdata
,
566 struct ieee80211_sta
*sta
, u32 changed
)
568 sdata
= get_bss_sdata(sdata
);
569 check_sdata_in_driver(sdata
);
571 WARN_ON(changed
& IEEE80211_RC_SUPP_RATES_CHANGED
&&
572 sdata
->vif
.type
!= NL80211_IFTYPE_ADHOC
);
574 trace_drv_sta_rc_update(local
, sdata
, sta
, changed
);
575 if (local
->ops
->sta_rc_update
)
576 local
->ops
->sta_rc_update(&local
->hw
, &sdata
->vif
,
579 trace_drv_return_void(local
);
582 static inline int drv_conf_tx(struct ieee80211_local
*local
,
583 struct ieee80211_sub_if_data
*sdata
, u16 ac
,
584 const struct ieee80211_tx_queue_params
*params
)
586 int ret
= -EOPNOTSUPP
;
590 check_sdata_in_driver(sdata
);
592 trace_drv_conf_tx(local
, sdata
, ac
, params
);
593 if (local
->ops
->conf_tx
)
594 ret
= local
->ops
->conf_tx(&local
->hw
, &sdata
->vif
,
596 trace_drv_return_int(local
, ret
);
600 static inline u64
drv_get_tsf(struct ieee80211_local
*local
,
601 struct ieee80211_sub_if_data
*sdata
)
607 check_sdata_in_driver(sdata
);
609 trace_drv_get_tsf(local
, sdata
);
610 if (local
->ops
->get_tsf
)
611 ret
= local
->ops
->get_tsf(&local
->hw
, &sdata
->vif
);
612 trace_drv_return_u64(local
, ret
);
616 static inline void drv_set_tsf(struct ieee80211_local
*local
,
617 struct ieee80211_sub_if_data
*sdata
,
622 check_sdata_in_driver(sdata
);
624 trace_drv_set_tsf(local
, sdata
, tsf
);
625 if (local
->ops
->set_tsf
)
626 local
->ops
->set_tsf(&local
->hw
, &sdata
->vif
, tsf
);
627 trace_drv_return_void(local
);
630 static inline void drv_reset_tsf(struct ieee80211_local
*local
,
631 struct ieee80211_sub_if_data
*sdata
)
635 check_sdata_in_driver(sdata
);
637 trace_drv_reset_tsf(local
, sdata
);
638 if (local
->ops
->reset_tsf
)
639 local
->ops
->reset_tsf(&local
->hw
, &sdata
->vif
);
640 trace_drv_return_void(local
);
643 static inline int drv_tx_last_beacon(struct ieee80211_local
*local
)
645 int ret
= 0; /* default unsupported op for less congestion */
649 trace_drv_tx_last_beacon(local
);
650 if (local
->ops
->tx_last_beacon
)
651 ret
= local
->ops
->tx_last_beacon(&local
->hw
);
652 trace_drv_return_int(local
, ret
);
656 static inline int drv_ampdu_action(struct ieee80211_local
*local
,
657 struct ieee80211_sub_if_data
*sdata
,
658 enum ieee80211_ampdu_mlme_action action
,
659 struct ieee80211_sta
*sta
, u16 tid
,
660 u16
*ssn
, u8 buf_size
)
662 int ret
= -EOPNOTSUPP
;
666 sdata
= get_bss_sdata(sdata
);
667 check_sdata_in_driver(sdata
);
669 trace_drv_ampdu_action(local
, sdata
, action
, sta
, tid
, ssn
, buf_size
);
671 if (local
->ops
->ampdu_action
)
672 ret
= local
->ops
->ampdu_action(&local
->hw
, &sdata
->vif
, action
,
673 sta
, tid
, ssn
, buf_size
);
675 trace_drv_return_int(local
, ret
);
680 static inline int drv_get_survey(struct ieee80211_local
*local
, int idx
,
681 struct survey_info
*survey
)
683 int ret
= -EOPNOTSUPP
;
685 trace_drv_get_survey(local
, idx
, survey
);
687 if (local
->ops
->get_survey
)
688 ret
= local
->ops
->get_survey(&local
->hw
, idx
, survey
);
690 trace_drv_return_int(local
, ret
);
695 static inline void drv_rfkill_poll(struct ieee80211_local
*local
)
699 if (local
->ops
->rfkill_poll
)
700 local
->ops
->rfkill_poll(&local
->hw
);
703 static inline void drv_flush(struct ieee80211_local
*local
, bool drop
)
707 trace_drv_flush(local
, drop
);
708 if (local
->ops
->flush
)
709 local
->ops
->flush(&local
->hw
, drop
);
710 trace_drv_return_void(local
);
713 static inline void drv_channel_switch(struct ieee80211_local
*local
,
714 struct ieee80211_channel_switch
*ch_switch
)
718 trace_drv_channel_switch(local
, ch_switch
);
719 local
->ops
->channel_switch(&local
->hw
, ch_switch
);
720 trace_drv_return_void(local
);
724 static inline int drv_set_antenna(struct ieee80211_local
*local
,
725 u32 tx_ant
, u32 rx_ant
)
727 int ret
= -EOPNOTSUPP
;
729 if (local
->ops
->set_antenna
)
730 ret
= local
->ops
->set_antenna(&local
->hw
, tx_ant
, rx_ant
);
731 trace_drv_set_antenna(local
, tx_ant
, rx_ant
, ret
);
735 static inline int drv_get_antenna(struct ieee80211_local
*local
,
736 u32
*tx_ant
, u32
*rx_ant
)
738 int ret
= -EOPNOTSUPP
;
740 if (local
->ops
->get_antenna
)
741 ret
= local
->ops
->get_antenna(&local
->hw
, tx_ant
, rx_ant
);
742 trace_drv_get_antenna(local
, *tx_ant
, *rx_ant
, ret
);
746 static inline int drv_remain_on_channel(struct ieee80211_local
*local
,
747 struct ieee80211_sub_if_data
*sdata
,
748 struct ieee80211_channel
*chan
,
749 unsigned int duration
)
755 trace_drv_remain_on_channel(local
, sdata
, chan
, duration
);
756 ret
= local
->ops
->remain_on_channel(&local
->hw
, &sdata
->vif
,
758 trace_drv_return_int(local
, ret
);
763 static inline int drv_cancel_remain_on_channel(struct ieee80211_local
*local
)
769 trace_drv_cancel_remain_on_channel(local
);
770 ret
= local
->ops
->cancel_remain_on_channel(&local
->hw
);
771 trace_drv_return_int(local
, ret
);
776 static inline int drv_set_ringparam(struct ieee80211_local
*local
,
783 trace_drv_set_ringparam(local
, tx
, rx
);
784 if (local
->ops
->set_ringparam
)
785 ret
= local
->ops
->set_ringparam(&local
->hw
, tx
, rx
);
786 trace_drv_return_int(local
, ret
);
791 static inline void drv_get_ringparam(struct ieee80211_local
*local
,
792 u32
*tx
, u32
*tx_max
, u32
*rx
, u32
*rx_max
)
796 trace_drv_get_ringparam(local
, tx
, tx_max
, rx
, rx_max
);
797 if (local
->ops
->get_ringparam
)
798 local
->ops
->get_ringparam(&local
->hw
, tx
, tx_max
, rx
, rx_max
);
799 trace_drv_return_void(local
);
802 static inline bool drv_tx_frames_pending(struct ieee80211_local
*local
)
808 trace_drv_tx_frames_pending(local
);
809 if (local
->ops
->tx_frames_pending
)
810 ret
= local
->ops
->tx_frames_pending(&local
->hw
);
811 trace_drv_return_bool(local
, ret
);
816 static inline int drv_set_bitrate_mask(struct ieee80211_local
*local
,
817 struct ieee80211_sub_if_data
*sdata
,
818 const struct cfg80211_bitrate_mask
*mask
)
820 int ret
= -EOPNOTSUPP
;
824 check_sdata_in_driver(sdata
);
826 trace_drv_set_bitrate_mask(local
, sdata
, mask
);
827 if (local
->ops
->set_bitrate_mask
)
828 ret
= local
->ops
->set_bitrate_mask(&local
->hw
,
830 trace_drv_return_int(local
, ret
);
835 static inline void drv_set_rekey_data(struct ieee80211_local
*local
,
836 struct ieee80211_sub_if_data
*sdata
,
837 struct cfg80211_gtk_rekey_data
*data
)
839 check_sdata_in_driver(sdata
);
841 trace_drv_set_rekey_data(local
, sdata
, data
);
842 if (local
->ops
->set_rekey_data
)
843 local
->ops
->set_rekey_data(&local
->hw
, &sdata
->vif
, data
);
844 trace_drv_return_void(local
);
847 static inline void drv_rssi_callback(struct ieee80211_local
*local
,
848 struct ieee80211_sub_if_data
*sdata
,
849 const enum ieee80211_rssi_event event
)
851 trace_drv_rssi_callback(local
, sdata
, event
);
852 if (local
->ops
->rssi_callback
)
853 local
->ops
->rssi_callback(&local
->hw
, &sdata
->vif
, event
);
854 trace_drv_return_void(local
);
858 drv_release_buffered_frames(struct ieee80211_local
*local
,
859 struct sta_info
*sta
, u16 tids
, int num_frames
,
860 enum ieee80211_frame_release_type reason
,
863 trace_drv_release_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
865 if (local
->ops
->release_buffered_frames
)
866 local
->ops
->release_buffered_frames(&local
->hw
, &sta
->sta
, tids
,
869 trace_drv_return_void(local
);
873 drv_allow_buffered_frames(struct ieee80211_local
*local
,
874 struct sta_info
*sta
, u16 tids
, int num_frames
,
875 enum ieee80211_frame_release_type reason
,
878 trace_drv_allow_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
880 if (local
->ops
->allow_buffered_frames
)
881 local
->ops
->allow_buffered_frames(&local
->hw
, &sta
->sta
,
882 tids
, num_frames
, reason
,
884 trace_drv_return_void(local
);
887 static inline int drv_get_rssi(struct ieee80211_local
*local
,
888 struct ieee80211_sub_if_data
*sdata
,
889 struct ieee80211_sta
*sta
,
896 ret
= local
->ops
->get_rssi(&local
->hw
, &sdata
->vif
, sta
, rssi_dbm
);
897 trace_drv_get_rssi(local
, sta
, *rssi_dbm
, ret
);
902 static inline void drv_mgd_prepare_tx(struct ieee80211_local
*local
,
903 struct ieee80211_sub_if_data
*sdata
)
907 check_sdata_in_driver(sdata
);
908 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
910 trace_drv_mgd_prepare_tx(local
, sdata
);
911 if (local
->ops
->mgd_prepare_tx
)
912 local
->ops
->mgd_prepare_tx(&local
->hw
, &sdata
->vif
);
913 trace_drv_return_void(local
);
916 static inline int drv_add_chanctx(struct ieee80211_local
*local
,
917 struct ieee80211_chanctx
*ctx
)
919 int ret
= -EOPNOTSUPP
;
921 trace_drv_add_chanctx(local
, ctx
);
922 if (local
->ops
->add_chanctx
)
923 ret
= local
->ops
->add_chanctx(&local
->hw
, &ctx
->conf
);
924 trace_drv_return_int(local
, ret
);
926 ctx
->driver_present
= true;
931 static inline void drv_remove_chanctx(struct ieee80211_local
*local
,
932 struct ieee80211_chanctx
*ctx
)
934 trace_drv_remove_chanctx(local
, ctx
);
935 if (local
->ops
->remove_chanctx
)
936 local
->ops
->remove_chanctx(&local
->hw
, &ctx
->conf
);
937 trace_drv_return_void(local
);
938 ctx
->driver_present
= false;
941 static inline void drv_change_chanctx(struct ieee80211_local
*local
,
942 struct ieee80211_chanctx
*ctx
,
945 trace_drv_change_chanctx(local
, ctx
, changed
);
946 if (local
->ops
->change_chanctx
) {
947 WARN_ON_ONCE(!ctx
->driver_present
);
948 local
->ops
->change_chanctx(&local
->hw
, &ctx
->conf
, changed
);
950 trace_drv_return_void(local
);
953 static inline int drv_assign_vif_chanctx(struct ieee80211_local
*local
,
954 struct ieee80211_sub_if_data
*sdata
,
955 struct ieee80211_chanctx
*ctx
)
959 check_sdata_in_driver(sdata
);
961 trace_drv_assign_vif_chanctx(local
, sdata
, ctx
);
962 if (local
->ops
->assign_vif_chanctx
) {
963 WARN_ON_ONCE(!ctx
->driver_present
);
964 ret
= local
->ops
->assign_vif_chanctx(&local
->hw
,
968 trace_drv_return_int(local
, ret
);
973 static inline void drv_unassign_vif_chanctx(struct ieee80211_local
*local
,
974 struct ieee80211_sub_if_data
*sdata
,
975 struct ieee80211_chanctx
*ctx
)
977 check_sdata_in_driver(sdata
);
979 trace_drv_unassign_vif_chanctx(local
, sdata
, ctx
);
980 if (local
->ops
->unassign_vif_chanctx
) {
981 WARN_ON_ONCE(!ctx
->driver_present
);
982 local
->ops
->unassign_vif_chanctx(&local
->hw
,
986 trace_drv_return_void(local
);
989 static inline int drv_start_ap(struct ieee80211_local
*local
,
990 struct ieee80211_sub_if_data
*sdata
)
994 check_sdata_in_driver(sdata
);
996 trace_drv_start_ap(local
, sdata
, &sdata
->vif
.bss_conf
);
997 if (local
->ops
->start_ap
)
998 ret
= local
->ops
->start_ap(&local
->hw
, &sdata
->vif
);
999 trace_drv_return_int(local
, ret
);
1003 static inline void drv_stop_ap(struct ieee80211_local
*local
,
1004 struct ieee80211_sub_if_data
*sdata
)
1006 check_sdata_in_driver(sdata
);
1008 trace_drv_stop_ap(local
, sdata
);
1009 if (local
->ops
->stop_ap
)
1010 local
->ops
->stop_ap(&local
->hw
, &sdata
->vif
);
1011 trace_drv_return_void(local
);
1014 static inline void drv_restart_complete(struct ieee80211_local
*local
)
1018 trace_drv_restart_complete(local
);
1019 if (local
->ops
->restart_complete
)
1020 local
->ops
->restart_complete(&local
->hw
);
1021 trace_drv_return_void(local
);
1025 drv_set_default_unicast_key(struct ieee80211_local
*local
,
1026 struct ieee80211_sub_if_data
*sdata
,
1029 check_sdata_in_driver(sdata
);
1031 WARN_ON_ONCE(key_idx
< -1 || key_idx
> 3);
1033 trace_drv_set_default_unicast_key(local
, sdata
, key_idx
);
1034 if (local
->ops
->set_default_unicast_key
)
1035 local
->ops
->set_default_unicast_key(&local
->hw
, &sdata
->vif
,
1037 trace_drv_return_void(local
);
1040 #if IS_ENABLED(CONFIG_IPV6)
1041 static inline void drv_ipv6_addr_change(struct ieee80211_local
*local
,
1042 struct ieee80211_sub_if_data
*sdata
,
1043 struct inet6_dev
*idev
)
1045 trace_drv_ipv6_addr_change(local
, sdata
);
1046 if (local
->ops
->ipv6_addr_change
)
1047 local
->ops
->ipv6_addr_change(&local
->hw
, &sdata
->vif
, idev
);
1048 trace_drv_return_void(local
);
1052 #endif /* __MAC80211_DRIVER_OPS */