1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Portions of this file
4 * Copyright(c) 2016 Intel Deutschland GmbH
7 #ifndef __MAC80211_DRIVER_OPS
8 #define __MAC80211_DRIVER_OPS
10 #include <net/mac80211.h>
11 #include "ieee80211_i.h"
14 static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data
*sdata
)
16 return !WARN(!(sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
),
17 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
18 sdata
->dev
? sdata
->dev
->name
: sdata
->name
, sdata
->flags
);
21 static inline struct ieee80211_sub_if_data
*
22 get_bss_sdata(struct ieee80211_sub_if_data
*sdata
)
24 if (sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
)
25 sdata
= container_of(sdata
->bss
, struct ieee80211_sub_if_data
,
31 static inline void drv_tx(struct ieee80211_local
*local
,
32 struct ieee80211_tx_control
*control
,
35 local
->ops
->tx(&local
->hw
, control
, skb
);
38 static inline void drv_sync_rx_queues(struct ieee80211_local
*local
,
41 if (local
->ops
->sync_rx_queues
) {
42 trace_drv_sync_rx_queues(local
, sta
->sdata
, &sta
->sta
);
43 local
->ops
->sync_rx_queues(&local
->hw
);
44 trace_drv_return_void(local
);
48 static inline void drv_get_et_strings(struct ieee80211_sub_if_data
*sdata
,
51 struct ieee80211_local
*local
= sdata
->local
;
52 if (local
->ops
->get_et_strings
) {
53 trace_drv_get_et_strings(local
, sset
);
54 local
->ops
->get_et_strings(&local
->hw
, &sdata
->vif
, sset
, data
);
55 trace_drv_return_void(local
);
59 static inline void drv_get_et_stats(struct ieee80211_sub_if_data
*sdata
,
60 struct ethtool_stats
*stats
,
63 struct ieee80211_local
*local
= sdata
->local
;
64 if (local
->ops
->get_et_stats
) {
65 trace_drv_get_et_stats(local
);
66 local
->ops
->get_et_stats(&local
->hw
, &sdata
->vif
, stats
, data
);
67 trace_drv_return_void(local
);
71 static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data
*sdata
,
74 struct ieee80211_local
*local
= sdata
->local
;
76 if (local
->ops
->get_et_sset_count
) {
77 trace_drv_get_et_sset_count(local
, sset
);
78 rv
= local
->ops
->get_et_sset_count(&local
->hw
, &sdata
->vif
,
80 trace_drv_return_int(local
, rv
);
85 int drv_start(struct ieee80211_local
*local
);
86 void drv_stop(struct ieee80211_local
*local
);
89 static inline int drv_suspend(struct ieee80211_local
*local
,
90 struct cfg80211_wowlan
*wowlan
)
96 trace_drv_suspend(local
);
97 ret
= local
->ops
->suspend(&local
->hw
, wowlan
);
98 trace_drv_return_int(local
, ret
);
102 static inline int drv_resume(struct ieee80211_local
*local
)
108 trace_drv_resume(local
);
109 ret
= local
->ops
->resume(&local
->hw
);
110 trace_drv_return_int(local
, ret
);
114 static inline void drv_set_wakeup(struct ieee80211_local
*local
,
119 if (!local
->ops
->set_wakeup
)
122 trace_drv_set_wakeup(local
, enabled
);
123 local
->ops
->set_wakeup(&local
->hw
, enabled
);
124 trace_drv_return_void(local
);
128 int drv_add_interface(struct ieee80211_local
*local
,
129 struct ieee80211_sub_if_data
*sdata
);
131 int drv_change_interface(struct ieee80211_local
*local
,
132 struct ieee80211_sub_if_data
*sdata
,
133 enum nl80211_iftype type
, bool p2p
);
135 void drv_remove_interface(struct ieee80211_local
*local
,
136 struct ieee80211_sub_if_data
*sdata
);
138 static inline int drv_config(struct ieee80211_local
*local
, u32 changed
)
144 trace_drv_config(local
, changed
);
145 ret
= local
->ops
->config(&local
->hw
, changed
);
146 trace_drv_return_int(local
, ret
);
150 static inline void drv_bss_info_changed(struct ieee80211_local
*local
,
151 struct ieee80211_sub_if_data
*sdata
,
152 struct ieee80211_bss_conf
*info
,
157 if (WARN_ON_ONCE(changed
& (BSS_CHANGED_BEACON
|
158 BSS_CHANGED_BEACON_ENABLED
) &&
159 sdata
->vif
.type
!= NL80211_IFTYPE_AP
&&
160 sdata
->vif
.type
!= NL80211_IFTYPE_ADHOC
&&
161 sdata
->vif
.type
!= NL80211_IFTYPE_MESH_POINT
&&
162 sdata
->vif
.type
!= NL80211_IFTYPE_OCB
))
165 if (WARN_ON_ONCE(sdata
->vif
.type
== NL80211_IFTYPE_P2P_DEVICE
||
166 sdata
->vif
.type
== NL80211_IFTYPE_NAN
||
167 (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
168 !sdata
->vif
.mu_mimo_owner
)))
171 if (!check_sdata_in_driver(sdata
))
174 trace_drv_bss_info_changed(local
, sdata
, info
, changed
);
175 if (local
->ops
->bss_info_changed
)
176 local
->ops
->bss_info_changed(&local
->hw
, &sdata
->vif
, info
, changed
);
177 trace_drv_return_void(local
);
180 static inline u64
drv_prepare_multicast(struct ieee80211_local
*local
,
181 struct netdev_hw_addr_list
*mc_list
)
185 trace_drv_prepare_multicast(local
, mc_list
->count
);
187 if (local
->ops
->prepare_multicast
)
188 ret
= local
->ops
->prepare_multicast(&local
->hw
, mc_list
);
190 trace_drv_return_u64(local
, ret
);
195 static inline void drv_configure_filter(struct ieee80211_local
*local
,
196 unsigned int changed_flags
,
197 unsigned int *total_flags
,
202 trace_drv_configure_filter(local
, changed_flags
, total_flags
,
204 local
->ops
->configure_filter(&local
->hw
, changed_flags
, total_flags
,
206 trace_drv_return_void(local
);
209 static inline void drv_config_iface_filter(struct ieee80211_local
*local
,
210 struct ieee80211_sub_if_data
*sdata
,
211 unsigned int filter_flags
,
212 unsigned int changed_flags
)
216 trace_drv_config_iface_filter(local
, sdata
, filter_flags
,
218 if (local
->ops
->config_iface_filter
)
219 local
->ops
->config_iface_filter(&local
->hw
, &sdata
->vif
,
222 trace_drv_return_void(local
);
225 static inline int drv_set_tim(struct ieee80211_local
*local
,
226 struct ieee80211_sta
*sta
, bool set
)
229 trace_drv_set_tim(local
, sta
, set
);
230 if (local
->ops
->set_tim
)
231 ret
= local
->ops
->set_tim(&local
->hw
, sta
, set
);
232 trace_drv_return_int(local
, ret
);
236 static inline int drv_set_key(struct ieee80211_local
*local
,
237 enum set_key_cmd cmd
,
238 struct ieee80211_sub_if_data
*sdata
,
239 struct ieee80211_sta
*sta
,
240 struct ieee80211_key_conf
*key
)
246 sdata
= get_bss_sdata(sdata
);
247 if (!check_sdata_in_driver(sdata
))
250 trace_drv_set_key(local
, cmd
, sdata
, sta
, key
);
251 ret
= local
->ops
->set_key(&local
->hw
, cmd
, &sdata
->vif
, sta
, key
);
252 trace_drv_return_int(local
, ret
);
256 static inline void drv_update_tkip_key(struct ieee80211_local
*local
,
257 struct ieee80211_sub_if_data
*sdata
,
258 struct ieee80211_key_conf
*conf
,
259 struct sta_info
*sta
, u32 iv32
,
262 struct ieee80211_sta
*ista
= NULL
;
267 sdata
= get_bss_sdata(sdata
);
268 if (!check_sdata_in_driver(sdata
))
271 trace_drv_update_tkip_key(local
, sdata
, conf
, ista
, iv32
);
272 if (local
->ops
->update_tkip_key
)
273 local
->ops
->update_tkip_key(&local
->hw
, &sdata
->vif
, conf
,
274 ista
, iv32
, phase1key
);
275 trace_drv_return_void(local
);
278 static inline int drv_hw_scan(struct ieee80211_local
*local
,
279 struct ieee80211_sub_if_data
*sdata
,
280 struct ieee80211_scan_request
*req
)
286 if (!check_sdata_in_driver(sdata
))
289 trace_drv_hw_scan(local
, sdata
);
290 ret
= local
->ops
->hw_scan(&local
->hw
, &sdata
->vif
, req
);
291 trace_drv_return_int(local
, ret
);
295 static inline void drv_cancel_hw_scan(struct ieee80211_local
*local
,
296 struct ieee80211_sub_if_data
*sdata
)
300 if (!check_sdata_in_driver(sdata
))
303 trace_drv_cancel_hw_scan(local
, sdata
);
304 local
->ops
->cancel_hw_scan(&local
->hw
, &sdata
->vif
);
305 trace_drv_return_void(local
);
309 drv_sched_scan_start(struct ieee80211_local
*local
,
310 struct ieee80211_sub_if_data
*sdata
,
311 struct cfg80211_sched_scan_request
*req
,
312 struct ieee80211_scan_ies
*ies
)
318 if (!check_sdata_in_driver(sdata
))
321 trace_drv_sched_scan_start(local
, sdata
);
322 ret
= local
->ops
->sched_scan_start(&local
->hw
, &sdata
->vif
,
324 trace_drv_return_int(local
, ret
);
328 static inline int drv_sched_scan_stop(struct ieee80211_local
*local
,
329 struct ieee80211_sub_if_data
*sdata
)
335 if (!check_sdata_in_driver(sdata
))
338 trace_drv_sched_scan_stop(local
, sdata
);
339 ret
= local
->ops
->sched_scan_stop(&local
->hw
, &sdata
->vif
);
340 trace_drv_return_int(local
, ret
);
345 static inline void drv_sw_scan_start(struct ieee80211_local
*local
,
346 struct ieee80211_sub_if_data
*sdata
,
351 trace_drv_sw_scan_start(local
, sdata
, mac_addr
);
352 if (local
->ops
->sw_scan_start
)
353 local
->ops
->sw_scan_start(&local
->hw
, &sdata
->vif
, mac_addr
);
354 trace_drv_return_void(local
);
357 static inline void drv_sw_scan_complete(struct ieee80211_local
*local
,
358 struct ieee80211_sub_if_data
*sdata
)
362 trace_drv_sw_scan_complete(local
, sdata
);
363 if (local
->ops
->sw_scan_complete
)
364 local
->ops
->sw_scan_complete(&local
->hw
, &sdata
->vif
);
365 trace_drv_return_void(local
);
368 static inline int drv_get_stats(struct ieee80211_local
*local
,
369 struct ieee80211_low_level_stats
*stats
)
371 int ret
= -EOPNOTSUPP
;
375 if (local
->ops
->get_stats
)
376 ret
= local
->ops
->get_stats(&local
->hw
, stats
);
377 trace_drv_get_stats(local
, stats
, ret
);
382 static inline void drv_get_key_seq(struct ieee80211_local
*local
,
383 struct ieee80211_key
*key
,
384 struct ieee80211_key_seq
*seq
)
386 if (local
->ops
->get_key_seq
)
387 local
->ops
->get_key_seq(&local
->hw
, &key
->conf
, seq
);
388 trace_drv_get_key_seq(local
, &key
->conf
);
391 static inline int drv_set_frag_threshold(struct ieee80211_local
*local
,
398 trace_drv_set_frag_threshold(local
, value
);
399 if (local
->ops
->set_frag_threshold
)
400 ret
= local
->ops
->set_frag_threshold(&local
->hw
, value
);
401 trace_drv_return_int(local
, ret
);
405 static inline int drv_set_rts_threshold(struct ieee80211_local
*local
,
412 trace_drv_set_rts_threshold(local
, value
);
413 if (local
->ops
->set_rts_threshold
)
414 ret
= local
->ops
->set_rts_threshold(&local
->hw
, value
);
415 trace_drv_return_int(local
, ret
);
419 static inline int drv_set_coverage_class(struct ieee80211_local
*local
,
425 trace_drv_set_coverage_class(local
, value
);
426 if (local
->ops
->set_coverage_class
)
427 local
->ops
->set_coverage_class(&local
->hw
, value
);
431 trace_drv_return_int(local
, ret
);
435 static inline void drv_sta_notify(struct ieee80211_local
*local
,
436 struct ieee80211_sub_if_data
*sdata
,
437 enum sta_notify_cmd cmd
,
438 struct ieee80211_sta
*sta
)
440 sdata
= get_bss_sdata(sdata
);
441 if (!check_sdata_in_driver(sdata
))
444 trace_drv_sta_notify(local
, sdata
, cmd
, sta
);
445 if (local
->ops
->sta_notify
)
446 local
->ops
->sta_notify(&local
->hw
, &sdata
->vif
, cmd
, sta
);
447 trace_drv_return_void(local
);
450 static inline int drv_sta_add(struct ieee80211_local
*local
,
451 struct ieee80211_sub_if_data
*sdata
,
452 struct ieee80211_sta
*sta
)
458 sdata
= get_bss_sdata(sdata
);
459 if (!check_sdata_in_driver(sdata
))
462 trace_drv_sta_add(local
, sdata
, sta
);
463 if (local
->ops
->sta_add
)
464 ret
= local
->ops
->sta_add(&local
->hw
, &sdata
->vif
, sta
);
466 trace_drv_return_int(local
, ret
);
471 static inline void drv_sta_remove(struct ieee80211_local
*local
,
472 struct ieee80211_sub_if_data
*sdata
,
473 struct ieee80211_sta
*sta
)
477 sdata
= get_bss_sdata(sdata
);
478 if (!check_sdata_in_driver(sdata
))
481 trace_drv_sta_remove(local
, sdata
, sta
);
482 if (local
->ops
->sta_remove
)
483 local
->ops
->sta_remove(&local
->hw
, &sdata
->vif
, sta
);
485 trace_drv_return_void(local
);
488 #ifdef CONFIG_MAC80211_DEBUGFS
489 static inline void drv_sta_add_debugfs(struct ieee80211_local
*local
,
490 struct ieee80211_sub_if_data
*sdata
,
491 struct ieee80211_sta
*sta
,
496 sdata
= get_bss_sdata(sdata
);
497 if (!check_sdata_in_driver(sdata
))
500 if (local
->ops
->sta_add_debugfs
)
501 local
->ops
->sta_add_debugfs(&local
->hw
, &sdata
->vif
,
506 static inline void drv_sta_pre_rcu_remove(struct ieee80211_local
*local
,
507 struct ieee80211_sub_if_data
*sdata
,
508 struct sta_info
*sta
)
512 sdata
= get_bss_sdata(sdata
);
513 if (!check_sdata_in_driver(sdata
))
516 trace_drv_sta_pre_rcu_remove(local
, sdata
, &sta
->sta
);
517 if (local
->ops
->sta_pre_rcu_remove
)
518 local
->ops
->sta_pre_rcu_remove(&local
->hw
, &sdata
->vif
,
520 trace_drv_return_void(local
);
524 int drv_sta_state(struct ieee80211_local
*local
,
525 struct ieee80211_sub_if_data
*sdata
,
526 struct sta_info
*sta
,
527 enum ieee80211_sta_state old_state
,
528 enum ieee80211_sta_state new_state
);
530 void drv_sta_rc_update(struct ieee80211_local
*local
,
531 struct ieee80211_sub_if_data
*sdata
,
532 struct ieee80211_sta
*sta
, u32 changed
);
534 static inline void drv_sta_rate_tbl_update(struct ieee80211_local
*local
,
535 struct ieee80211_sub_if_data
*sdata
,
536 struct ieee80211_sta
*sta
)
538 sdata
= get_bss_sdata(sdata
);
539 if (!check_sdata_in_driver(sdata
))
542 trace_drv_sta_rate_tbl_update(local
, sdata
, sta
);
543 if (local
->ops
->sta_rate_tbl_update
)
544 local
->ops
->sta_rate_tbl_update(&local
->hw
, &sdata
->vif
, sta
);
546 trace_drv_return_void(local
);
549 static inline void drv_sta_statistics(struct ieee80211_local
*local
,
550 struct ieee80211_sub_if_data
*sdata
,
551 struct ieee80211_sta
*sta
,
552 struct station_info
*sinfo
)
554 sdata
= get_bss_sdata(sdata
);
555 if (!check_sdata_in_driver(sdata
))
558 trace_drv_sta_statistics(local
, sdata
, sta
);
559 if (local
->ops
->sta_statistics
)
560 local
->ops
->sta_statistics(&local
->hw
, &sdata
->vif
, sta
, sinfo
);
561 trace_drv_return_void(local
);
564 int drv_conf_tx(struct ieee80211_local
*local
,
565 struct ieee80211_sub_if_data
*sdata
, u16 ac
,
566 const struct ieee80211_tx_queue_params
*params
);
568 u64
drv_get_tsf(struct ieee80211_local
*local
,
569 struct ieee80211_sub_if_data
*sdata
);
570 void drv_set_tsf(struct ieee80211_local
*local
,
571 struct ieee80211_sub_if_data
*sdata
,
573 void drv_offset_tsf(struct ieee80211_local
*local
,
574 struct ieee80211_sub_if_data
*sdata
,
576 void drv_reset_tsf(struct ieee80211_local
*local
,
577 struct ieee80211_sub_if_data
*sdata
);
579 static inline int drv_tx_last_beacon(struct ieee80211_local
*local
)
581 int ret
= 0; /* default unsupported op for less congestion */
585 trace_drv_tx_last_beacon(local
);
586 if (local
->ops
->tx_last_beacon
)
587 ret
= local
->ops
->tx_last_beacon(&local
->hw
);
588 trace_drv_return_int(local
, ret
);
592 int drv_ampdu_action(struct ieee80211_local
*local
,
593 struct ieee80211_sub_if_data
*sdata
,
594 struct ieee80211_ampdu_params
*params
);
596 static inline int drv_get_survey(struct ieee80211_local
*local
, int idx
,
597 struct survey_info
*survey
)
599 int ret
= -EOPNOTSUPP
;
601 trace_drv_get_survey(local
, idx
, survey
);
603 if (local
->ops
->get_survey
)
604 ret
= local
->ops
->get_survey(&local
->hw
, idx
, survey
);
606 trace_drv_return_int(local
, ret
);
611 static inline void drv_rfkill_poll(struct ieee80211_local
*local
)
615 if (local
->ops
->rfkill_poll
)
616 local
->ops
->rfkill_poll(&local
->hw
);
619 static inline void drv_flush(struct ieee80211_local
*local
,
620 struct ieee80211_sub_if_data
*sdata
,
621 u32 queues
, bool drop
)
623 struct ieee80211_vif
*vif
= sdata
? &sdata
->vif
: NULL
;
627 if (sdata
&& !check_sdata_in_driver(sdata
))
630 trace_drv_flush(local
, queues
, drop
);
631 if (local
->ops
->flush
)
632 local
->ops
->flush(&local
->hw
, vif
, queues
, drop
);
633 trace_drv_return_void(local
);
636 static inline void drv_channel_switch(struct ieee80211_local
*local
,
637 struct ieee80211_sub_if_data
*sdata
,
638 struct ieee80211_channel_switch
*ch_switch
)
642 trace_drv_channel_switch(local
, sdata
, ch_switch
);
643 local
->ops
->channel_switch(&local
->hw
, &sdata
->vif
, ch_switch
);
644 trace_drv_return_void(local
);
648 static inline int drv_set_antenna(struct ieee80211_local
*local
,
649 u32 tx_ant
, u32 rx_ant
)
651 int ret
= -EOPNOTSUPP
;
653 if (local
->ops
->set_antenna
)
654 ret
= local
->ops
->set_antenna(&local
->hw
, tx_ant
, rx_ant
);
655 trace_drv_set_antenna(local
, tx_ant
, rx_ant
, ret
);
659 static inline int drv_get_antenna(struct ieee80211_local
*local
,
660 u32
*tx_ant
, u32
*rx_ant
)
662 int ret
= -EOPNOTSUPP
;
664 if (local
->ops
->get_antenna
)
665 ret
= local
->ops
->get_antenna(&local
->hw
, tx_ant
, rx_ant
);
666 trace_drv_get_antenna(local
, *tx_ant
, *rx_ant
, ret
);
670 static inline int drv_remain_on_channel(struct ieee80211_local
*local
,
671 struct ieee80211_sub_if_data
*sdata
,
672 struct ieee80211_channel
*chan
,
673 unsigned int duration
,
674 enum ieee80211_roc_type type
)
680 trace_drv_remain_on_channel(local
, sdata
, chan
, duration
, type
);
681 ret
= local
->ops
->remain_on_channel(&local
->hw
, &sdata
->vif
,
682 chan
, duration
, type
);
683 trace_drv_return_int(local
, ret
);
688 static inline int drv_cancel_remain_on_channel(struct ieee80211_local
*local
)
694 trace_drv_cancel_remain_on_channel(local
);
695 ret
= local
->ops
->cancel_remain_on_channel(&local
->hw
);
696 trace_drv_return_int(local
, ret
);
701 static inline int drv_set_ringparam(struct ieee80211_local
*local
,
708 trace_drv_set_ringparam(local
, tx
, rx
);
709 if (local
->ops
->set_ringparam
)
710 ret
= local
->ops
->set_ringparam(&local
->hw
, tx
, rx
);
711 trace_drv_return_int(local
, ret
);
716 static inline void drv_get_ringparam(struct ieee80211_local
*local
,
717 u32
*tx
, u32
*tx_max
, u32
*rx
, u32
*rx_max
)
721 trace_drv_get_ringparam(local
, tx
, tx_max
, rx
, rx_max
);
722 if (local
->ops
->get_ringparam
)
723 local
->ops
->get_ringparam(&local
->hw
, tx
, tx_max
, rx
, rx_max
);
724 trace_drv_return_void(local
);
727 static inline bool drv_tx_frames_pending(struct ieee80211_local
*local
)
733 trace_drv_tx_frames_pending(local
);
734 if (local
->ops
->tx_frames_pending
)
735 ret
= local
->ops
->tx_frames_pending(&local
->hw
);
736 trace_drv_return_bool(local
, ret
);
741 static inline int drv_set_bitrate_mask(struct ieee80211_local
*local
,
742 struct ieee80211_sub_if_data
*sdata
,
743 const struct cfg80211_bitrate_mask
*mask
)
745 int ret
= -EOPNOTSUPP
;
749 if (!check_sdata_in_driver(sdata
))
752 trace_drv_set_bitrate_mask(local
, sdata
, mask
);
753 if (local
->ops
->set_bitrate_mask
)
754 ret
= local
->ops
->set_bitrate_mask(&local
->hw
,
756 trace_drv_return_int(local
, ret
);
761 static inline void drv_set_rekey_data(struct ieee80211_local
*local
,
762 struct ieee80211_sub_if_data
*sdata
,
763 struct cfg80211_gtk_rekey_data
*data
)
765 if (!check_sdata_in_driver(sdata
))
768 trace_drv_set_rekey_data(local
, sdata
, data
);
769 if (local
->ops
->set_rekey_data
)
770 local
->ops
->set_rekey_data(&local
->hw
, &sdata
->vif
, data
);
771 trace_drv_return_void(local
);
774 static inline void drv_event_callback(struct ieee80211_local
*local
,
775 struct ieee80211_sub_if_data
*sdata
,
776 const struct ieee80211_event
*event
)
778 trace_drv_event_callback(local
, sdata
, event
);
779 if (local
->ops
->event_callback
)
780 local
->ops
->event_callback(&local
->hw
, &sdata
->vif
, event
);
781 trace_drv_return_void(local
);
785 drv_release_buffered_frames(struct ieee80211_local
*local
,
786 struct sta_info
*sta
, u16 tids
, int num_frames
,
787 enum ieee80211_frame_release_type reason
,
790 trace_drv_release_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
792 if (local
->ops
->release_buffered_frames
)
793 local
->ops
->release_buffered_frames(&local
->hw
, &sta
->sta
, tids
,
796 trace_drv_return_void(local
);
800 drv_allow_buffered_frames(struct ieee80211_local
*local
,
801 struct sta_info
*sta
, u16 tids
, int num_frames
,
802 enum ieee80211_frame_release_type reason
,
805 trace_drv_allow_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
807 if (local
->ops
->allow_buffered_frames
)
808 local
->ops
->allow_buffered_frames(&local
->hw
, &sta
->sta
,
809 tids
, num_frames
, reason
,
811 trace_drv_return_void(local
);
814 static inline void drv_mgd_prepare_tx(struct ieee80211_local
*local
,
815 struct ieee80211_sub_if_data
*sdata
)
819 if (!check_sdata_in_driver(sdata
))
821 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
823 trace_drv_mgd_prepare_tx(local
, sdata
);
824 if (local
->ops
->mgd_prepare_tx
)
825 local
->ops
->mgd_prepare_tx(&local
->hw
, &sdata
->vif
);
826 trace_drv_return_void(local
);
830 drv_mgd_protect_tdls_discover(struct ieee80211_local
*local
,
831 struct ieee80211_sub_if_data
*sdata
)
835 if (!check_sdata_in_driver(sdata
))
837 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
839 trace_drv_mgd_protect_tdls_discover(local
, sdata
);
840 if (local
->ops
->mgd_protect_tdls_discover
)
841 local
->ops
->mgd_protect_tdls_discover(&local
->hw
, &sdata
->vif
);
842 trace_drv_return_void(local
);
845 static inline int drv_add_chanctx(struct ieee80211_local
*local
,
846 struct ieee80211_chanctx
*ctx
)
848 int ret
= -EOPNOTSUPP
;
852 trace_drv_add_chanctx(local
, ctx
);
853 if (local
->ops
->add_chanctx
)
854 ret
= local
->ops
->add_chanctx(&local
->hw
, &ctx
->conf
);
855 trace_drv_return_int(local
, ret
);
857 ctx
->driver_present
= true;
862 static inline void drv_remove_chanctx(struct ieee80211_local
*local
,
863 struct ieee80211_chanctx
*ctx
)
867 if (WARN_ON(!ctx
->driver_present
))
870 trace_drv_remove_chanctx(local
, ctx
);
871 if (local
->ops
->remove_chanctx
)
872 local
->ops
->remove_chanctx(&local
->hw
, &ctx
->conf
);
873 trace_drv_return_void(local
);
874 ctx
->driver_present
= false;
877 static inline void drv_change_chanctx(struct ieee80211_local
*local
,
878 struct ieee80211_chanctx
*ctx
,
883 trace_drv_change_chanctx(local
, ctx
, changed
);
884 if (local
->ops
->change_chanctx
) {
885 WARN_ON_ONCE(!ctx
->driver_present
);
886 local
->ops
->change_chanctx(&local
->hw
, &ctx
->conf
, changed
);
888 trace_drv_return_void(local
);
891 static inline int drv_assign_vif_chanctx(struct ieee80211_local
*local
,
892 struct ieee80211_sub_if_data
*sdata
,
893 struct ieee80211_chanctx
*ctx
)
897 if (!check_sdata_in_driver(sdata
))
900 trace_drv_assign_vif_chanctx(local
, sdata
, ctx
);
901 if (local
->ops
->assign_vif_chanctx
) {
902 WARN_ON_ONCE(!ctx
->driver_present
);
903 ret
= local
->ops
->assign_vif_chanctx(&local
->hw
,
907 trace_drv_return_int(local
, ret
);
912 static inline void drv_unassign_vif_chanctx(struct ieee80211_local
*local
,
913 struct ieee80211_sub_if_data
*sdata
,
914 struct ieee80211_chanctx
*ctx
)
918 if (!check_sdata_in_driver(sdata
))
921 trace_drv_unassign_vif_chanctx(local
, sdata
, ctx
);
922 if (local
->ops
->unassign_vif_chanctx
) {
923 WARN_ON_ONCE(!ctx
->driver_present
);
924 local
->ops
->unassign_vif_chanctx(&local
->hw
,
928 trace_drv_return_void(local
);
931 int drv_switch_vif_chanctx(struct ieee80211_local
*local
,
932 struct ieee80211_vif_chanctx_switch
*vifs
,
933 int n_vifs
, enum ieee80211_chanctx_switch_mode mode
);
935 static inline int drv_start_ap(struct ieee80211_local
*local
,
936 struct ieee80211_sub_if_data
*sdata
)
942 if (!check_sdata_in_driver(sdata
))
945 trace_drv_start_ap(local
, sdata
, &sdata
->vif
.bss_conf
);
946 if (local
->ops
->start_ap
)
947 ret
= local
->ops
->start_ap(&local
->hw
, &sdata
->vif
);
948 trace_drv_return_int(local
, ret
);
952 static inline void drv_stop_ap(struct ieee80211_local
*local
,
953 struct ieee80211_sub_if_data
*sdata
)
955 if (!check_sdata_in_driver(sdata
))
958 trace_drv_stop_ap(local
, sdata
);
959 if (local
->ops
->stop_ap
)
960 local
->ops
->stop_ap(&local
->hw
, &sdata
->vif
);
961 trace_drv_return_void(local
);
965 drv_reconfig_complete(struct ieee80211_local
*local
,
966 enum ieee80211_reconfig_type reconfig_type
)
970 trace_drv_reconfig_complete(local
, reconfig_type
);
971 if (local
->ops
->reconfig_complete
)
972 local
->ops
->reconfig_complete(&local
->hw
, reconfig_type
);
973 trace_drv_return_void(local
);
977 drv_set_default_unicast_key(struct ieee80211_local
*local
,
978 struct ieee80211_sub_if_data
*sdata
,
981 if (!check_sdata_in_driver(sdata
))
984 WARN_ON_ONCE(key_idx
< -1 || key_idx
> 3);
986 trace_drv_set_default_unicast_key(local
, sdata
, key_idx
);
987 if (local
->ops
->set_default_unicast_key
)
988 local
->ops
->set_default_unicast_key(&local
->hw
, &sdata
->vif
,
990 trace_drv_return_void(local
);
993 #if IS_ENABLED(CONFIG_IPV6)
994 static inline void drv_ipv6_addr_change(struct ieee80211_local
*local
,
995 struct ieee80211_sub_if_data
*sdata
,
996 struct inet6_dev
*idev
)
998 trace_drv_ipv6_addr_change(local
, sdata
);
999 if (local
->ops
->ipv6_addr_change
)
1000 local
->ops
->ipv6_addr_change(&local
->hw
, &sdata
->vif
, idev
);
1001 trace_drv_return_void(local
);
1006 drv_channel_switch_beacon(struct ieee80211_sub_if_data
*sdata
,
1007 struct cfg80211_chan_def
*chandef
)
1009 struct ieee80211_local
*local
= sdata
->local
;
1011 if (local
->ops
->channel_switch_beacon
) {
1012 trace_drv_channel_switch_beacon(local
, sdata
, chandef
);
1013 local
->ops
->channel_switch_beacon(&local
->hw
, &sdata
->vif
,
1019 drv_pre_channel_switch(struct ieee80211_sub_if_data
*sdata
,
1020 struct ieee80211_channel_switch
*ch_switch
)
1022 struct ieee80211_local
*local
= sdata
->local
;
1025 if (!check_sdata_in_driver(sdata
))
1028 trace_drv_pre_channel_switch(local
, sdata
, ch_switch
);
1029 if (local
->ops
->pre_channel_switch
)
1030 ret
= local
->ops
->pre_channel_switch(&local
->hw
, &sdata
->vif
,
1032 trace_drv_return_int(local
, ret
);
1037 drv_post_channel_switch(struct ieee80211_sub_if_data
*sdata
)
1039 struct ieee80211_local
*local
= sdata
->local
;
1042 if (!check_sdata_in_driver(sdata
))
1045 trace_drv_post_channel_switch(local
, sdata
);
1046 if (local
->ops
->post_channel_switch
)
1047 ret
= local
->ops
->post_channel_switch(&local
->hw
, &sdata
->vif
);
1048 trace_drv_return_int(local
, ret
);
1052 static inline int drv_join_ibss(struct ieee80211_local
*local
,
1053 struct ieee80211_sub_if_data
*sdata
)
1058 if (!check_sdata_in_driver(sdata
))
1061 trace_drv_join_ibss(local
, sdata
, &sdata
->vif
.bss_conf
);
1062 if (local
->ops
->join_ibss
)
1063 ret
= local
->ops
->join_ibss(&local
->hw
, &sdata
->vif
);
1064 trace_drv_return_int(local
, ret
);
1068 static inline void drv_leave_ibss(struct ieee80211_local
*local
,
1069 struct ieee80211_sub_if_data
*sdata
)
1072 if (!check_sdata_in_driver(sdata
))
1075 trace_drv_leave_ibss(local
, sdata
);
1076 if (local
->ops
->leave_ibss
)
1077 local
->ops
->leave_ibss(&local
->hw
, &sdata
->vif
);
1078 trace_drv_return_void(local
);
1081 static inline u32
drv_get_expected_throughput(struct ieee80211_local
*local
,
1082 struct sta_info
*sta
)
1086 trace_drv_get_expected_throughput(&sta
->sta
);
1087 if (local
->ops
->get_expected_throughput
&& sta
->uploaded
)
1088 ret
= local
->ops
->get_expected_throughput(&local
->hw
, &sta
->sta
);
1089 trace_drv_return_u32(local
, ret
);
1094 static inline int drv_get_txpower(struct ieee80211_local
*local
,
1095 struct ieee80211_sub_if_data
*sdata
, int *dbm
)
1099 if (!local
->ops
->get_txpower
)
1102 ret
= local
->ops
->get_txpower(&local
->hw
, &sdata
->vif
, dbm
);
1103 trace_drv_get_txpower(local
, sdata
, *dbm
, ret
);
1109 drv_tdls_channel_switch(struct ieee80211_local
*local
,
1110 struct ieee80211_sub_if_data
*sdata
,
1111 struct ieee80211_sta
*sta
, u8 oper_class
,
1112 struct cfg80211_chan_def
*chandef
,
1113 struct sk_buff
*tmpl_skb
, u32 ch_sw_tm_ie
)
1118 if (!check_sdata_in_driver(sdata
))
1121 if (!local
->ops
->tdls_channel_switch
)
1124 trace_drv_tdls_channel_switch(local
, sdata
, sta
, oper_class
, chandef
);
1125 ret
= local
->ops
->tdls_channel_switch(&local
->hw
, &sdata
->vif
, sta
,
1126 oper_class
, chandef
, tmpl_skb
,
1128 trace_drv_return_int(local
, ret
);
1133 drv_tdls_cancel_channel_switch(struct ieee80211_local
*local
,
1134 struct ieee80211_sub_if_data
*sdata
,
1135 struct ieee80211_sta
*sta
)
1138 if (!check_sdata_in_driver(sdata
))
1141 if (!local
->ops
->tdls_cancel_channel_switch
)
1144 trace_drv_tdls_cancel_channel_switch(local
, sdata
, sta
);
1145 local
->ops
->tdls_cancel_channel_switch(&local
->hw
, &sdata
->vif
, sta
);
1146 trace_drv_return_void(local
);
1150 drv_tdls_recv_channel_switch(struct ieee80211_local
*local
,
1151 struct ieee80211_sub_if_data
*sdata
,
1152 struct ieee80211_tdls_ch_sw_params
*params
)
1154 trace_drv_tdls_recv_channel_switch(local
, sdata
, params
);
1155 if (local
->ops
->tdls_recv_channel_switch
)
1156 local
->ops
->tdls_recv_channel_switch(&local
->hw
, &sdata
->vif
,
1158 trace_drv_return_void(local
);
1161 static inline void drv_wake_tx_queue(struct ieee80211_local
*local
,
1162 struct txq_info
*txq
)
1164 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(txq
->txq
.vif
);
1166 if (!check_sdata_in_driver(sdata
))
1169 trace_drv_wake_tx_queue(local
, sdata
, txq
);
1170 local
->ops
->wake_tx_queue(&local
->hw
, &txq
->txq
);
1173 static inline int drv_start_nan(struct ieee80211_local
*local
,
1174 struct ieee80211_sub_if_data
*sdata
,
1175 struct cfg80211_nan_conf
*conf
)
1180 check_sdata_in_driver(sdata
);
1182 trace_drv_start_nan(local
, sdata
, conf
);
1183 ret
= local
->ops
->start_nan(&local
->hw
, &sdata
->vif
, conf
);
1184 trace_drv_return_int(local
, ret
);
1188 static inline void drv_stop_nan(struct ieee80211_local
*local
,
1189 struct ieee80211_sub_if_data
*sdata
)
1192 check_sdata_in_driver(sdata
);
1194 trace_drv_stop_nan(local
, sdata
);
1195 local
->ops
->stop_nan(&local
->hw
, &sdata
->vif
);
1196 trace_drv_return_void(local
);
1199 static inline int drv_nan_change_conf(struct ieee80211_local
*local
,
1200 struct ieee80211_sub_if_data
*sdata
,
1201 struct cfg80211_nan_conf
*conf
,
1207 check_sdata_in_driver(sdata
);
1209 if (!local
->ops
->nan_change_conf
)
1212 trace_drv_nan_change_conf(local
, sdata
, conf
, changes
);
1213 ret
= local
->ops
->nan_change_conf(&local
->hw
, &sdata
->vif
, conf
,
1215 trace_drv_return_int(local
, ret
);
1220 static inline int drv_add_nan_func(struct ieee80211_local
*local
,
1221 struct ieee80211_sub_if_data
*sdata
,
1222 const struct cfg80211_nan_func
*nan_func
)
1227 check_sdata_in_driver(sdata
);
1229 if (!local
->ops
->add_nan_func
)
1232 trace_drv_add_nan_func(local
, sdata
, nan_func
);
1233 ret
= local
->ops
->add_nan_func(&local
->hw
, &sdata
->vif
, nan_func
);
1234 trace_drv_return_int(local
, ret
);
1239 static inline void drv_del_nan_func(struct ieee80211_local
*local
,
1240 struct ieee80211_sub_if_data
*sdata
,
1244 check_sdata_in_driver(sdata
);
1246 trace_drv_del_nan_func(local
, sdata
, instance_id
);
1247 if (local
->ops
->del_nan_func
)
1248 local
->ops
->del_nan_func(&local
->hw
, &sdata
->vif
, instance_id
);
1249 trace_drv_return_void(local
);
1252 #endif /* __MAC80211_DRIVER_OPS */