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 if (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))
217 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
218 sdata->vif.type == NL80211_IFTYPE_MONITOR))
221 check_sdata_in_driver(sdata);
223 trace_drv_bss_info_changed(local, sdata, info, changed);
224 if (local->ops->bss_info_changed)
225 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
226 trace_drv_return_void(local);
229 static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
230 struct netdev_hw_addr_list *mc_list)
234 trace_drv_prepare_multicast(local, mc_list->count);
236 if (local->ops->prepare_multicast)
237 ret = local->ops->prepare_multicast(&local->hw, mc_list);
239 trace_drv_return_u64(local, ret);
244 static inline void drv_set_multicast_list(struct ieee80211_local *local,
245 struct ieee80211_sub_if_data *sdata,
246 struct netdev_hw_addr_list *mc_list)
248 bool allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI;
250 trace_drv_set_multicast_list(local, sdata, mc_list->count);
252 check_sdata_in_driver(sdata);
254 if (local->ops->set_multicast_list)
255 local->ops->set_multicast_list(&local->hw, &sdata->vif,
257 trace_drv_return_void(local);
260 static inline void drv_configure_filter(struct ieee80211_local *local,
261 unsigned int changed_flags,
262 unsigned int *total_flags,
267 trace_drv_configure_filter(local, changed_flags, total_flags,
269 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
271 trace_drv_return_void(local);
274 static inline int drv_set_tim(struct ieee80211_local *local,
275 struct ieee80211_sta *sta, bool set)
278 trace_drv_set_tim(local, sta, set);
279 if (local->ops->set_tim)
280 ret = local->ops->set_tim(&local->hw, sta, set);
281 trace_drv_return_int(local, ret);
285 static inline int drv_set_key(struct ieee80211_local *local,
286 enum set_key_cmd cmd,
287 struct ieee80211_sub_if_data *sdata,
288 struct ieee80211_sta *sta,
289 struct ieee80211_key_conf *key)
295 sdata = get_bss_sdata(sdata);
296 check_sdata_in_driver(sdata);
298 trace_drv_set_key(local, cmd, sdata, sta, key);
299 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
300 trace_drv_return_int(local, ret);
304 static inline void drv_update_tkip_key(struct ieee80211_local *local,
305 struct ieee80211_sub_if_data *sdata,
306 struct ieee80211_key_conf *conf,
307 struct sta_info *sta, u32 iv32,
310 struct ieee80211_sta *ista = NULL;
315 sdata = get_bss_sdata(sdata);
316 check_sdata_in_driver(sdata);
318 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
319 if (local->ops->update_tkip_key)
320 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
321 ista, iv32, phase1key);
322 trace_drv_return_void(local);
325 static inline int drv_hw_scan(struct ieee80211_local *local,
326 struct ieee80211_sub_if_data *sdata,
327 struct cfg80211_scan_request *req)
333 check_sdata_in_driver(sdata);
335 trace_drv_hw_scan(local, sdata);
336 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
337 trace_drv_return_int(local, ret);
341 static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
342 struct ieee80211_sub_if_data *sdata)
346 check_sdata_in_driver(sdata);
348 trace_drv_cancel_hw_scan(local, sdata);
349 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
350 trace_drv_return_void(local);
354 drv_sched_scan_start(struct ieee80211_local *local,
355 struct ieee80211_sub_if_data *sdata,
356 struct cfg80211_sched_scan_request *req,
357 struct ieee80211_sched_scan_ies *ies)
363 check_sdata_in_driver(sdata);
365 trace_drv_sched_scan_start(local, sdata);
366 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
368 trace_drv_return_int(local, ret);
372 static inline void drv_sched_scan_stop(struct ieee80211_local *local,
373 struct ieee80211_sub_if_data *sdata)
377 check_sdata_in_driver(sdata);
379 trace_drv_sched_scan_stop(local, sdata);
380 local->ops->sched_scan_stop(&local->hw, &sdata->vif);
381 trace_drv_return_void(local);
384 static inline void drv_sw_scan_start(struct ieee80211_local *local)
388 trace_drv_sw_scan_start(local);
389 if (local->ops->sw_scan_start)
390 local->ops->sw_scan_start(&local->hw);
391 trace_drv_return_void(local);
394 static inline void drv_sw_scan_complete(struct ieee80211_local *local)
398 trace_drv_sw_scan_complete(local);
399 if (local->ops->sw_scan_complete)
400 local->ops->sw_scan_complete(&local->hw);
401 trace_drv_return_void(local);
404 static inline int drv_get_stats(struct ieee80211_local *local,
405 struct ieee80211_low_level_stats *stats)
407 int ret = -EOPNOTSUPP;
411 if (local->ops->get_stats)
412 ret = local->ops->get_stats(&local->hw, stats);
413 trace_drv_get_stats(local, stats, ret);
418 static inline void drv_get_tkip_seq(struct ieee80211_local *local,
419 u8 hw_key_idx, u32 *iv32, u16 *iv16)
421 if (local->ops->get_tkip_seq)
422 local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
423 trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
426 static inline int drv_set_frag_threshold(struct ieee80211_local *local,
433 trace_drv_set_frag_threshold(local, value);
434 if (local->ops->set_frag_threshold)
435 ret = local->ops->set_frag_threshold(&local->hw, value);
436 trace_drv_return_int(local, ret);
440 static inline int drv_set_rts_threshold(struct ieee80211_local *local,
447 trace_drv_set_rts_threshold(local, value);
448 if (local->ops->set_rts_threshold)
449 ret = local->ops->set_rts_threshold(&local->hw, value);
450 trace_drv_return_int(local, ret);
454 static inline int drv_set_coverage_class(struct ieee80211_local *local,
460 trace_drv_set_coverage_class(local, value);
461 if (local->ops->set_coverage_class)
462 local->ops->set_coverage_class(&local->hw, value);
466 trace_drv_return_int(local, ret);
470 static inline void drv_sta_notify(struct ieee80211_local *local,
471 struct ieee80211_sub_if_data *sdata,
472 enum sta_notify_cmd cmd,
473 struct ieee80211_sta *sta)
475 sdata = get_bss_sdata(sdata);
476 check_sdata_in_driver(sdata);
478 trace_drv_sta_notify(local, sdata, cmd, sta);
479 if (local->ops->sta_notify)
480 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
481 trace_drv_return_void(local);
484 static inline int drv_sta_add(struct ieee80211_local *local,
485 struct ieee80211_sub_if_data *sdata,
486 struct ieee80211_sta *sta)
492 sdata = get_bss_sdata(sdata);
493 check_sdata_in_driver(sdata);
495 trace_drv_sta_add(local, sdata, sta);
496 if (local->ops->sta_add)
497 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
499 trace_drv_return_int(local, ret);
504 static inline void drv_sta_remove(struct ieee80211_local *local,
505 struct ieee80211_sub_if_data *sdata,
506 struct ieee80211_sta *sta)
510 sdata = get_bss_sdata(sdata);
511 check_sdata_in_driver(sdata);
513 trace_drv_sta_remove(local, sdata, sta);
514 if (local->ops->sta_remove)
515 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
517 trace_drv_return_void(local);
520 #ifdef CONFIG_MAC80211_DEBUGFS
521 static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
522 struct ieee80211_sub_if_data *sdata,
523 struct ieee80211_sta *sta,
528 sdata = get_bss_sdata(sdata);
529 check_sdata_in_driver(sdata);
531 if (local->ops->sta_add_debugfs)
532 local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
536 static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
537 struct ieee80211_sub_if_data *sdata,
538 struct ieee80211_sta *sta,
543 sdata = get_bss_sdata(sdata);
544 check_sdata_in_driver(sdata);
546 if (local->ops->sta_remove_debugfs)
547 local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
552 void drv_add_interface_debugfs(struct ieee80211_local *local,
553 struct ieee80211_sub_if_data *sdata)
557 check_sdata_in_driver(sdata);
559 if (!local->ops->add_interface_debugfs)
562 local->ops->add_interface_debugfs(&local->hw, &sdata->vif,
563 sdata->vif.debugfs_dir);
567 void drv_remove_interface_debugfs(struct ieee80211_local *local,
568 struct ieee80211_sub_if_data *sdata)
572 check_sdata_in_driver(sdata);
574 if (!local->ops->remove_interface_debugfs)
577 local->ops->remove_interface_debugfs(&local->hw, &sdata->vif,
578 sdata->vif.debugfs_dir);
582 void drv_add_interface_debugfs(struct ieee80211_local *local,
583 struct ieee80211_sub_if_data *sdata) {}
585 void drv_remove_interface_debugfs(struct ieee80211_local *local,
586 struct ieee80211_sub_if_data *sdata) {}
589 static inline __must_check
590 int drv_sta_state(struct ieee80211_local *local,
591 struct ieee80211_sub_if_data *sdata,
592 struct sta_info *sta,
593 enum ieee80211_sta_state old_state,
594 enum ieee80211_sta_state new_state)
600 sdata = get_bss_sdata(sdata);
601 check_sdata_in_driver(sdata);
603 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
604 if (local->ops->sta_state) {
605 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
606 old_state, new_state);
607 } else if (old_state == IEEE80211_STA_AUTH &&
608 new_state == IEEE80211_STA_ASSOC) {
609 ret = drv_sta_add(local, sdata, &sta->sta);
611 sta->uploaded = true;
612 } else if (old_state == IEEE80211_STA_ASSOC &&
613 new_state == IEEE80211_STA_AUTH) {
614 drv_sta_remove(local, sdata, &sta->sta);
616 trace_drv_return_int(local, ret);
620 static inline void drv_sta_rc_update(struct ieee80211_local *local,
621 struct ieee80211_sub_if_data *sdata,
622 struct ieee80211_sta *sta, u32 changed)
624 sdata = get_bss_sdata(sdata);
625 check_sdata_in_driver(sdata);
627 WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
628 (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
629 sdata->vif.type != NL80211_IFTYPE_MESH_POINT));
631 trace_drv_sta_rc_update(local, sdata, sta, changed);
632 if (local->ops->sta_rc_update)
633 local->ops->sta_rc_update(&local->hw, &sdata->vif,
636 trace_drv_return_void(local);
639 static inline int drv_conf_tx(struct ieee80211_local *local,
640 struct ieee80211_sub_if_data *sdata, u16 ac,
641 const struct ieee80211_tx_queue_params *params)
643 int ret = -EOPNOTSUPP;
647 check_sdata_in_driver(sdata);
649 trace_drv_conf_tx(local, sdata, ac, params);
650 if (local->ops->conf_tx)
651 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
653 trace_drv_return_int(local, ret);
657 static inline u64 drv_get_tsf(struct ieee80211_local *local,
658 struct ieee80211_sub_if_data *sdata)
664 check_sdata_in_driver(sdata);
666 trace_drv_get_tsf(local, sdata);
667 if (local->ops->get_tsf)
668 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
669 trace_drv_return_u64(local, ret);
673 static inline void drv_set_tsf(struct ieee80211_local *local,
674 struct ieee80211_sub_if_data *sdata,
679 check_sdata_in_driver(sdata);
681 trace_drv_set_tsf(local, sdata, tsf);
682 if (local->ops->set_tsf)
683 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
684 trace_drv_return_void(local);
687 static inline void drv_reset_tsf(struct ieee80211_local *local,
688 struct ieee80211_sub_if_data *sdata)
692 check_sdata_in_driver(sdata);
694 trace_drv_reset_tsf(local, sdata);
695 if (local->ops->reset_tsf)
696 local->ops->reset_tsf(&local->hw, &sdata->vif);
697 trace_drv_return_void(local);
700 static inline int drv_tx_last_beacon(struct ieee80211_local *local)
702 int ret = 0; /* default unsupported op for less congestion */
706 trace_drv_tx_last_beacon(local);
707 if (local->ops->tx_last_beacon)
708 ret = local->ops->tx_last_beacon(&local->hw);
709 trace_drv_return_int(local, ret);
713 static inline int drv_ampdu_action(struct ieee80211_local *local,
714 struct ieee80211_sub_if_data *sdata,
715 enum ieee80211_ampdu_mlme_action action,
716 struct ieee80211_sta *sta, u16 tid,
717 u16 *ssn, u8 buf_size)
719 int ret = -EOPNOTSUPP;
723 sdata = get_bss_sdata(sdata);
724 check_sdata_in_driver(sdata);
726 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
728 if (local->ops->ampdu_action)
729 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
730 sta, tid, ssn, buf_size);
732 trace_drv_return_int(local, ret);
737 static inline int drv_get_survey(struct ieee80211_local *local, int idx,
738 struct survey_info *survey)
740 int ret = -EOPNOTSUPP;
742 trace_drv_get_survey(local, idx, survey);
744 if (local->ops->get_survey)
745 ret = local->ops->get_survey(&local->hw, idx, survey);
747 trace_drv_return_int(local, ret);
752 static inline void drv_rfkill_poll(struct ieee80211_local *local)
756 if (local->ops->rfkill_poll)
757 local->ops->rfkill_poll(&local->hw);
760 static inline void drv_flush(struct ieee80211_local *local, bool drop)
764 trace_drv_flush(local, drop);
765 if (local->ops->flush)
766 local->ops->flush(&local->hw, drop);
767 trace_drv_return_void(local);
770 static inline void drv_channel_switch(struct ieee80211_local *local,
771 struct ieee80211_channel_switch *ch_switch)
775 trace_drv_channel_switch(local, ch_switch);
776 local->ops->channel_switch(&local->hw, ch_switch);
777 trace_drv_return_void(local);
781 static inline int drv_set_antenna(struct ieee80211_local *local,
782 u32 tx_ant, u32 rx_ant)
784 int ret = -EOPNOTSUPP;
786 if (local->ops->set_antenna)
787 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
788 trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
792 static inline int drv_get_antenna(struct ieee80211_local *local,
793 u32 *tx_ant, u32 *rx_ant)
795 int ret = -EOPNOTSUPP;
797 if (local->ops->get_antenna)
798 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
799 trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
803 static inline int drv_remain_on_channel(struct ieee80211_local *local,
804 struct ieee80211_sub_if_data *sdata,
805 struct ieee80211_channel *chan,
806 unsigned int duration,
807 enum ieee80211_roc_type type)
813 trace_drv_remain_on_channel(local, sdata, chan, duration, type);
814 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
815 chan, duration, type);
816 trace_drv_return_int(local, ret);
821 static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
827 trace_drv_cancel_remain_on_channel(local);
828 ret = local->ops->cancel_remain_on_channel(&local->hw);
829 trace_drv_return_int(local, ret);
834 static inline int drv_set_ringparam(struct ieee80211_local *local,
841 trace_drv_set_ringparam(local, tx, rx);
842 if (local->ops->set_ringparam)
843 ret = local->ops->set_ringparam(&local->hw, tx, rx);
844 trace_drv_return_int(local, ret);
849 static inline void drv_get_ringparam(struct ieee80211_local *local,
850 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
854 trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
855 if (local->ops->get_ringparam)
856 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
857 trace_drv_return_void(local);
860 static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
866 trace_drv_tx_frames_pending(local);
867 if (local->ops->tx_frames_pending)
868 ret = local->ops->tx_frames_pending(&local->hw);
869 trace_drv_return_bool(local, ret);
874 static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
875 struct ieee80211_sub_if_data *sdata,
876 const struct cfg80211_bitrate_mask *mask)
878 int ret = -EOPNOTSUPP;
882 check_sdata_in_driver(sdata);
884 trace_drv_set_bitrate_mask(local, sdata, mask);
885 if (local->ops->set_bitrate_mask)
886 ret = local->ops->set_bitrate_mask(&local->hw,
888 trace_drv_return_int(local, ret);
893 static inline void drv_set_rekey_data(struct ieee80211_local *local,
894 struct ieee80211_sub_if_data *sdata,
895 struct cfg80211_gtk_rekey_data *data)
897 check_sdata_in_driver(sdata);
899 trace_drv_set_rekey_data(local, sdata, data);
900 if (local->ops->set_rekey_data)
901 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
902 trace_drv_return_void(local);
905 static inline void drv_rssi_callback(struct ieee80211_local *local,
906 struct ieee80211_sub_if_data *sdata,
907 const enum ieee80211_rssi_event event)
909 trace_drv_rssi_callback(local, sdata, event);
910 if (local->ops->rssi_callback)
911 local->ops->rssi_callback(&local->hw, &sdata->vif, event);
912 trace_drv_return_void(local);
916 drv_release_buffered_frames(struct ieee80211_local *local,
917 struct sta_info *sta, u16 tids, int num_frames,
918 enum ieee80211_frame_release_type reason,
921 trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
923 if (local->ops->release_buffered_frames)
924 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
927 trace_drv_return_void(local);
931 drv_allow_buffered_frames(struct ieee80211_local *local,
932 struct sta_info *sta, u16 tids, int num_frames,
933 enum ieee80211_frame_release_type reason,
936 trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
938 if (local->ops->allow_buffered_frames)
939 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
940 tids, num_frames, reason,
942 trace_drv_return_void(local);
945 static inline int drv_get_rssi(struct ieee80211_local *local,
946 struct ieee80211_sub_if_data *sdata,
947 struct ieee80211_sta *sta,
954 ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm);
955 trace_drv_get_rssi(local, sta, *rssi_dbm, ret);
960 static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
961 struct ieee80211_sub_if_data *sdata)
965 check_sdata_in_driver(sdata);
966 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
968 trace_drv_mgd_prepare_tx(local, sdata);
969 if (local->ops->mgd_prepare_tx)
970 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
971 trace_drv_return_void(local);
974 static inline int drv_add_chanctx(struct ieee80211_local *local,
975 struct ieee80211_chanctx *ctx)
977 int ret = -EOPNOTSUPP;
979 trace_drv_add_chanctx(local, ctx);
980 if (local->ops->add_chanctx)
981 ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
982 trace_drv_return_int(local, ret);
984 ctx->driver_present = true;
989 static inline void drv_remove_chanctx(struct ieee80211_local *local,
990 struct ieee80211_chanctx *ctx)
992 trace_drv_remove_chanctx(local, ctx);
993 if (local->ops->remove_chanctx)
994 local->ops->remove_chanctx(&local->hw, &ctx->conf);
995 trace_drv_return_void(local);
996 ctx->driver_present = false;
999 static inline void drv_change_chanctx(struct ieee80211_local *local,
1000 struct ieee80211_chanctx *ctx,
1003 trace_drv_change_chanctx(local, ctx, changed);
1004 if (local->ops->change_chanctx) {
1005 WARN_ON_ONCE(!ctx->driver_present);
1006 local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
1008 trace_drv_return_void(local);
1011 static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
1012 struct ieee80211_sub_if_data *sdata,
1013 struct ieee80211_chanctx *ctx)
1017 check_sdata_in_driver(sdata);
1019 trace_drv_assign_vif_chanctx(local, sdata, ctx);
1020 if (local->ops->assign_vif_chanctx) {
1021 WARN_ON_ONCE(!ctx->driver_present);
1022 ret = local->ops->assign_vif_chanctx(&local->hw,
1026 trace_drv_return_int(local, ret);
1031 static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
1032 struct ieee80211_sub_if_data *sdata,
1033 struct ieee80211_chanctx *ctx)
1035 check_sdata_in_driver(sdata);
1037 trace_drv_unassign_vif_chanctx(local, sdata, ctx);
1038 if (local->ops->unassign_vif_chanctx) {
1039 WARN_ON_ONCE(!ctx->driver_present);
1040 local->ops->unassign_vif_chanctx(&local->hw,
1044 trace_drv_return_void(local);
1047 static inline int drv_start_ap(struct ieee80211_local *local,
1048 struct ieee80211_sub_if_data *sdata)
1052 check_sdata_in_driver(sdata);
1054 trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
1055 if (local->ops->start_ap)
1056 ret = local->ops->start_ap(&local->hw, &sdata->vif);
1057 trace_drv_return_int(local, ret);
1061 static inline void drv_stop_ap(struct ieee80211_local *local,
1062 struct ieee80211_sub_if_data *sdata)
1064 check_sdata_in_driver(sdata);
1066 trace_drv_stop_ap(local, sdata);
1067 if (local->ops->stop_ap)
1068 local->ops->stop_ap(&local->hw, &sdata->vif);
1069 trace_drv_return_void(local);
1072 static inline void drv_restart_complete(struct ieee80211_local *local)
1076 trace_drv_restart_complete(local);
1077 if (local->ops->restart_complete)
1078 local->ops->restart_complete(&local->hw);
1079 trace_drv_return_void(local);
1083 drv_set_default_unicast_key(struct ieee80211_local *local,
1084 struct ieee80211_sub_if_data *sdata,
1087 check_sdata_in_driver(sdata);
1089 WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
1091 trace_drv_set_default_unicast_key(local, sdata, key_idx);
1092 if (local->ops->set_default_unicast_key)
1093 local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
1095 trace_drv_return_void(local);
1098 #if IS_ENABLED(CONFIG_IPV6)
1099 static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
1100 struct ieee80211_sub_if_data *sdata,
1101 struct inet6_dev *idev)
1103 trace_drv_ipv6_addr_change(local, sdata);
1104 if (local->ops->ipv6_addr_change)
1105 local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
1106 trace_drv_return_void(local);
1110 #endif /* __MAC80211_DRIVER_OPS */