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) &&
150 !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE))))
153 trace_drv_add_interface(local, sdata);
154 ret = local->ops->add_interface(&local->hw, &sdata->vif);
155 trace_drv_return_int(local, ret);
158 sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
163 static inline int drv_change_interface(struct ieee80211_local *local,
164 struct ieee80211_sub_if_data *sdata,
165 enum nl80211_iftype type, bool p2p)
171 check_sdata_in_driver(sdata);
173 trace_drv_change_interface(local, sdata, type, p2p);
174 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
175 trace_drv_return_int(local, ret);
179 static inline void drv_remove_interface(struct ieee80211_local *local,
180 struct ieee80211_sub_if_data *sdata)
184 check_sdata_in_driver(sdata);
186 trace_drv_remove_interface(local, sdata);
187 local->ops->remove_interface(&local->hw, &sdata->vif);
188 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
189 trace_drv_return_void(local);
192 static inline int drv_config(struct ieee80211_local *local, u32 changed)
198 trace_drv_config(local, changed);
199 ret = local->ops->config(&local->hw, changed);
200 trace_drv_return_int(local, ret);
204 static inline void drv_bss_info_changed(struct ieee80211_local *local,
205 struct ieee80211_sub_if_data *sdata,
206 struct ieee80211_bss_conf *info,
211 if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
212 BSS_CHANGED_BEACON_ENABLED) &&
213 sdata->vif.type != NL80211_IFTYPE_AP &&
214 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
215 sdata->vif.type != NL80211_IFTYPE_MESH_POINT))
218 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
219 sdata->vif.type == NL80211_IFTYPE_MONITOR))
222 check_sdata_in_driver(sdata);
224 trace_drv_bss_info_changed(local, sdata, info, changed);
225 if (local->ops->bss_info_changed)
226 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
227 trace_drv_return_void(local);
230 static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
231 struct netdev_hw_addr_list *mc_list)
235 trace_drv_prepare_multicast(local, mc_list->count);
237 if (local->ops->prepare_multicast)
238 ret = local->ops->prepare_multicast(&local->hw, mc_list);
240 trace_drv_return_u64(local, ret);
245 static inline void drv_set_multicast_list(struct ieee80211_local *local,
246 struct ieee80211_sub_if_data *sdata,
247 struct netdev_hw_addr_list *mc_list)
249 bool allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI;
251 trace_drv_set_multicast_list(local, sdata, mc_list->count);
253 check_sdata_in_driver(sdata);
255 if (local->ops->set_multicast_list)
256 local->ops->set_multicast_list(&local->hw, &sdata->vif,
258 trace_drv_return_void(local);
261 static inline void drv_configure_filter(struct ieee80211_local *local,
262 unsigned int changed_flags,
263 unsigned int *total_flags,
268 trace_drv_configure_filter(local, changed_flags, total_flags,
270 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
272 trace_drv_return_void(local);
275 static inline int drv_set_tim(struct ieee80211_local *local,
276 struct ieee80211_sta *sta, bool set)
279 trace_drv_set_tim(local, sta, set);
280 if (local->ops->set_tim)
281 ret = local->ops->set_tim(&local->hw, sta, set);
282 trace_drv_return_int(local, ret);
286 static inline int drv_set_key(struct ieee80211_local *local,
287 enum set_key_cmd cmd,
288 struct ieee80211_sub_if_data *sdata,
289 struct ieee80211_sta *sta,
290 struct ieee80211_key_conf *key)
296 sdata = get_bss_sdata(sdata);
297 check_sdata_in_driver(sdata);
299 trace_drv_set_key(local, cmd, sdata, sta, key);
300 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
301 trace_drv_return_int(local, ret);
305 static inline void drv_update_tkip_key(struct ieee80211_local *local,
306 struct ieee80211_sub_if_data *sdata,
307 struct ieee80211_key_conf *conf,
308 struct sta_info *sta, u32 iv32,
311 struct ieee80211_sta *ista = NULL;
316 sdata = get_bss_sdata(sdata);
317 check_sdata_in_driver(sdata);
319 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
320 if (local->ops->update_tkip_key)
321 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
322 ista, iv32, phase1key);
323 trace_drv_return_void(local);
326 static inline int drv_hw_scan(struct ieee80211_local *local,
327 struct ieee80211_sub_if_data *sdata,
328 struct cfg80211_scan_request *req)
334 check_sdata_in_driver(sdata);
336 trace_drv_hw_scan(local, sdata);
337 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
338 trace_drv_return_int(local, ret);
342 static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
343 struct ieee80211_sub_if_data *sdata)
347 check_sdata_in_driver(sdata);
349 trace_drv_cancel_hw_scan(local, sdata);
350 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
351 trace_drv_return_void(local);
355 drv_sched_scan_start(struct ieee80211_local *local,
356 struct ieee80211_sub_if_data *sdata,
357 struct cfg80211_sched_scan_request *req,
358 struct ieee80211_sched_scan_ies *ies)
364 check_sdata_in_driver(sdata);
366 trace_drv_sched_scan_start(local, sdata);
367 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
369 trace_drv_return_int(local, ret);
373 static inline void drv_sched_scan_stop(struct ieee80211_local *local,
374 struct ieee80211_sub_if_data *sdata)
378 check_sdata_in_driver(sdata);
380 trace_drv_sched_scan_stop(local, sdata);
381 local->ops->sched_scan_stop(&local->hw, &sdata->vif);
382 trace_drv_return_void(local);
385 static inline void drv_sw_scan_start(struct ieee80211_local *local)
389 trace_drv_sw_scan_start(local);
390 if (local->ops->sw_scan_start)
391 local->ops->sw_scan_start(&local->hw);
392 trace_drv_return_void(local);
395 static inline void drv_sw_scan_complete(struct ieee80211_local *local)
399 trace_drv_sw_scan_complete(local);
400 if (local->ops->sw_scan_complete)
401 local->ops->sw_scan_complete(&local->hw);
402 trace_drv_return_void(local);
405 static inline int drv_get_stats(struct ieee80211_local *local,
406 struct ieee80211_low_level_stats *stats)
408 int ret = -EOPNOTSUPP;
412 if (local->ops->get_stats)
413 ret = local->ops->get_stats(&local->hw, stats);
414 trace_drv_get_stats(local, stats, ret);
419 static inline void drv_get_tkip_seq(struct ieee80211_local *local,
420 u8 hw_key_idx, u32 *iv32, u16 *iv16)
422 if (local->ops->get_tkip_seq)
423 local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
424 trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
427 static inline int drv_set_frag_threshold(struct ieee80211_local *local,
434 trace_drv_set_frag_threshold(local, value);
435 if (local->ops->set_frag_threshold)
436 ret = local->ops->set_frag_threshold(&local->hw, value);
437 trace_drv_return_int(local, ret);
441 static inline int drv_set_rts_threshold(struct ieee80211_local *local,
448 trace_drv_set_rts_threshold(local, value);
449 if (local->ops->set_rts_threshold)
450 ret = local->ops->set_rts_threshold(&local->hw, value);
451 trace_drv_return_int(local, ret);
455 static inline int drv_set_coverage_class(struct ieee80211_local *local,
461 trace_drv_set_coverage_class(local, value);
462 if (local->ops->set_coverage_class)
463 local->ops->set_coverage_class(&local->hw, value);
467 trace_drv_return_int(local, ret);
471 static inline void drv_sta_notify(struct ieee80211_local *local,
472 struct ieee80211_sub_if_data *sdata,
473 enum sta_notify_cmd cmd,
474 struct ieee80211_sta *sta)
476 sdata = get_bss_sdata(sdata);
477 check_sdata_in_driver(sdata);
479 trace_drv_sta_notify(local, sdata, cmd, sta);
480 if (local->ops->sta_notify)
481 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
482 trace_drv_return_void(local);
485 static inline int drv_sta_add(struct ieee80211_local *local,
486 struct ieee80211_sub_if_data *sdata,
487 struct ieee80211_sta *sta)
493 sdata = get_bss_sdata(sdata);
494 check_sdata_in_driver(sdata);
496 trace_drv_sta_add(local, sdata, sta);
497 if (local->ops->sta_add)
498 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
500 trace_drv_return_int(local, ret);
505 static inline void drv_sta_remove(struct ieee80211_local *local,
506 struct ieee80211_sub_if_data *sdata,
507 struct ieee80211_sta *sta)
511 sdata = get_bss_sdata(sdata);
512 check_sdata_in_driver(sdata);
514 trace_drv_sta_remove(local, sdata, sta);
515 if (local->ops->sta_remove)
516 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
518 trace_drv_return_void(local);
521 #ifdef CONFIG_MAC80211_DEBUGFS
522 static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
523 struct ieee80211_sub_if_data *sdata,
524 struct ieee80211_sta *sta,
529 sdata = get_bss_sdata(sdata);
530 check_sdata_in_driver(sdata);
532 if (local->ops->sta_add_debugfs)
533 local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
537 static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
538 struct ieee80211_sub_if_data *sdata,
539 struct ieee80211_sta *sta,
544 sdata = get_bss_sdata(sdata);
545 check_sdata_in_driver(sdata);
547 if (local->ops->sta_remove_debugfs)
548 local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
553 static inline __must_check
554 int drv_sta_state(struct ieee80211_local *local,
555 struct ieee80211_sub_if_data *sdata,
556 struct sta_info *sta,
557 enum ieee80211_sta_state old_state,
558 enum ieee80211_sta_state new_state)
564 sdata = get_bss_sdata(sdata);
565 check_sdata_in_driver(sdata);
567 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
568 if (local->ops->sta_state) {
569 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
570 old_state, new_state);
571 } else if (old_state == IEEE80211_STA_AUTH &&
572 new_state == IEEE80211_STA_ASSOC) {
573 ret = drv_sta_add(local, sdata, &sta->sta);
575 sta->uploaded = true;
576 } else if (old_state == IEEE80211_STA_ASSOC &&
577 new_state == IEEE80211_STA_AUTH) {
578 drv_sta_remove(local, sdata, &sta->sta);
580 trace_drv_return_int(local, ret);
584 static inline void drv_sta_rc_update(struct ieee80211_local *local,
585 struct ieee80211_sub_if_data *sdata,
586 struct ieee80211_sta *sta, u32 changed)
588 sdata = get_bss_sdata(sdata);
589 check_sdata_in_driver(sdata);
591 WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
592 (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
593 sdata->vif.type != NL80211_IFTYPE_MESH_POINT));
595 trace_drv_sta_rc_update(local, sdata, sta, changed);
596 if (local->ops->sta_rc_update)
597 local->ops->sta_rc_update(&local->hw, &sdata->vif,
600 trace_drv_return_void(local);
603 static inline int drv_conf_tx(struct ieee80211_local *local,
604 struct ieee80211_sub_if_data *sdata, u16 ac,
605 const struct ieee80211_tx_queue_params *params)
607 int ret = -EOPNOTSUPP;
611 check_sdata_in_driver(sdata);
613 trace_drv_conf_tx(local, sdata, ac, params);
614 if (local->ops->conf_tx)
615 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
617 trace_drv_return_int(local, ret);
621 static inline u64 drv_get_tsf(struct ieee80211_local *local,
622 struct ieee80211_sub_if_data *sdata)
628 check_sdata_in_driver(sdata);
630 trace_drv_get_tsf(local, sdata);
631 if (local->ops->get_tsf)
632 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
633 trace_drv_return_u64(local, ret);
637 static inline void drv_set_tsf(struct ieee80211_local *local,
638 struct ieee80211_sub_if_data *sdata,
643 check_sdata_in_driver(sdata);
645 trace_drv_set_tsf(local, sdata, tsf);
646 if (local->ops->set_tsf)
647 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
648 trace_drv_return_void(local);
651 static inline void drv_reset_tsf(struct ieee80211_local *local,
652 struct ieee80211_sub_if_data *sdata)
656 check_sdata_in_driver(sdata);
658 trace_drv_reset_tsf(local, sdata);
659 if (local->ops->reset_tsf)
660 local->ops->reset_tsf(&local->hw, &sdata->vif);
661 trace_drv_return_void(local);
664 static inline int drv_tx_last_beacon(struct ieee80211_local *local)
666 int ret = 0; /* default unsupported op for less congestion */
670 trace_drv_tx_last_beacon(local);
671 if (local->ops->tx_last_beacon)
672 ret = local->ops->tx_last_beacon(&local->hw);
673 trace_drv_return_int(local, ret);
677 static inline int drv_ampdu_action(struct ieee80211_local *local,
678 struct ieee80211_sub_if_data *sdata,
679 enum ieee80211_ampdu_mlme_action action,
680 struct ieee80211_sta *sta, u16 tid,
681 u16 *ssn, u8 buf_size)
683 int ret = -EOPNOTSUPP;
687 sdata = get_bss_sdata(sdata);
688 check_sdata_in_driver(sdata);
690 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
692 if (local->ops->ampdu_action)
693 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
694 sta, tid, ssn, buf_size);
696 trace_drv_return_int(local, ret);
701 static inline int drv_get_survey(struct ieee80211_local *local, int idx,
702 struct survey_info *survey)
704 int ret = -EOPNOTSUPP;
706 trace_drv_get_survey(local, idx, survey);
708 if (local->ops->get_survey)
709 ret = local->ops->get_survey(&local->hw, idx, survey);
711 trace_drv_return_int(local, ret);
716 static inline void drv_rfkill_poll(struct ieee80211_local *local)
720 if (local->ops->rfkill_poll)
721 local->ops->rfkill_poll(&local->hw);
724 static inline void drv_flush(struct ieee80211_local *local,
725 u32 queues, bool drop)
729 trace_drv_flush(local, queues, drop);
730 if (local->ops->flush)
731 local->ops->flush(&local->hw, queues, drop);
732 trace_drv_return_void(local);
735 static inline void drv_channel_switch(struct ieee80211_local *local,
736 struct ieee80211_channel_switch *ch_switch)
740 trace_drv_channel_switch(local, ch_switch);
741 local->ops->channel_switch(&local->hw, ch_switch);
742 trace_drv_return_void(local);
746 static inline int drv_set_antenna(struct ieee80211_local *local,
747 u32 tx_ant, u32 rx_ant)
749 int ret = -EOPNOTSUPP;
751 if (local->ops->set_antenna)
752 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
753 trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
757 static inline int drv_get_antenna(struct ieee80211_local *local,
758 u32 *tx_ant, u32 *rx_ant)
760 int ret = -EOPNOTSUPP;
762 if (local->ops->get_antenna)
763 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
764 trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
768 static inline int drv_remain_on_channel(struct ieee80211_local *local,
769 struct ieee80211_sub_if_data *sdata,
770 struct ieee80211_channel *chan,
771 unsigned int duration,
772 enum ieee80211_roc_type type)
778 trace_drv_remain_on_channel(local, sdata, chan, duration, type);
779 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
780 chan, duration, type);
781 trace_drv_return_int(local, ret);
786 static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
792 trace_drv_cancel_remain_on_channel(local);
793 ret = local->ops->cancel_remain_on_channel(&local->hw);
794 trace_drv_return_int(local, ret);
799 static inline int drv_set_ringparam(struct ieee80211_local *local,
806 trace_drv_set_ringparam(local, tx, rx);
807 if (local->ops->set_ringparam)
808 ret = local->ops->set_ringparam(&local->hw, tx, rx);
809 trace_drv_return_int(local, ret);
814 static inline void drv_get_ringparam(struct ieee80211_local *local,
815 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
819 trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
820 if (local->ops->get_ringparam)
821 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
822 trace_drv_return_void(local);
825 static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
831 trace_drv_tx_frames_pending(local);
832 if (local->ops->tx_frames_pending)
833 ret = local->ops->tx_frames_pending(&local->hw);
834 trace_drv_return_bool(local, ret);
839 static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
840 struct ieee80211_sub_if_data *sdata,
841 const struct cfg80211_bitrate_mask *mask)
843 int ret = -EOPNOTSUPP;
847 check_sdata_in_driver(sdata);
849 trace_drv_set_bitrate_mask(local, sdata, mask);
850 if (local->ops->set_bitrate_mask)
851 ret = local->ops->set_bitrate_mask(&local->hw,
853 trace_drv_return_int(local, ret);
858 static inline void drv_set_rekey_data(struct ieee80211_local *local,
859 struct ieee80211_sub_if_data *sdata,
860 struct cfg80211_gtk_rekey_data *data)
862 check_sdata_in_driver(sdata);
864 trace_drv_set_rekey_data(local, sdata, data);
865 if (local->ops->set_rekey_data)
866 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
867 trace_drv_return_void(local);
870 static inline void drv_rssi_callback(struct ieee80211_local *local,
871 struct ieee80211_sub_if_data *sdata,
872 const enum ieee80211_rssi_event event)
874 trace_drv_rssi_callback(local, sdata, event);
875 if (local->ops->rssi_callback)
876 local->ops->rssi_callback(&local->hw, &sdata->vif, event);
877 trace_drv_return_void(local);
881 drv_release_buffered_frames(struct ieee80211_local *local,
882 struct sta_info *sta, u16 tids, int num_frames,
883 enum ieee80211_frame_release_type reason,
886 trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
888 if (local->ops->release_buffered_frames)
889 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
892 trace_drv_return_void(local);
896 drv_allow_buffered_frames(struct ieee80211_local *local,
897 struct sta_info *sta, u16 tids, int num_frames,
898 enum ieee80211_frame_release_type reason,
901 trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
903 if (local->ops->allow_buffered_frames)
904 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
905 tids, num_frames, reason,
907 trace_drv_return_void(local);
910 static inline int drv_get_rssi(struct ieee80211_local *local,
911 struct ieee80211_sub_if_data *sdata,
912 struct ieee80211_sta *sta,
919 ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm);
920 trace_drv_get_rssi(local, sta, *rssi_dbm, ret);
925 static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
926 struct ieee80211_sub_if_data *sdata)
930 check_sdata_in_driver(sdata);
931 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
933 trace_drv_mgd_prepare_tx(local, sdata);
934 if (local->ops->mgd_prepare_tx)
935 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
936 trace_drv_return_void(local);
939 static inline int drv_add_chanctx(struct ieee80211_local *local,
940 struct ieee80211_chanctx *ctx)
942 int ret = -EOPNOTSUPP;
944 trace_drv_add_chanctx(local, ctx);
945 if (local->ops->add_chanctx)
946 ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
947 trace_drv_return_int(local, ret);
949 ctx->driver_present = true;
954 static inline void drv_remove_chanctx(struct ieee80211_local *local,
955 struct ieee80211_chanctx *ctx)
957 trace_drv_remove_chanctx(local, ctx);
958 if (local->ops->remove_chanctx)
959 local->ops->remove_chanctx(&local->hw, &ctx->conf);
960 trace_drv_return_void(local);
961 ctx->driver_present = false;
964 static inline void drv_change_chanctx(struct ieee80211_local *local,
965 struct ieee80211_chanctx *ctx,
968 trace_drv_change_chanctx(local, ctx, changed);
969 if (local->ops->change_chanctx) {
970 WARN_ON_ONCE(!ctx->driver_present);
971 local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
973 trace_drv_return_void(local);
976 static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
977 struct ieee80211_sub_if_data *sdata,
978 struct ieee80211_chanctx *ctx)
982 check_sdata_in_driver(sdata);
984 trace_drv_assign_vif_chanctx(local, sdata, ctx);
985 if (local->ops->assign_vif_chanctx) {
986 WARN_ON_ONCE(!ctx->driver_present);
987 ret = local->ops->assign_vif_chanctx(&local->hw,
991 trace_drv_return_int(local, ret);
996 static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
997 struct ieee80211_sub_if_data *sdata,
998 struct ieee80211_chanctx *ctx)
1000 check_sdata_in_driver(sdata);
1002 trace_drv_unassign_vif_chanctx(local, sdata, ctx);
1003 if (local->ops->unassign_vif_chanctx) {
1004 WARN_ON_ONCE(!ctx->driver_present);
1005 local->ops->unassign_vif_chanctx(&local->hw,
1009 trace_drv_return_void(local);
1012 static inline int drv_start_ap(struct ieee80211_local *local,
1013 struct ieee80211_sub_if_data *sdata)
1017 check_sdata_in_driver(sdata);
1019 trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
1020 if (local->ops->start_ap)
1021 ret = local->ops->start_ap(&local->hw, &sdata->vif);
1022 trace_drv_return_int(local, ret);
1026 static inline void drv_stop_ap(struct ieee80211_local *local,
1027 struct ieee80211_sub_if_data *sdata)
1029 check_sdata_in_driver(sdata);
1031 trace_drv_stop_ap(local, sdata);
1032 if (local->ops->stop_ap)
1033 local->ops->stop_ap(&local->hw, &sdata->vif);
1034 trace_drv_return_void(local);
1037 static inline void drv_restart_complete(struct ieee80211_local *local)
1041 trace_drv_restart_complete(local);
1042 if (local->ops->restart_complete)
1043 local->ops->restart_complete(&local->hw);
1044 trace_drv_return_void(local);
1048 drv_set_default_unicast_key(struct ieee80211_local *local,
1049 struct ieee80211_sub_if_data *sdata,
1052 check_sdata_in_driver(sdata);
1054 WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
1056 trace_drv_set_default_unicast_key(local, sdata, key_idx);
1057 if (local->ops->set_default_unicast_key)
1058 local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
1060 trace_drv_return_void(local);
1063 #if IS_ENABLED(CONFIG_IPV6)
1064 static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
1065 struct ieee80211_sub_if_data *sdata,
1066 struct inet6_dev *idev)
1068 trace_drv_ipv6_addr_change(local, sdata);
1069 if (local->ops->ipv6_addr_change)
1070 local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
1071 trace_drv_return_void(local);
1075 #endif /* __MAC80211_DRIVER_OPS */