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 &&
166 !sdata->vif.mu_mimo_owner)))
169 if (!check_sdata_in_driver(sdata))
172 trace_drv_bss_info_changed(local, sdata, info, changed);
173 if (local->ops->bss_info_changed)
174 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
175 trace_drv_return_void(local);
178 static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
179 struct netdev_hw_addr_list *mc_list)
183 trace_drv_prepare_multicast(local, mc_list->count);
185 if (local->ops->prepare_multicast)
186 ret = local->ops->prepare_multicast(&local->hw, mc_list);
188 trace_drv_return_u64(local, ret);
193 static inline void drv_configure_filter(struct ieee80211_local *local,
194 unsigned int changed_flags,
195 unsigned int *total_flags,
200 trace_drv_configure_filter(local, changed_flags, total_flags,
202 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
204 trace_drv_return_void(local);
207 static inline void drv_config_iface_filter(struct ieee80211_local *local,
208 struct ieee80211_sub_if_data *sdata,
209 unsigned int filter_flags,
210 unsigned int changed_flags)
214 trace_drv_config_iface_filter(local, sdata, filter_flags,
216 if (local->ops->config_iface_filter)
217 local->ops->config_iface_filter(&local->hw, &sdata->vif,
220 trace_drv_return_void(local);
223 static inline int drv_set_tim(struct ieee80211_local *local,
224 struct ieee80211_sta *sta, bool set)
227 trace_drv_set_tim(local, sta, set);
228 if (local->ops->set_tim)
229 ret = local->ops->set_tim(&local->hw, sta, set);
230 trace_drv_return_int(local, ret);
234 static inline int drv_set_key(struct ieee80211_local *local,
235 enum set_key_cmd cmd,
236 struct ieee80211_sub_if_data *sdata,
237 struct ieee80211_sta *sta,
238 struct ieee80211_key_conf *key)
244 sdata = get_bss_sdata(sdata);
245 if (!check_sdata_in_driver(sdata))
248 trace_drv_set_key(local, cmd, sdata, sta, key);
249 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
250 trace_drv_return_int(local, ret);
254 static inline void drv_update_tkip_key(struct ieee80211_local *local,
255 struct ieee80211_sub_if_data *sdata,
256 struct ieee80211_key_conf *conf,
257 struct sta_info *sta, u32 iv32,
260 struct ieee80211_sta *ista = NULL;
265 sdata = get_bss_sdata(sdata);
266 if (!check_sdata_in_driver(sdata))
269 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
270 if (local->ops->update_tkip_key)
271 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
272 ista, iv32, phase1key);
273 trace_drv_return_void(local);
276 static inline int drv_hw_scan(struct ieee80211_local *local,
277 struct ieee80211_sub_if_data *sdata,
278 struct ieee80211_scan_request *req)
284 if (!check_sdata_in_driver(sdata))
287 trace_drv_hw_scan(local, sdata);
288 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
289 trace_drv_return_int(local, ret);
293 static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
294 struct ieee80211_sub_if_data *sdata)
298 if (!check_sdata_in_driver(sdata))
301 trace_drv_cancel_hw_scan(local, sdata);
302 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
303 trace_drv_return_void(local);
307 drv_sched_scan_start(struct ieee80211_local *local,
308 struct ieee80211_sub_if_data *sdata,
309 struct cfg80211_sched_scan_request *req,
310 struct ieee80211_scan_ies *ies)
316 if (!check_sdata_in_driver(sdata))
319 trace_drv_sched_scan_start(local, sdata);
320 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
322 trace_drv_return_int(local, ret);
326 static inline int drv_sched_scan_stop(struct ieee80211_local *local,
327 struct ieee80211_sub_if_data *sdata)
333 if (!check_sdata_in_driver(sdata))
336 trace_drv_sched_scan_stop(local, sdata);
337 ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif);
338 trace_drv_return_int(local, ret);
343 static inline void drv_sw_scan_start(struct ieee80211_local *local,
344 struct ieee80211_sub_if_data *sdata,
349 trace_drv_sw_scan_start(local, sdata, mac_addr);
350 if (local->ops->sw_scan_start)
351 local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
352 trace_drv_return_void(local);
355 static inline void drv_sw_scan_complete(struct ieee80211_local *local,
356 struct ieee80211_sub_if_data *sdata)
360 trace_drv_sw_scan_complete(local, sdata);
361 if (local->ops->sw_scan_complete)
362 local->ops->sw_scan_complete(&local->hw, &sdata->vif);
363 trace_drv_return_void(local);
366 static inline int drv_get_stats(struct ieee80211_local *local,
367 struct ieee80211_low_level_stats *stats)
369 int ret = -EOPNOTSUPP;
373 if (local->ops->get_stats)
374 ret = local->ops->get_stats(&local->hw, stats);
375 trace_drv_get_stats(local, stats, ret);
380 static inline void drv_get_key_seq(struct ieee80211_local *local,
381 struct ieee80211_key *key,
382 struct ieee80211_key_seq *seq)
384 if (local->ops->get_key_seq)
385 local->ops->get_key_seq(&local->hw, &key->conf, seq);
386 trace_drv_get_key_seq(local, &key->conf);
389 static inline int drv_set_frag_threshold(struct ieee80211_local *local,
396 trace_drv_set_frag_threshold(local, value);
397 if (local->ops->set_frag_threshold)
398 ret = local->ops->set_frag_threshold(&local->hw, value);
399 trace_drv_return_int(local, ret);
403 static inline int drv_set_rts_threshold(struct ieee80211_local *local,
410 trace_drv_set_rts_threshold(local, value);
411 if (local->ops->set_rts_threshold)
412 ret = local->ops->set_rts_threshold(&local->hw, value);
413 trace_drv_return_int(local, ret);
417 static inline int drv_set_coverage_class(struct ieee80211_local *local,
423 trace_drv_set_coverage_class(local, value);
424 if (local->ops->set_coverage_class)
425 local->ops->set_coverage_class(&local->hw, value);
429 trace_drv_return_int(local, ret);
433 static inline void drv_sta_notify(struct ieee80211_local *local,
434 struct ieee80211_sub_if_data *sdata,
435 enum sta_notify_cmd cmd,
436 struct ieee80211_sta *sta)
438 sdata = get_bss_sdata(sdata);
439 if (!check_sdata_in_driver(sdata))
442 trace_drv_sta_notify(local, sdata, cmd, sta);
443 if (local->ops->sta_notify)
444 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
445 trace_drv_return_void(local);
448 static inline int drv_sta_add(struct ieee80211_local *local,
449 struct ieee80211_sub_if_data *sdata,
450 struct ieee80211_sta *sta)
456 sdata = get_bss_sdata(sdata);
457 if (!check_sdata_in_driver(sdata))
460 trace_drv_sta_add(local, sdata, sta);
461 if (local->ops->sta_add)
462 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
464 trace_drv_return_int(local, ret);
469 static inline void drv_sta_remove(struct ieee80211_local *local,
470 struct ieee80211_sub_if_data *sdata,
471 struct ieee80211_sta *sta)
475 sdata = get_bss_sdata(sdata);
476 if (!check_sdata_in_driver(sdata))
479 trace_drv_sta_remove(local, sdata, sta);
480 if (local->ops->sta_remove)
481 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
483 trace_drv_return_void(local);
486 #ifdef CONFIG_MAC80211_DEBUGFS
487 static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
488 struct ieee80211_sub_if_data *sdata,
489 struct ieee80211_sta *sta,
494 sdata = get_bss_sdata(sdata);
495 if (!check_sdata_in_driver(sdata))
498 if (local->ops->sta_add_debugfs)
499 local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
504 static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
505 struct ieee80211_sub_if_data *sdata,
506 struct sta_info *sta)
510 sdata = get_bss_sdata(sdata);
511 if (!check_sdata_in_driver(sdata))
514 trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta);
515 if (local->ops->sta_pre_rcu_remove)
516 local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif,
518 trace_drv_return_void(local);
522 int drv_sta_state(struct ieee80211_local *local,
523 struct ieee80211_sub_if_data *sdata,
524 struct sta_info *sta,
525 enum ieee80211_sta_state old_state,
526 enum ieee80211_sta_state new_state);
528 void drv_sta_rc_update(struct ieee80211_local *local,
529 struct ieee80211_sub_if_data *sdata,
530 struct ieee80211_sta *sta, u32 changed);
532 static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
533 struct ieee80211_sub_if_data *sdata,
534 struct ieee80211_sta *sta)
536 sdata = get_bss_sdata(sdata);
537 if (!check_sdata_in_driver(sdata))
540 trace_drv_sta_rate_tbl_update(local, sdata, sta);
541 if (local->ops->sta_rate_tbl_update)
542 local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
544 trace_drv_return_void(local);
547 static inline void drv_sta_statistics(struct ieee80211_local *local,
548 struct ieee80211_sub_if_data *sdata,
549 struct ieee80211_sta *sta,
550 struct station_info *sinfo)
552 sdata = get_bss_sdata(sdata);
553 if (!check_sdata_in_driver(sdata))
556 trace_drv_sta_statistics(local, sdata, sta);
557 if (local->ops->sta_statistics)
558 local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo);
559 trace_drv_return_void(local);
562 int drv_conf_tx(struct ieee80211_local *local,
563 struct ieee80211_sub_if_data *sdata, u16 ac,
564 const struct ieee80211_tx_queue_params *params);
566 u64 drv_get_tsf(struct ieee80211_local *local,
567 struct ieee80211_sub_if_data *sdata);
568 void drv_set_tsf(struct ieee80211_local *local,
569 struct ieee80211_sub_if_data *sdata,
571 void drv_reset_tsf(struct ieee80211_local *local,
572 struct ieee80211_sub_if_data *sdata);
574 static inline int drv_tx_last_beacon(struct ieee80211_local *local)
576 int ret = 0; /* default unsupported op for less congestion */
580 trace_drv_tx_last_beacon(local);
581 if (local->ops->tx_last_beacon)
582 ret = local->ops->tx_last_beacon(&local->hw);
583 trace_drv_return_int(local, ret);
587 int drv_ampdu_action(struct ieee80211_local *local,
588 struct ieee80211_sub_if_data *sdata,
589 struct ieee80211_ampdu_params *params);
591 static inline int drv_get_survey(struct ieee80211_local *local, int idx,
592 struct survey_info *survey)
594 int ret = -EOPNOTSUPP;
596 trace_drv_get_survey(local, idx, survey);
598 if (local->ops->get_survey)
599 ret = local->ops->get_survey(&local->hw, idx, survey);
601 trace_drv_return_int(local, ret);
606 static inline void drv_rfkill_poll(struct ieee80211_local *local)
610 if (local->ops->rfkill_poll)
611 local->ops->rfkill_poll(&local->hw);
614 static inline void drv_flush(struct ieee80211_local *local,
615 struct ieee80211_sub_if_data *sdata,
616 u32 queues, bool drop)
618 struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL;
622 if (sdata && !check_sdata_in_driver(sdata))
625 trace_drv_flush(local, queues, drop);
626 if (local->ops->flush)
627 local->ops->flush(&local->hw, vif, queues, drop);
628 trace_drv_return_void(local);
631 static inline void drv_channel_switch(struct ieee80211_local *local,
632 struct ieee80211_sub_if_data *sdata,
633 struct ieee80211_channel_switch *ch_switch)
637 trace_drv_channel_switch(local, sdata, ch_switch);
638 local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch);
639 trace_drv_return_void(local);
643 static inline int drv_set_antenna(struct ieee80211_local *local,
644 u32 tx_ant, u32 rx_ant)
646 int ret = -EOPNOTSUPP;
648 if (local->ops->set_antenna)
649 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
650 trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
654 static inline int drv_get_antenna(struct ieee80211_local *local,
655 u32 *tx_ant, u32 *rx_ant)
657 int ret = -EOPNOTSUPP;
659 if (local->ops->get_antenna)
660 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
661 trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
665 static inline int drv_remain_on_channel(struct ieee80211_local *local,
666 struct ieee80211_sub_if_data *sdata,
667 struct ieee80211_channel *chan,
668 unsigned int duration,
669 enum ieee80211_roc_type type)
675 trace_drv_remain_on_channel(local, sdata, chan, duration, type);
676 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
677 chan, duration, type);
678 trace_drv_return_int(local, ret);
683 static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
689 trace_drv_cancel_remain_on_channel(local);
690 ret = local->ops->cancel_remain_on_channel(&local->hw);
691 trace_drv_return_int(local, ret);
696 static inline int drv_set_ringparam(struct ieee80211_local *local,
703 trace_drv_set_ringparam(local, tx, rx);
704 if (local->ops->set_ringparam)
705 ret = local->ops->set_ringparam(&local->hw, tx, rx);
706 trace_drv_return_int(local, ret);
711 static inline void drv_get_ringparam(struct ieee80211_local *local,
712 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
716 trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
717 if (local->ops->get_ringparam)
718 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
719 trace_drv_return_void(local);
722 static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
728 trace_drv_tx_frames_pending(local);
729 if (local->ops->tx_frames_pending)
730 ret = local->ops->tx_frames_pending(&local->hw);
731 trace_drv_return_bool(local, ret);
736 static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
737 struct ieee80211_sub_if_data *sdata,
738 const struct cfg80211_bitrate_mask *mask)
740 int ret = -EOPNOTSUPP;
744 if (!check_sdata_in_driver(sdata))
747 trace_drv_set_bitrate_mask(local, sdata, mask);
748 if (local->ops->set_bitrate_mask)
749 ret = local->ops->set_bitrate_mask(&local->hw,
751 trace_drv_return_int(local, ret);
756 static inline void drv_set_rekey_data(struct ieee80211_local *local,
757 struct ieee80211_sub_if_data *sdata,
758 struct cfg80211_gtk_rekey_data *data)
760 if (!check_sdata_in_driver(sdata))
763 trace_drv_set_rekey_data(local, sdata, data);
764 if (local->ops->set_rekey_data)
765 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
766 trace_drv_return_void(local);
769 static inline void drv_event_callback(struct ieee80211_local *local,
770 struct ieee80211_sub_if_data *sdata,
771 const struct ieee80211_event *event)
773 trace_drv_event_callback(local, sdata, event);
774 if (local->ops->event_callback)
775 local->ops->event_callback(&local->hw, &sdata->vif, event);
776 trace_drv_return_void(local);
780 drv_release_buffered_frames(struct ieee80211_local *local,
781 struct sta_info *sta, u16 tids, int num_frames,
782 enum ieee80211_frame_release_type reason,
785 trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
787 if (local->ops->release_buffered_frames)
788 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
791 trace_drv_return_void(local);
795 drv_allow_buffered_frames(struct ieee80211_local *local,
796 struct sta_info *sta, u16 tids, int num_frames,
797 enum ieee80211_frame_release_type reason,
800 trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
802 if (local->ops->allow_buffered_frames)
803 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
804 tids, num_frames, reason,
806 trace_drv_return_void(local);
809 static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
810 struct ieee80211_sub_if_data *sdata)
814 if (!check_sdata_in_driver(sdata))
816 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
818 trace_drv_mgd_prepare_tx(local, sdata);
819 if (local->ops->mgd_prepare_tx)
820 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
821 trace_drv_return_void(local);
825 drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
826 struct ieee80211_sub_if_data *sdata)
830 if (!check_sdata_in_driver(sdata))
832 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
834 trace_drv_mgd_protect_tdls_discover(local, sdata);
835 if (local->ops->mgd_protect_tdls_discover)
836 local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
837 trace_drv_return_void(local);
840 static inline int drv_add_chanctx(struct ieee80211_local *local,
841 struct ieee80211_chanctx *ctx)
843 int ret = -EOPNOTSUPP;
847 trace_drv_add_chanctx(local, ctx);
848 if (local->ops->add_chanctx)
849 ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
850 trace_drv_return_int(local, ret);
852 ctx->driver_present = true;
857 static inline void drv_remove_chanctx(struct ieee80211_local *local,
858 struct ieee80211_chanctx *ctx)
862 if (WARN_ON(!ctx->driver_present))
865 trace_drv_remove_chanctx(local, ctx);
866 if (local->ops->remove_chanctx)
867 local->ops->remove_chanctx(&local->hw, &ctx->conf);
868 trace_drv_return_void(local);
869 ctx->driver_present = false;
872 static inline void drv_change_chanctx(struct ieee80211_local *local,
873 struct ieee80211_chanctx *ctx,
878 trace_drv_change_chanctx(local, ctx, changed);
879 if (local->ops->change_chanctx) {
880 WARN_ON_ONCE(!ctx->driver_present);
881 local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
883 trace_drv_return_void(local);
886 static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
887 struct ieee80211_sub_if_data *sdata,
888 struct ieee80211_chanctx *ctx)
892 if (!check_sdata_in_driver(sdata))
895 trace_drv_assign_vif_chanctx(local, sdata, ctx);
896 if (local->ops->assign_vif_chanctx) {
897 WARN_ON_ONCE(!ctx->driver_present);
898 ret = local->ops->assign_vif_chanctx(&local->hw,
902 trace_drv_return_int(local, ret);
907 static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
908 struct ieee80211_sub_if_data *sdata,
909 struct ieee80211_chanctx *ctx)
913 if (!check_sdata_in_driver(sdata))
916 trace_drv_unassign_vif_chanctx(local, sdata, ctx);
917 if (local->ops->unassign_vif_chanctx) {
918 WARN_ON_ONCE(!ctx->driver_present);
919 local->ops->unassign_vif_chanctx(&local->hw,
923 trace_drv_return_void(local);
926 int drv_switch_vif_chanctx(struct ieee80211_local *local,
927 struct ieee80211_vif_chanctx_switch *vifs,
928 int n_vifs, enum ieee80211_chanctx_switch_mode mode);
930 static inline int drv_start_ap(struct ieee80211_local *local,
931 struct ieee80211_sub_if_data *sdata)
937 if (!check_sdata_in_driver(sdata))
940 trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
941 if (local->ops->start_ap)
942 ret = local->ops->start_ap(&local->hw, &sdata->vif);
943 trace_drv_return_int(local, ret);
947 static inline void drv_stop_ap(struct ieee80211_local *local,
948 struct ieee80211_sub_if_data *sdata)
950 if (!check_sdata_in_driver(sdata))
953 trace_drv_stop_ap(local, sdata);
954 if (local->ops->stop_ap)
955 local->ops->stop_ap(&local->hw, &sdata->vif);
956 trace_drv_return_void(local);
960 drv_reconfig_complete(struct ieee80211_local *local,
961 enum ieee80211_reconfig_type reconfig_type)
965 trace_drv_reconfig_complete(local, reconfig_type);
966 if (local->ops->reconfig_complete)
967 local->ops->reconfig_complete(&local->hw, reconfig_type);
968 trace_drv_return_void(local);
972 drv_set_default_unicast_key(struct ieee80211_local *local,
973 struct ieee80211_sub_if_data *sdata,
976 if (!check_sdata_in_driver(sdata))
979 WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
981 trace_drv_set_default_unicast_key(local, sdata, key_idx);
982 if (local->ops->set_default_unicast_key)
983 local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
985 trace_drv_return_void(local);
988 #if IS_ENABLED(CONFIG_IPV6)
989 static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
990 struct ieee80211_sub_if_data *sdata,
991 struct inet6_dev *idev)
993 trace_drv_ipv6_addr_change(local, sdata);
994 if (local->ops->ipv6_addr_change)
995 local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
996 trace_drv_return_void(local);
1001 drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
1002 struct cfg80211_chan_def *chandef)
1004 struct ieee80211_local *local = sdata->local;
1006 if (local->ops->channel_switch_beacon) {
1007 trace_drv_channel_switch_beacon(local, sdata, chandef);
1008 local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
1014 drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
1015 struct ieee80211_channel_switch *ch_switch)
1017 struct ieee80211_local *local = sdata->local;
1020 if (!check_sdata_in_driver(sdata))
1023 trace_drv_pre_channel_switch(local, sdata, ch_switch);
1024 if (local->ops->pre_channel_switch)
1025 ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif,
1027 trace_drv_return_int(local, ret);
1032 drv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
1034 struct ieee80211_local *local = sdata->local;
1037 if (!check_sdata_in_driver(sdata))
1040 trace_drv_post_channel_switch(local, sdata);
1041 if (local->ops->post_channel_switch)
1042 ret = local->ops->post_channel_switch(&local->hw, &sdata->vif);
1043 trace_drv_return_int(local, ret);
1047 static inline int drv_join_ibss(struct ieee80211_local *local,
1048 struct ieee80211_sub_if_data *sdata)
1053 if (!check_sdata_in_driver(sdata))
1056 trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf);
1057 if (local->ops->join_ibss)
1058 ret = local->ops->join_ibss(&local->hw, &sdata->vif);
1059 trace_drv_return_int(local, ret);
1063 static inline void drv_leave_ibss(struct ieee80211_local *local,
1064 struct ieee80211_sub_if_data *sdata)
1067 if (!check_sdata_in_driver(sdata))
1070 trace_drv_leave_ibss(local, sdata);
1071 if (local->ops->leave_ibss)
1072 local->ops->leave_ibss(&local->hw, &sdata->vif);
1073 trace_drv_return_void(local);
1076 static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
1077 struct sta_info *sta)
1081 trace_drv_get_expected_throughput(&sta->sta);
1082 if (local->ops->get_expected_throughput && sta->uploaded)
1083 ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
1084 trace_drv_return_u32(local, ret);
1089 static inline int drv_get_txpower(struct ieee80211_local *local,
1090 struct ieee80211_sub_if_data *sdata, int *dbm)
1094 if (!local->ops->get_txpower)
1097 ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm);
1098 trace_drv_get_txpower(local, sdata, *dbm, ret);
1104 drv_tdls_channel_switch(struct ieee80211_local *local,
1105 struct ieee80211_sub_if_data *sdata,
1106 struct ieee80211_sta *sta, u8 oper_class,
1107 struct cfg80211_chan_def *chandef,
1108 struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie)
1113 if (!check_sdata_in_driver(sdata))
1116 if (!local->ops->tdls_channel_switch)
1119 trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef);
1120 ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta,
1121 oper_class, chandef, tmpl_skb,
1123 trace_drv_return_int(local, ret);
1128 drv_tdls_cancel_channel_switch(struct ieee80211_local *local,
1129 struct ieee80211_sub_if_data *sdata,
1130 struct ieee80211_sta *sta)
1133 if (!check_sdata_in_driver(sdata))
1136 if (!local->ops->tdls_cancel_channel_switch)
1139 trace_drv_tdls_cancel_channel_switch(local, sdata, sta);
1140 local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta);
1141 trace_drv_return_void(local);
1145 drv_tdls_recv_channel_switch(struct ieee80211_local *local,
1146 struct ieee80211_sub_if_data *sdata,
1147 struct ieee80211_tdls_ch_sw_params *params)
1149 trace_drv_tdls_recv_channel_switch(local, sdata, params);
1150 if (local->ops->tdls_recv_channel_switch)
1151 local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif,
1153 trace_drv_return_void(local);
1156 static inline void drv_wake_tx_queue(struct ieee80211_local *local,
1157 struct txq_info *txq)
1159 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
1161 if (!check_sdata_in_driver(sdata))
1164 trace_drv_wake_tx_queue(local, sdata, txq);
1165 local->ops->wake_tx_queue(&local->hw, &txq->txq);
1168 #endif /* __MAC80211_DRIVER_OPS */