2 * Portions of this file
3 * Copyright(c) 2016 Intel Deutschland GmbH
6 #ifndef __MAC80211_DRIVER_OPS
7 #define __MAC80211_DRIVER_OPS
9 #include <net/mac80211.h>
10 #include "ieee80211_i.h"
13 static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data
*sdata
)
15 return !WARN(!(sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
),
16 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
17 sdata
->dev
? sdata
->dev
->name
: sdata
->name
, sdata
->flags
);
20 static inline struct ieee80211_sub_if_data
*
21 get_bss_sdata(struct ieee80211_sub_if_data
*sdata
)
23 if (sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
)
24 sdata
= container_of(sdata
->bss
, struct ieee80211_sub_if_data
,
30 static inline void drv_tx(struct ieee80211_local
*local
,
31 struct ieee80211_tx_control
*control
,
34 local
->ops
->tx(&local
->hw
, control
, skb
);
37 static inline void drv_sync_rx_queues(struct ieee80211_local
*local
,
40 if (local
->ops
->sync_rx_queues
) {
41 trace_drv_sync_rx_queues(local
, sta
->sdata
, &sta
->sta
);
42 local
->ops
->sync_rx_queues(&local
->hw
);
43 trace_drv_return_void(local
);
47 static inline void drv_get_et_strings(struct ieee80211_sub_if_data
*sdata
,
50 struct ieee80211_local
*local
= sdata
->local
;
51 if (local
->ops
->get_et_strings
) {
52 trace_drv_get_et_strings(local
, sset
);
53 local
->ops
->get_et_strings(&local
->hw
, &sdata
->vif
, sset
, data
);
54 trace_drv_return_void(local
);
58 static inline void drv_get_et_stats(struct ieee80211_sub_if_data
*sdata
,
59 struct ethtool_stats
*stats
,
62 struct ieee80211_local
*local
= sdata
->local
;
63 if (local
->ops
->get_et_stats
) {
64 trace_drv_get_et_stats(local
);
65 local
->ops
->get_et_stats(&local
->hw
, &sdata
->vif
, stats
, data
);
66 trace_drv_return_void(local
);
70 static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data
*sdata
,
73 struct ieee80211_local
*local
= sdata
->local
;
75 if (local
->ops
->get_et_sset_count
) {
76 trace_drv_get_et_sset_count(local
, sset
);
77 rv
= local
->ops
->get_et_sset_count(&local
->hw
, &sdata
->vif
,
79 trace_drv_return_int(local
, rv
);
84 int drv_start(struct ieee80211_local
*local
);
85 void drv_stop(struct ieee80211_local
*local
);
88 static inline int drv_suspend(struct ieee80211_local
*local
,
89 struct cfg80211_wowlan
*wowlan
)
95 trace_drv_suspend(local
);
96 ret
= local
->ops
->suspend(&local
->hw
, wowlan
);
97 trace_drv_return_int(local
, ret
);
101 static inline int drv_resume(struct ieee80211_local
*local
)
107 trace_drv_resume(local
);
108 ret
= local
->ops
->resume(&local
->hw
);
109 trace_drv_return_int(local
, ret
);
113 static inline void drv_set_wakeup(struct ieee80211_local
*local
,
118 if (!local
->ops
->set_wakeup
)
121 trace_drv_set_wakeup(local
, enabled
);
122 local
->ops
->set_wakeup(&local
->hw
, enabled
);
123 trace_drv_return_void(local
);
127 int drv_add_interface(struct ieee80211_local
*local
,
128 struct ieee80211_sub_if_data
*sdata
);
130 int drv_change_interface(struct ieee80211_local
*local
,
131 struct ieee80211_sub_if_data
*sdata
,
132 enum nl80211_iftype type
, bool p2p
);
134 void drv_remove_interface(struct ieee80211_local
*local
,
135 struct ieee80211_sub_if_data
*sdata
);
137 static inline int drv_config(struct ieee80211_local
*local
, u32 changed
)
143 trace_drv_config(local
, changed
);
144 ret
= local
->ops
->config(&local
->hw
, changed
);
145 trace_drv_return_int(local
, ret
);
149 static inline void drv_bss_info_changed(struct ieee80211_local
*local
,
150 struct ieee80211_sub_if_data
*sdata
,
151 struct ieee80211_bss_conf
*info
,
156 if (WARN_ON_ONCE(changed
& (BSS_CHANGED_BEACON
|
157 BSS_CHANGED_BEACON_ENABLED
) &&
158 sdata
->vif
.type
!= NL80211_IFTYPE_AP
&&
159 sdata
->vif
.type
!= NL80211_IFTYPE_ADHOC
&&
160 sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
&&
161 sdata
->vif
.type
!= NL80211_IFTYPE_OCB
))
164 if (WARN_ON_ONCE(sdata
->vif
.type
== NL80211_IFTYPE_P2P_DEVICE
||
165 sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
))
168 if (!check_sdata_in_driver(sdata
))
171 trace_drv_bss_info_changed(local
, sdata
, info
, changed
);
172 if (local
->ops
->bss_info_changed
)
173 local
->ops
->bss_info_changed(&local
->hw
, &sdata
->vif
, info
, changed
);
174 trace_drv_return_void(local
);
177 static inline u64
drv_prepare_multicast(struct ieee80211_local
*local
,
178 struct netdev_hw_addr_list
*mc_list
)
182 trace_drv_prepare_multicast(local
, mc_list
->count
);
184 if (local
->ops
->prepare_multicast
)
185 ret
= local
->ops
->prepare_multicast(&local
->hw
, mc_list
);
187 trace_drv_return_u64(local
, ret
);
192 static inline void drv_configure_filter(struct ieee80211_local
*local
,
193 unsigned int changed_flags
,
194 unsigned int *total_flags
,
199 trace_drv_configure_filter(local
, changed_flags
, total_flags
,
201 local
->ops
->configure_filter(&local
->hw
, changed_flags
, total_flags
,
203 trace_drv_return_void(local
);
206 static inline void drv_config_iface_filter(struct ieee80211_local
*local
,
207 struct ieee80211_sub_if_data
*sdata
,
208 unsigned int filter_flags
,
209 unsigned int changed_flags
)
213 trace_drv_config_iface_filter(local
, sdata
, filter_flags
,
215 if (local
->ops
->config_iface_filter
)
216 local
->ops
->config_iface_filter(&local
->hw
, &sdata
->vif
,
219 trace_drv_return_void(local
);
222 static inline int drv_set_tim(struct ieee80211_local
*local
,
223 struct ieee80211_sta
*sta
, bool set
)
226 trace_drv_set_tim(local
, sta
, set
);
227 if (local
->ops
->set_tim
)
228 ret
= local
->ops
->set_tim(&local
->hw
, sta
, set
);
229 trace_drv_return_int(local
, ret
);
233 static inline int drv_set_key(struct ieee80211_local
*local
,
234 enum set_key_cmd cmd
,
235 struct ieee80211_sub_if_data
*sdata
,
236 struct ieee80211_sta
*sta
,
237 struct ieee80211_key_conf
*key
)
243 sdata
= get_bss_sdata(sdata
);
244 if (!check_sdata_in_driver(sdata
))
247 trace_drv_set_key(local
, cmd
, sdata
, sta
, key
);
248 ret
= local
->ops
->set_key(&local
->hw
, cmd
, &sdata
->vif
, sta
, key
);
249 trace_drv_return_int(local
, ret
);
253 static inline void drv_update_tkip_key(struct ieee80211_local
*local
,
254 struct ieee80211_sub_if_data
*sdata
,
255 struct ieee80211_key_conf
*conf
,
256 struct sta_info
*sta
, u32 iv32
,
259 struct ieee80211_sta
*ista
= NULL
;
264 sdata
= get_bss_sdata(sdata
);
265 if (!check_sdata_in_driver(sdata
))
268 trace_drv_update_tkip_key(local
, sdata
, conf
, ista
, iv32
);
269 if (local
->ops
->update_tkip_key
)
270 local
->ops
->update_tkip_key(&local
->hw
, &sdata
->vif
, conf
,
271 ista
, iv32
, phase1key
);
272 trace_drv_return_void(local
);
275 static inline int drv_hw_scan(struct ieee80211_local
*local
,
276 struct ieee80211_sub_if_data
*sdata
,
277 struct ieee80211_scan_request
*req
)
283 if (!check_sdata_in_driver(sdata
))
286 trace_drv_hw_scan(local
, sdata
);
287 ret
= local
->ops
->hw_scan(&local
->hw
, &sdata
->vif
, req
);
288 trace_drv_return_int(local
, ret
);
292 static inline void drv_cancel_hw_scan(struct ieee80211_local
*local
,
293 struct ieee80211_sub_if_data
*sdata
)
297 if (!check_sdata_in_driver(sdata
))
300 trace_drv_cancel_hw_scan(local
, sdata
);
301 local
->ops
->cancel_hw_scan(&local
->hw
, &sdata
->vif
);
302 trace_drv_return_void(local
);
306 drv_sched_scan_start(struct ieee80211_local
*local
,
307 struct ieee80211_sub_if_data
*sdata
,
308 struct cfg80211_sched_scan_request
*req
,
309 struct ieee80211_scan_ies
*ies
)
315 if (!check_sdata_in_driver(sdata
))
318 trace_drv_sched_scan_start(local
, sdata
);
319 ret
= local
->ops
->sched_scan_start(&local
->hw
, &sdata
->vif
,
321 trace_drv_return_int(local
, ret
);
325 static inline int drv_sched_scan_stop(struct ieee80211_local
*local
,
326 struct ieee80211_sub_if_data
*sdata
)
332 if (!check_sdata_in_driver(sdata
))
335 trace_drv_sched_scan_stop(local
, sdata
);
336 ret
= local
->ops
->sched_scan_stop(&local
->hw
, &sdata
->vif
);
337 trace_drv_return_int(local
, ret
);
342 static inline void drv_sw_scan_start(struct ieee80211_local
*local
,
343 struct ieee80211_sub_if_data
*sdata
,
348 trace_drv_sw_scan_start(local
, sdata
, mac_addr
);
349 if (local
->ops
->sw_scan_start
)
350 local
->ops
->sw_scan_start(&local
->hw
, &sdata
->vif
, mac_addr
);
351 trace_drv_return_void(local
);
354 static inline void drv_sw_scan_complete(struct ieee80211_local
*local
,
355 struct ieee80211_sub_if_data
*sdata
)
359 trace_drv_sw_scan_complete(local
, sdata
);
360 if (local
->ops
->sw_scan_complete
)
361 local
->ops
->sw_scan_complete(&local
->hw
, &sdata
->vif
);
362 trace_drv_return_void(local
);
365 static inline int drv_get_stats(struct ieee80211_local
*local
,
366 struct ieee80211_low_level_stats
*stats
)
368 int ret
= -EOPNOTSUPP
;
372 if (local
->ops
->get_stats
)
373 ret
= local
->ops
->get_stats(&local
->hw
, stats
);
374 trace_drv_get_stats(local
, stats
, ret
);
379 static inline void drv_get_key_seq(struct ieee80211_local
*local
,
380 struct ieee80211_key
*key
,
381 struct ieee80211_key_seq
*seq
)
383 if (local
->ops
->get_key_seq
)
384 local
->ops
->get_key_seq(&local
->hw
, &key
->conf
, seq
);
385 trace_drv_get_key_seq(local
, &key
->conf
);
388 static inline int drv_set_frag_threshold(struct ieee80211_local
*local
,
395 trace_drv_set_frag_threshold(local
, value
);
396 if (local
->ops
->set_frag_threshold
)
397 ret
= local
->ops
->set_frag_threshold(&local
->hw
, value
);
398 trace_drv_return_int(local
, ret
);
402 static inline int drv_set_rts_threshold(struct ieee80211_local
*local
,
409 trace_drv_set_rts_threshold(local
, value
);
410 if (local
->ops
->set_rts_threshold
)
411 ret
= local
->ops
->set_rts_threshold(&local
->hw
, value
);
412 trace_drv_return_int(local
, ret
);
416 static inline int drv_set_coverage_class(struct ieee80211_local
*local
,
422 trace_drv_set_coverage_class(local
, value
);
423 if (local
->ops
->set_coverage_class
)
424 local
->ops
->set_coverage_class(&local
->hw
, value
);
428 trace_drv_return_int(local
, ret
);
432 static inline void drv_sta_notify(struct ieee80211_local
*local
,
433 struct ieee80211_sub_if_data
*sdata
,
434 enum sta_notify_cmd cmd
,
435 struct ieee80211_sta
*sta
)
437 sdata
= get_bss_sdata(sdata
);
438 if (!check_sdata_in_driver(sdata
))
441 trace_drv_sta_notify(local
, sdata
, cmd
, sta
);
442 if (local
->ops
->sta_notify
)
443 local
->ops
->sta_notify(&local
->hw
, &sdata
->vif
, cmd
, sta
);
444 trace_drv_return_void(local
);
447 static inline int drv_sta_add(struct ieee80211_local
*local
,
448 struct ieee80211_sub_if_data
*sdata
,
449 struct ieee80211_sta
*sta
)
455 sdata
= get_bss_sdata(sdata
);
456 if (!check_sdata_in_driver(sdata
))
459 trace_drv_sta_add(local
, sdata
, sta
);
460 if (local
->ops
->sta_add
)
461 ret
= local
->ops
->sta_add(&local
->hw
, &sdata
->vif
, sta
);
463 trace_drv_return_int(local
, ret
);
468 static inline void drv_sta_remove(struct ieee80211_local
*local
,
469 struct ieee80211_sub_if_data
*sdata
,
470 struct ieee80211_sta
*sta
)
474 sdata
= get_bss_sdata(sdata
);
475 if (!check_sdata_in_driver(sdata
))
478 trace_drv_sta_remove(local
, sdata
, sta
);
479 if (local
->ops
->sta_remove
)
480 local
->ops
->sta_remove(&local
->hw
, &sdata
->vif
, sta
);
482 trace_drv_return_void(local
);
485 #ifdef CONFIG_MAC80211_DEBUGFS
486 static inline void drv_sta_add_debugfs(struct ieee80211_local
*local
,
487 struct ieee80211_sub_if_data
*sdata
,
488 struct ieee80211_sta
*sta
,
493 sdata
= get_bss_sdata(sdata
);
494 if (!check_sdata_in_driver(sdata
))
497 if (local
->ops
->sta_add_debugfs
)
498 local
->ops
->sta_add_debugfs(&local
->hw
, &sdata
->vif
,
502 static inline void drv_sta_remove_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_remove_debugfs
)
513 local
->ops
->sta_remove_debugfs(&local
->hw
, &sdata
->vif
,
518 static inline void drv_sta_pre_rcu_remove(struct ieee80211_local
*local
,
519 struct ieee80211_sub_if_data
*sdata
,
520 struct sta_info
*sta
)
524 sdata
= get_bss_sdata(sdata
);
525 if (!check_sdata_in_driver(sdata
))
528 trace_drv_sta_pre_rcu_remove(local
, sdata
, &sta
->sta
);
529 if (local
->ops
->sta_pre_rcu_remove
)
530 local
->ops
->sta_pre_rcu_remove(&local
->hw
, &sdata
->vif
,
532 trace_drv_return_void(local
);
536 int drv_sta_state(struct ieee80211_local
*local
,
537 struct ieee80211_sub_if_data
*sdata
,
538 struct sta_info
*sta
,
539 enum ieee80211_sta_state old_state
,
540 enum ieee80211_sta_state new_state
);
542 void drv_sta_rc_update(struct ieee80211_local
*local
,
543 struct ieee80211_sub_if_data
*sdata
,
544 struct ieee80211_sta
*sta
, u32 changed
);
546 static inline void drv_sta_rate_tbl_update(struct ieee80211_local
*local
,
547 struct ieee80211_sub_if_data
*sdata
,
548 struct ieee80211_sta
*sta
)
550 sdata
= get_bss_sdata(sdata
);
551 if (!check_sdata_in_driver(sdata
))
554 trace_drv_sta_rate_tbl_update(local
, sdata
, sta
);
555 if (local
->ops
->sta_rate_tbl_update
)
556 local
->ops
->sta_rate_tbl_update(&local
->hw
, &sdata
->vif
, sta
);
558 trace_drv_return_void(local
);
561 static inline void drv_sta_statistics(struct ieee80211_local
*local
,
562 struct ieee80211_sub_if_data
*sdata
,
563 struct ieee80211_sta
*sta
,
564 struct station_info
*sinfo
)
566 sdata
= get_bss_sdata(sdata
);
567 if (!check_sdata_in_driver(sdata
))
570 trace_drv_sta_statistics(local
, sdata
, sta
);
571 if (local
->ops
->sta_statistics
)
572 local
->ops
->sta_statistics(&local
->hw
, &sdata
->vif
, sta
, sinfo
);
573 trace_drv_return_void(local
);
576 int drv_conf_tx(struct ieee80211_local
*local
,
577 struct ieee80211_sub_if_data
*sdata
, u16 ac
,
578 const struct ieee80211_tx_queue_params
*params
);
580 u64
drv_get_tsf(struct ieee80211_local
*local
,
581 struct ieee80211_sub_if_data
*sdata
);
582 void drv_set_tsf(struct ieee80211_local
*local
,
583 struct ieee80211_sub_if_data
*sdata
,
585 void drv_reset_tsf(struct ieee80211_local
*local
,
586 struct ieee80211_sub_if_data
*sdata
);
588 static inline int drv_tx_last_beacon(struct ieee80211_local
*local
)
590 int ret
= 0; /* default unsupported op for less congestion */
594 trace_drv_tx_last_beacon(local
);
595 if (local
->ops
->tx_last_beacon
)
596 ret
= local
->ops
->tx_last_beacon(&local
->hw
);
597 trace_drv_return_int(local
, ret
);
601 int drv_ampdu_action(struct ieee80211_local
*local
,
602 struct ieee80211_sub_if_data
*sdata
,
603 struct ieee80211_ampdu_params
*params
);
605 static inline int drv_get_survey(struct ieee80211_local
*local
, int idx
,
606 struct survey_info
*survey
)
608 int ret
= -EOPNOTSUPP
;
610 trace_drv_get_survey(local
, idx
, survey
);
612 if (local
->ops
->get_survey
)
613 ret
= local
->ops
->get_survey(&local
->hw
, idx
, survey
);
615 trace_drv_return_int(local
, ret
);
620 static inline void drv_rfkill_poll(struct ieee80211_local
*local
)
624 if (local
->ops
->rfkill_poll
)
625 local
->ops
->rfkill_poll(&local
->hw
);
628 static inline void drv_flush(struct ieee80211_local
*local
,
629 struct ieee80211_sub_if_data
*sdata
,
630 u32 queues
, bool drop
)
632 struct ieee80211_vif
*vif
= sdata
? &sdata
->vif
: NULL
;
636 if (sdata
&& !check_sdata_in_driver(sdata
))
639 trace_drv_flush(local
, queues
, drop
);
640 if (local
->ops
->flush
)
641 local
->ops
->flush(&local
->hw
, vif
, queues
, drop
);
642 trace_drv_return_void(local
);
645 static inline void drv_channel_switch(struct ieee80211_local
*local
,
646 struct ieee80211_sub_if_data
*sdata
,
647 struct ieee80211_channel_switch
*ch_switch
)
651 trace_drv_channel_switch(local
, sdata
, ch_switch
);
652 local
->ops
->channel_switch(&local
->hw
, &sdata
->vif
, ch_switch
);
653 trace_drv_return_void(local
);
657 static inline int drv_set_antenna(struct ieee80211_local
*local
,
658 u32 tx_ant
, u32 rx_ant
)
660 int ret
= -EOPNOTSUPP
;
662 if (local
->ops
->set_antenna
)
663 ret
= local
->ops
->set_antenna(&local
->hw
, tx_ant
, rx_ant
);
664 trace_drv_set_antenna(local
, tx_ant
, rx_ant
, ret
);
668 static inline int drv_get_antenna(struct ieee80211_local
*local
,
669 u32
*tx_ant
, u32
*rx_ant
)
671 int ret
= -EOPNOTSUPP
;
673 if (local
->ops
->get_antenna
)
674 ret
= local
->ops
->get_antenna(&local
->hw
, tx_ant
, rx_ant
);
675 trace_drv_get_antenna(local
, *tx_ant
, *rx_ant
, ret
);
679 static inline int drv_remain_on_channel(struct ieee80211_local
*local
,
680 struct ieee80211_sub_if_data
*sdata
,
681 struct ieee80211_channel
*chan
,
682 unsigned int duration
,
683 enum ieee80211_roc_type type
)
689 trace_drv_remain_on_channel(local
, sdata
, chan
, duration
, type
);
690 ret
= local
->ops
->remain_on_channel(&local
->hw
, &sdata
->vif
,
691 chan
, duration
, type
);
692 trace_drv_return_int(local
, ret
);
697 static inline int drv_cancel_remain_on_channel(struct ieee80211_local
*local
)
703 trace_drv_cancel_remain_on_channel(local
);
704 ret
= local
->ops
->cancel_remain_on_channel(&local
->hw
);
705 trace_drv_return_int(local
, ret
);
710 static inline int drv_set_ringparam(struct ieee80211_local
*local
,
717 trace_drv_set_ringparam(local
, tx
, rx
);
718 if (local
->ops
->set_ringparam
)
719 ret
= local
->ops
->set_ringparam(&local
->hw
, tx
, rx
);
720 trace_drv_return_int(local
, ret
);
725 static inline void drv_get_ringparam(struct ieee80211_local
*local
,
726 u32
*tx
, u32
*tx_max
, u32
*rx
, u32
*rx_max
)
730 trace_drv_get_ringparam(local
, tx
, tx_max
, rx
, rx_max
);
731 if (local
->ops
->get_ringparam
)
732 local
->ops
->get_ringparam(&local
->hw
, tx
, tx_max
, rx
, rx_max
);
733 trace_drv_return_void(local
);
736 static inline bool drv_tx_frames_pending(struct ieee80211_local
*local
)
742 trace_drv_tx_frames_pending(local
);
743 if (local
->ops
->tx_frames_pending
)
744 ret
= local
->ops
->tx_frames_pending(&local
->hw
);
745 trace_drv_return_bool(local
, ret
);
750 static inline int drv_set_bitrate_mask(struct ieee80211_local
*local
,
751 struct ieee80211_sub_if_data
*sdata
,
752 const struct cfg80211_bitrate_mask
*mask
)
754 int ret
= -EOPNOTSUPP
;
758 if (!check_sdata_in_driver(sdata
))
761 trace_drv_set_bitrate_mask(local
, sdata
, mask
);
762 if (local
->ops
->set_bitrate_mask
)
763 ret
= local
->ops
->set_bitrate_mask(&local
->hw
,
765 trace_drv_return_int(local
, ret
);
770 static inline void drv_set_rekey_data(struct ieee80211_local
*local
,
771 struct ieee80211_sub_if_data
*sdata
,
772 struct cfg80211_gtk_rekey_data
*data
)
774 if (!check_sdata_in_driver(sdata
))
777 trace_drv_set_rekey_data(local
, sdata
, data
);
778 if (local
->ops
->set_rekey_data
)
779 local
->ops
->set_rekey_data(&local
->hw
, &sdata
->vif
, data
);
780 trace_drv_return_void(local
);
783 static inline void drv_event_callback(struct ieee80211_local
*local
,
784 struct ieee80211_sub_if_data
*sdata
,
785 const struct ieee80211_event
*event
)
787 trace_drv_event_callback(local
, sdata
, event
);
788 if (local
->ops
->event_callback
)
789 local
->ops
->event_callback(&local
->hw
, &sdata
->vif
, event
);
790 trace_drv_return_void(local
);
794 drv_release_buffered_frames(struct ieee80211_local
*local
,
795 struct sta_info
*sta
, u16 tids
, int num_frames
,
796 enum ieee80211_frame_release_type reason
,
799 trace_drv_release_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
801 if (local
->ops
->release_buffered_frames
)
802 local
->ops
->release_buffered_frames(&local
->hw
, &sta
->sta
, tids
,
805 trace_drv_return_void(local
);
809 drv_allow_buffered_frames(struct ieee80211_local
*local
,
810 struct sta_info
*sta
, u16 tids
, int num_frames
,
811 enum ieee80211_frame_release_type reason
,
814 trace_drv_allow_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
816 if (local
->ops
->allow_buffered_frames
)
817 local
->ops
->allow_buffered_frames(&local
->hw
, &sta
->sta
,
818 tids
, num_frames
, reason
,
820 trace_drv_return_void(local
);
823 static inline void drv_mgd_prepare_tx(struct ieee80211_local
*local
,
824 struct ieee80211_sub_if_data
*sdata
)
828 if (!check_sdata_in_driver(sdata
))
830 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
832 trace_drv_mgd_prepare_tx(local
, sdata
);
833 if (local
->ops
->mgd_prepare_tx
)
834 local
->ops
->mgd_prepare_tx(&local
->hw
, &sdata
->vif
);
835 trace_drv_return_void(local
);
839 drv_mgd_protect_tdls_discover(struct ieee80211_local
*local
,
840 struct ieee80211_sub_if_data
*sdata
)
844 if (!check_sdata_in_driver(sdata
))
846 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
848 trace_drv_mgd_protect_tdls_discover(local
, sdata
);
849 if (local
->ops
->mgd_protect_tdls_discover
)
850 local
->ops
->mgd_protect_tdls_discover(&local
->hw
, &sdata
->vif
);
851 trace_drv_return_void(local
);
854 static inline int drv_add_chanctx(struct ieee80211_local
*local
,
855 struct ieee80211_chanctx
*ctx
)
857 int ret
= -EOPNOTSUPP
;
861 trace_drv_add_chanctx(local
, ctx
);
862 if (local
->ops
->add_chanctx
)
863 ret
= local
->ops
->add_chanctx(&local
->hw
, &ctx
->conf
);
864 trace_drv_return_int(local
, ret
);
866 ctx
->driver_present
= true;
871 static inline void drv_remove_chanctx(struct ieee80211_local
*local
,
872 struct ieee80211_chanctx
*ctx
)
876 if (WARN_ON(!ctx
->driver_present
))
879 trace_drv_remove_chanctx(local
, ctx
);
880 if (local
->ops
->remove_chanctx
)
881 local
->ops
->remove_chanctx(&local
->hw
, &ctx
->conf
);
882 trace_drv_return_void(local
);
883 ctx
->driver_present
= false;
886 static inline void drv_change_chanctx(struct ieee80211_local
*local
,
887 struct ieee80211_chanctx
*ctx
,
892 trace_drv_change_chanctx(local
, ctx
, changed
);
893 if (local
->ops
->change_chanctx
) {
894 WARN_ON_ONCE(!ctx
->driver_present
);
895 local
->ops
->change_chanctx(&local
->hw
, &ctx
->conf
, changed
);
897 trace_drv_return_void(local
);
900 static inline int drv_assign_vif_chanctx(struct ieee80211_local
*local
,
901 struct ieee80211_sub_if_data
*sdata
,
902 struct ieee80211_chanctx
*ctx
)
906 if (!check_sdata_in_driver(sdata
))
909 trace_drv_assign_vif_chanctx(local
, sdata
, ctx
);
910 if (local
->ops
->assign_vif_chanctx
) {
911 WARN_ON_ONCE(!ctx
->driver_present
);
912 ret
= local
->ops
->assign_vif_chanctx(&local
->hw
,
916 trace_drv_return_int(local
, ret
);
921 static inline void drv_unassign_vif_chanctx(struct ieee80211_local
*local
,
922 struct ieee80211_sub_if_data
*sdata
,
923 struct ieee80211_chanctx
*ctx
)
927 if (!check_sdata_in_driver(sdata
))
930 trace_drv_unassign_vif_chanctx(local
, sdata
, ctx
);
931 if (local
->ops
->unassign_vif_chanctx
) {
932 WARN_ON_ONCE(!ctx
->driver_present
);
933 local
->ops
->unassign_vif_chanctx(&local
->hw
,
937 trace_drv_return_void(local
);
940 int drv_switch_vif_chanctx(struct ieee80211_local
*local
,
941 struct ieee80211_vif_chanctx_switch
*vifs
,
942 int n_vifs
, enum ieee80211_chanctx_switch_mode mode
);
944 static inline int drv_start_ap(struct ieee80211_local
*local
,
945 struct ieee80211_sub_if_data
*sdata
)
951 if (!check_sdata_in_driver(sdata
))
954 trace_drv_start_ap(local
, sdata
, &sdata
->vif
.bss_conf
);
955 if (local
->ops
->start_ap
)
956 ret
= local
->ops
->start_ap(&local
->hw
, &sdata
->vif
);
957 trace_drv_return_int(local
, ret
);
961 static inline void drv_stop_ap(struct ieee80211_local
*local
,
962 struct ieee80211_sub_if_data
*sdata
)
964 if (!check_sdata_in_driver(sdata
))
967 trace_drv_stop_ap(local
, sdata
);
968 if (local
->ops
->stop_ap
)
969 local
->ops
->stop_ap(&local
->hw
, &sdata
->vif
);
970 trace_drv_return_void(local
);
974 drv_reconfig_complete(struct ieee80211_local
*local
,
975 enum ieee80211_reconfig_type reconfig_type
)
979 trace_drv_reconfig_complete(local
, reconfig_type
);
980 if (local
->ops
->reconfig_complete
)
981 local
->ops
->reconfig_complete(&local
->hw
, reconfig_type
);
982 trace_drv_return_void(local
);
986 drv_set_default_unicast_key(struct ieee80211_local
*local
,
987 struct ieee80211_sub_if_data
*sdata
,
990 if (!check_sdata_in_driver(sdata
))
993 WARN_ON_ONCE(key_idx
< -1 || key_idx
> 3);
995 trace_drv_set_default_unicast_key(local
, sdata
, key_idx
);
996 if (local
->ops
->set_default_unicast_key
)
997 local
->ops
->set_default_unicast_key(&local
->hw
, &sdata
->vif
,
999 trace_drv_return_void(local
);
1002 #if IS_ENABLED(CONFIG_IPV6)
1003 static inline void drv_ipv6_addr_change(struct ieee80211_local
*local
,
1004 struct ieee80211_sub_if_data
*sdata
,
1005 struct inet6_dev
*idev
)
1007 trace_drv_ipv6_addr_change(local
, sdata
);
1008 if (local
->ops
->ipv6_addr_change
)
1009 local
->ops
->ipv6_addr_change(&local
->hw
, &sdata
->vif
, idev
);
1010 trace_drv_return_void(local
);
1015 drv_channel_switch_beacon(struct ieee80211_sub_if_data
*sdata
,
1016 struct cfg80211_chan_def
*chandef
)
1018 struct ieee80211_local
*local
= sdata
->local
;
1020 if (local
->ops
->channel_switch_beacon
) {
1021 trace_drv_channel_switch_beacon(local
, sdata
, chandef
);
1022 local
->ops
->channel_switch_beacon(&local
->hw
, &sdata
->vif
,
1028 drv_pre_channel_switch(struct ieee80211_sub_if_data
*sdata
,
1029 struct ieee80211_channel_switch
*ch_switch
)
1031 struct ieee80211_local
*local
= sdata
->local
;
1034 if (!check_sdata_in_driver(sdata
))
1037 trace_drv_pre_channel_switch(local
, sdata
, ch_switch
);
1038 if (local
->ops
->pre_channel_switch
)
1039 ret
= local
->ops
->pre_channel_switch(&local
->hw
, &sdata
->vif
,
1041 trace_drv_return_int(local
, ret
);
1046 drv_post_channel_switch(struct ieee80211_sub_if_data
*sdata
)
1048 struct ieee80211_local
*local
= sdata
->local
;
1051 if (!check_sdata_in_driver(sdata
))
1054 trace_drv_post_channel_switch(local
, sdata
);
1055 if (local
->ops
->post_channel_switch
)
1056 ret
= local
->ops
->post_channel_switch(&local
->hw
, &sdata
->vif
);
1057 trace_drv_return_int(local
, ret
);
1061 static inline int drv_join_ibss(struct ieee80211_local
*local
,
1062 struct ieee80211_sub_if_data
*sdata
)
1067 if (!check_sdata_in_driver(sdata
))
1070 trace_drv_join_ibss(local
, sdata
, &sdata
->vif
.bss_conf
);
1071 if (local
->ops
->join_ibss
)
1072 ret
= local
->ops
->join_ibss(&local
->hw
, &sdata
->vif
);
1073 trace_drv_return_int(local
, ret
);
1077 static inline void drv_leave_ibss(struct ieee80211_local
*local
,
1078 struct ieee80211_sub_if_data
*sdata
)
1081 if (!check_sdata_in_driver(sdata
))
1084 trace_drv_leave_ibss(local
, sdata
);
1085 if (local
->ops
->leave_ibss
)
1086 local
->ops
->leave_ibss(&local
->hw
, &sdata
->vif
);
1087 trace_drv_return_void(local
);
1090 static inline u32
drv_get_expected_throughput(struct ieee80211_local
*local
,
1091 struct ieee80211_sta
*sta
)
1095 trace_drv_get_expected_throughput(sta
);
1096 if (local
->ops
->get_expected_throughput
)
1097 ret
= local
->ops
->get_expected_throughput(sta
);
1098 trace_drv_return_u32(local
, ret
);
1103 static inline int drv_get_txpower(struct ieee80211_local
*local
,
1104 struct ieee80211_sub_if_data
*sdata
, int *dbm
)
1108 if (!local
->ops
->get_txpower
)
1111 ret
= local
->ops
->get_txpower(&local
->hw
, &sdata
->vif
, dbm
);
1112 trace_drv_get_txpower(local
, sdata
, *dbm
, ret
);
1118 drv_tdls_channel_switch(struct ieee80211_local
*local
,
1119 struct ieee80211_sub_if_data
*sdata
,
1120 struct ieee80211_sta
*sta
, u8 oper_class
,
1121 struct cfg80211_chan_def
*chandef
,
1122 struct sk_buff
*tmpl_skb
, u32 ch_sw_tm_ie
)
1127 if (!check_sdata_in_driver(sdata
))
1130 if (!local
->ops
->tdls_channel_switch
)
1133 trace_drv_tdls_channel_switch(local
, sdata
, sta
, oper_class
, chandef
);
1134 ret
= local
->ops
->tdls_channel_switch(&local
->hw
, &sdata
->vif
, sta
,
1135 oper_class
, chandef
, tmpl_skb
,
1137 trace_drv_return_int(local
, ret
);
1142 drv_tdls_cancel_channel_switch(struct ieee80211_local
*local
,
1143 struct ieee80211_sub_if_data
*sdata
,
1144 struct ieee80211_sta
*sta
)
1147 if (!check_sdata_in_driver(sdata
))
1150 if (!local
->ops
->tdls_cancel_channel_switch
)
1153 trace_drv_tdls_cancel_channel_switch(local
, sdata
, sta
);
1154 local
->ops
->tdls_cancel_channel_switch(&local
->hw
, &sdata
->vif
, sta
);
1155 trace_drv_return_void(local
);
1159 drv_tdls_recv_channel_switch(struct ieee80211_local
*local
,
1160 struct ieee80211_sub_if_data
*sdata
,
1161 struct ieee80211_tdls_ch_sw_params
*params
)
1163 trace_drv_tdls_recv_channel_switch(local
, sdata
, params
);
1164 if (local
->ops
->tdls_recv_channel_switch
)
1165 local
->ops
->tdls_recv_channel_switch(&local
->hw
, &sdata
->vif
,
1167 trace_drv_return_void(local
);
1170 static inline void drv_wake_tx_queue(struct ieee80211_local
*local
,
1171 struct txq_info
*txq
)
1173 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(txq
->txq
.vif
);
1175 if (!check_sdata_in_driver(sdata
))
1178 trace_drv_wake_tx_queue(local
, sdata
, txq
);
1179 local
->ops
->wake_tx_queue(&local
->hw
, &txq
->txq
);
1182 #endif /* __MAC80211_DRIVER_OPS */