1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Portions of this file
4 * Copyright(c) 2016 Intel Deutschland GmbH
5 * Copyright (C) 2018-2019, 2021-2024 Intel Corporation
8 #ifndef __MAC80211_DRIVER_OPS
9 #define __MAC80211_DRIVER_OPS
11 #include <net/mac80211.h>
12 #include "ieee80211_i.h"
15 #define check_sdata_in_driver(sdata) ({ \
16 WARN_ONCE(!sdata->local->reconfig_failure && \
17 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER), \
18 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", \
19 sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); \
20 !!(sdata->flags & IEEE80211_SDATA_IN_DRIVER); \
23 static inline struct ieee80211_sub_if_data
*
24 get_bss_sdata(struct ieee80211_sub_if_data
*sdata
)
26 if (sdata
&& sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
)
27 sdata
= container_of(sdata
->bss
, struct ieee80211_sub_if_data
,
33 static inline void drv_tx(struct ieee80211_local
*local
,
34 struct ieee80211_tx_control
*control
,
37 local
->ops
->tx(&local
->hw
, control
, skb
);
40 static inline void drv_sync_rx_queues(struct ieee80211_local
*local
,
44 lockdep_assert_wiphy(local
->hw
.wiphy
);
46 if (local
->ops
->sync_rx_queues
) {
47 trace_drv_sync_rx_queues(local
, sta
->sdata
, &sta
->sta
);
48 local
->ops
->sync_rx_queues(&local
->hw
);
49 trace_drv_return_void(local
);
53 static inline void drv_get_et_strings(struct ieee80211_sub_if_data
*sdata
,
56 struct ieee80211_local
*local
= sdata
->local
;
57 if (local
->ops
->get_et_strings
) {
58 trace_drv_get_et_strings(local
, sset
);
59 local
->ops
->get_et_strings(&local
->hw
, &sdata
->vif
, sset
, data
);
60 trace_drv_return_void(local
);
64 static inline void drv_get_et_stats(struct ieee80211_sub_if_data
*sdata
,
65 struct ethtool_stats
*stats
,
68 struct ieee80211_local
*local
= sdata
->local
;
69 if (local
->ops
->get_et_stats
) {
70 trace_drv_get_et_stats(local
);
71 local
->ops
->get_et_stats(&local
->hw
, &sdata
->vif
, stats
, data
);
72 trace_drv_return_void(local
);
76 static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data
*sdata
,
79 struct ieee80211_local
*local
= sdata
->local
;
81 if (local
->ops
->get_et_sset_count
) {
82 trace_drv_get_et_sset_count(local
, sset
);
83 rv
= local
->ops
->get_et_sset_count(&local
->hw
, &sdata
->vif
,
85 trace_drv_return_int(local
, rv
);
90 int drv_start(struct ieee80211_local
*local
);
91 void drv_stop(struct ieee80211_local
*local
, bool suspend
);
94 static inline int drv_suspend(struct ieee80211_local
*local
,
95 struct cfg80211_wowlan
*wowlan
)
100 lockdep_assert_wiphy(local
->hw
.wiphy
);
102 trace_drv_suspend(local
);
103 ret
= local
->ops
->suspend(&local
->hw
, wowlan
);
104 trace_drv_return_int(local
, ret
);
108 static inline int drv_resume(struct ieee80211_local
*local
)
113 lockdep_assert_wiphy(local
->hw
.wiphy
);
115 trace_drv_resume(local
);
116 ret
= local
->ops
->resume(&local
->hw
);
117 trace_drv_return_int(local
, ret
);
121 static inline void drv_set_wakeup(struct ieee80211_local
*local
,
125 lockdep_assert_wiphy(local
->hw
.wiphy
);
127 if (!local
->ops
->set_wakeup
)
130 trace_drv_set_wakeup(local
, enabled
);
131 local
->ops
->set_wakeup(&local
->hw
, enabled
);
132 trace_drv_return_void(local
);
136 int drv_add_interface(struct ieee80211_local
*local
,
137 struct ieee80211_sub_if_data
*sdata
);
139 int drv_change_interface(struct ieee80211_local
*local
,
140 struct ieee80211_sub_if_data
*sdata
,
141 enum nl80211_iftype type
, bool p2p
);
143 void drv_remove_interface(struct ieee80211_local
*local
,
144 struct ieee80211_sub_if_data
*sdata
);
146 static inline int drv_config(struct ieee80211_local
*local
, u32 changed
)
151 lockdep_assert_wiphy(local
->hw
.wiphy
);
153 trace_drv_config(local
, changed
);
154 ret
= local
->ops
->config(&local
->hw
, changed
);
155 trace_drv_return_int(local
, ret
);
159 static inline void drv_vif_cfg_changed(struct ieee80211_local
*local
,
160 struct ieee80211_sub_if_data
*sdata
,
164 lockdep_assert_wiphy(local
->hw
.wiphy
);
166 if (!check_sdata_in_driver(sdata
))
169 trace_drv_vif_cfg_changed(local
, sdata
, changed
);
170 if (local
->ops
->vif_cfg_changed
)
171 local
->ops
->vif_cfg_changed(&local
->hw
, &sdata
->vif
, changed
);
172 else if (local
->ops
->bss_info_changed
)
173 local
->ops
->bss_info_changed(&local
->hw
, &sdata
->vif
,
174 &sdata
->vif
.bss_conf
, changed
);
175 trace_drv_return_void(local
);
178 void drv_link_info_changed(struct ieee80211_local
*local
,
179 struct ieee80211_sub_if_data
*sdata
,
180 struct ieee80211_bss_conf
*info
,
181 int link_id
, u64 changed
);
183 static inline u64
drv_prepare_multicast(struct ieee80211_local
*local
,
184 struct netdev_hw_addr_list
*mc_list
)
188 trace_drv_prepare_multicast(local
, mc_list
->count
);
190 if (local
->ops
->prepare_multicast
)
191 ret
= local
->ops
->prepare_multicast(&local
->hw
, mc_list
);
193 trace_drv_return_u64(local
, ret
);
198 static inline void drv_configure_filter(struct ieee80211_local
*local
,
199 unsigned int changed_flags
,
200 unsigned int *total_flags
,
204 lockdep_assert_wiphy(local
->hw
.wiphy
);
206 trace_drv_configure_filter(local
, changed_flags
, total_flags
,
208 local
->ops
->configure_filter(&local
->hw
, changed_flags
, total_flags
,
210 trace_drv_return_void(local
);
213 static inline void drv_config_iface_filter(struct ieee80211_local
*local
,
214 struct ieee80211_sub_if_data
*sdata
,
215 unsigned int filter_flags
,
216 unsigned int changed_flags
)
219 lockdep_assert_wiphy(local
->hw
.wiphy
);
221 trace_drv_config_iface_filter(local
, sdata
, filter_flags
,
223 if (local
->ops
->config_iface_filter
)
224 local
->ops
->config_iface_filter(&local
->hw
, &sdata
->vif
,
227 trace_drv_return_void(local
);
230 static inline int drv_set_tim(struct ieee80211_local
*local
,
231 struct ieee80211_sta
*sta
, bool set
)
234 trace_drv_set_tim(local
, sta
, set
);
235 if (local
->ops
->set_tim
)
236 ret
= local
->ops
->set_tim(&local
->hw
, sta
, set
);
237 trace_drv_return_int(local
, ret
);
241 int drv_set_key(struct ieee80211_local
*local
,
242 enum set_key_cmd cmd
,
243 struct ieee80211_sub_if_data
*sdata
,
244 struct ieee80211_sta
*sta
,
245 struct ieee80211_key_conf
*key
);
247 static inline void drv_update_tkip_key(struct ieee80211_local
*local
,
248 struct ieee80211_sub_if_data
*sdata
,
249 struct ieee80211_key_conf
*conf
,
250 struct sta_info
*sta
, u32 iv32
,
253 struct ieee80211_sta
*ista
= NULL
;
258 sdata
= get_bss_sdata(sdata
);
259 if (!check_sdata_in_driver(sdata
))
262 trace_drv_update_tkip_key(local
, sdata
, conf
, ista
, iv32
);
263 if (local
->ops
->update_tkip_key
)
264 local
->ops
->update_tkip_key(&local
->hw
, &sdata
->vif
, conf
,
265 ista
, iv32
, phase1key
);
266 trace_drv_return_void(local
);
269 static inline int drv_hw_scan(struct ieee80211_local
*local
,
270 struct ieee80211_sub_if_data
*sdata
,
271 struct ieee80211_scan_request
*req
)
276 lockdep_assert_wiphy(local
->hw
.wiphy
);
278 if (!check_sdata_in_driver(sdata
))
281 trace_drv_hw_scan(local
, sdata
);
282 ret
= local
->ops
->hw_scan(&local
->hw
, &sdata
->vif
, req
);
283 trace_drv_return_int(local
, ret
);
287 static inline void drv_cancel_hw_scan(struct ieee80211_local
*local
,
288 struct ieee80211_sub_if_data
*sdata
)
291 lockdep_assert_wiphy(local
->hw
.wiphy
);
293 if (!check_sdata_in_driver(sdata
))
296 trace_drv_cancel_hw_scan(local
, sdata
);
297 local
->ops
->cancel_hw_scan(&local
->hw
, &sdata
->vif
);
298 trace_drv_return_void(local
);
302 drv_sched_scan_start(struct ieee80211_local
*local
,
303 struct ieee80211_sub_if_data
*sdata
,
304 struct cfg80211_sched_scan_request
*req
,
305 struct ieee80211_scan_ies
*ies
)
310 lockdep_assert_wiphy(local
->hw
.wiphy
);
312 if (!check_sdata_in_driver(sdata
))
315 trace_drv_sched_scan_start(local
, sdata
);
316 ret
= local
->ops
->sched_scan_start(&local
->hw
, &sdata
->vif
,
318 trace_drv_return_int(local
, ret
);
322 static inline int drv_sched_scan_stop(struct ieee80211_local
*local
,
323 struct ieee80211_sub_if_data
*sdata
)
328 lockdep_assert_wiphy(local
->hw
.wiphy
);
330 if (!check_sdata_in_driver(sdata
))
333 trace_drv_sched_scan_stop(local
, sdata
);
334 ret
= local
->ops
->sched_scan_stop(&local
->hw
, &sdata
->vif
);
335 trace_drv_return_int(local
, ret
);
340 static inline void drv_sw_scan_start(struct ieee80211_local
*local
,
341 struct ieee80211_sub_if_data
*sdata
,
345 lockdep_assert_wiphy(local
->hw
.wiphy
);
347 trace_drv_sw_scan_start(local
, sdata
, mac_addr
);
348 if (local
->ops
->sw_scan_start
)
349 local
->ops
->sw_scan_start(&local
->hw
, &sdata
->vif
, mac_addr
);
350 trace_drv_return_void(local
);
353 static inline void drv_sw_scan_complete(struct ieee80211_local
*local
,
354 struct ieee80211_sub_if_data
*sdata
)
357 lockdep_assert_wiphy(local
->hw
.wiphy
);
359 trace_drv_sw_scan_complete(local
, sdata
);
360 if (local
->ops
->sw_scan_complete
)
361 local
->ops
->sw_scan_complete(&local
->hw
, &sdata
->vif
);
362 trace_drv_return_void(local
);
365 static inline int drv_get_stats(struct ieee80211_local
*local
,
366 struct ieee80211_low_level_stats
*stats
)
368 int ret
= -EOPNOTSUPP
;
371 lockdep_assert_wiphy(local
->hw
.wiphy
);
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
,
395 lockdep_assert_wiphy(local
->hw
.wiphy
);
397 trace_drv_set_frag_threshold(local
, value
);
398 if (local
->ops
->set_frag_threshold
)
399 ret
= local
->ops
->set_frag_threshold(&local
->hw
, value
);
400 trace_drv_return_int(local
, ret
);
404 static inline int drv_set_rts_threshold(struct ieee80211_local
*local
,
410 lockdep_assert_wiphy(local
->hw
.wiphy
);
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
,
424 lockdep_assert_wiphy(local
->hw
.wiphy
);
426 trace_drv_set_coverage_class(local
, value
);
427 if (local
->ops
->set_coverage_class
)
428 local
->ops
->set_coverage_class(&local
->hw
, value
);
432 trace_drv_return_int(local
, ret
);
436 static inline void drv_sta_notify(struct ieee80211_local
*local
,
437 struct ieee80211_sub_if_data
*sdata
,
438 enum sta_notify_cmd cmd
,
439 struct ieee80211_sta
*sta
)
441 sdata
= get_bss_sdata(sdata
);
442 if (!check_sdata_in_driver(sdata
))
445 trace_drv_sta_notify(local
, sdata
, cmd
, sta
);
446 if (local
->ops
->sta_notify
)
447 local
->ops
->sta_notify(&local
->hw
, &sdata
->vif
, cmd
, sta
);
448 trace_drv_return_void(local
);
451 static inline int drv_sta_add(struct ieee80211_local
*local
,
452 struct ieee80211_sub_if_data
*sdata
,
453 struct ieee80211_sta
*sta
)
458 lockdep_assert_wiphy(local
->hw
.wiphy
);
460 sdata
= get_bss_sdata(sdata
);
461 if (!check_sdata_in_driver(sdata
))
464 trace_drv_sta_add(local
, sdata
, sta
);
465 if (local
->ops
->sta_add
)
466 ret
= local
->ops
->sta_add(&local
->hw
, &sdata
->vif
, sta
);
468 trace_drv_return_int(local
, ret
);
473 static inline void drv_sta_remove(struct ieee80211_local
*local
,
474 struct ieee80211_sub_if_data
*sdata
,
475 struct ieee80211_sta
*sta
)
478 lockdep_assert_wiphy(local
->hw
.wiphy
);
480 sdata
= get_bss_sdata(sdata
);
481 if (!check_sdata_in_driver(sdata
))
484 trace_drv_sta_remove(local
, sdata
, sta
);
485 if (local
->ops
->sta_remove
)
486 local
->ops
->sta_remove(&local
->hw
, &sdata
->vif
, sta
);
488 trace_drv_return_void(local
);
491 #ifdef CONFIG_MAC80211_DEBUGFS
492 static inline void drv_vif_add_debugfs(struct ieee80211_local
*local
,
493 struct ieee80211_sub_if_data
*sdata
)
497 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
||
498 WARN_ON(!sdata
->vif
.debugfs_dir
))
501 sdata
= get_bss_sdata(sdata
);
502 if (!check_sdata_in_driver(sdata
))
505 if (local
->ops
->vif_add_debugfs
)
506 local
->ops
->vif_add_debugfs(&local
->hw
, &sdata
->vif
);
509 static inline void drv_link_add_debugfs(struct ieee80211_local
*local
,
510 struct ieee80211_sub_if_data
*sdata
,
511 struct ieee80211_bss_conf
*link_conf
,
515 lockdep_assert_wiphy(local
->hw
.wiphy
);
517 sdata
= get_bss_sdata(sdata
);
518 if (!check_sdata_in_driver(sdata
))
521 if (local
->ops
->link_add_debugfs
)
522 local
->ops
->link_add_debugfs(&local
->hw
, &sdata
->vif
,
526 static inline void drv_sta_add_debugfs(struct ieee80211_local
*local
,
527 struct ieee80211_sub_if_data
*sdata
,
528 struct ieee80211_sta
*sta
,
532 lockdep_assert_wiphy(local
->hw
.wiphy
);
534 sdata
= get_bss_sdata(sdata
);
535 if (!check_sdata_in_driver(sdata
))
538 if (local
->ops
->sta_add_debugfs
)
539 local
->ops
->sta_add_debugfs(&local
->hw
, &sdata
->vif
,
543 static inline void drv_link_sta_add_debugfs(struct ieee80211_local
*local
,
544 struct ieee80211_sub_if_data
*sdata
,
545 struct ieee80211_link_sta
*link_sta
,
549 lockdep_assert_wiphy(local
->hw
.wiphy
);
551 sdata
= get_bss_sdata(sdata
);
552 if (!check_sdata_in_driver(sdata
))
555 if (local
->ops
->link_sta_add_debugfs
)
556 local
->ops
->link_sta_add_debugfs(&local
->hw
, &sdata
->vif
,
560 static inline void drv_vif_add_debugfs(struct ieee80211_local
*local
,
561 struct ieee80211_sub_if_data
*sdata
)
567 static inline void drv_sta_pre_rcu_remove(struct ieee80211_local
*local
,
568 struct ieee80211_sub_if_data
*sdata
,
569 struct sta_info
*sta
)
572 lockdep_assert_wiphy(local
->hw
.wiphy
);
574 sdata
= get_bss_sdata(sdata
);
575 if (!check_sdata_in_driver(sdata
))
578 trace_drv_sta_pre_rcu_remove(local
, sdata
, &sta
->sta
);
579 if (local
->ops
->sta_pre_rcu_remove
)
580 local
->ops
->sta_pre_rcu_remove(&local
->hw
, &sdata
->vif
,
582 trace_drv_return_void(local
);
586 int drv_sta_state(struct ieee80211_local
*local
,
587 struct ieee80211_sub_if_data
*sdata
,
588 struct sta_info
*sta
,
589 enum ieee80211_sta_state old_state
,
590 enum ieee80211_sta_state new_state
);
593 int drv_sta_set_txpwr(struct ieee80211_local
*local
,
594 struct ieee80211_sub_if_data
*sdata
,
595 struct sta_info
*sta
);
597 void drv_link_sta_rc_update(struct ieee80211_local
*local
,
598 struct ieee80211_sub_if_data
*sdata
,
599 struct ieee80211_link_sta
*link_sta
, u32 changed
);
601 static inline void drv_sta_rate_tbl_update(struct ieee80211_local
*local
,
602 struct ieee80211_sub_if_data
*sdata
,
603 struct ieee80211_sta
*sta
)
605 sdata
= get_bss_sdata(sdata
);
606 if (!check_sdata_in_driver(sdata
))
609 trace_drv_sta_rate_tbl_update(local
, sdata
, sta
);
610 if (local
->ops
->sta_rate_tbl_update
)
611 local
->ops
->sta_rate_tbl_update(&local
->hw
, &sdata
->vif
, sta
);
613 trace_drv_return_void(local
);
616 static inline void drv_sta_statistics(struct ieee80211_local
*local
,
617 struct ieee80211_sub_if_data
*sdata
,
618 struct ieee80211_sta
*sta
,
619 struct station_info
*sinfo
)
622 lockdep_assert_wiphy(local
->hw
.wiphy
);
624 sdata
= get_bss_sdata(sdata
);
625 if (!check_sdata_in_driver(sdata
))
628 trace_drv_sta_statistics(local
, sdata
, sta
);
629 if (local
->ops
->sta_statistics
)
630 local
->ops
->sta_statistics(&local
->hw
, &sdata
->vif
, sta
, sinfo
);
631 trace_drv_return_void(local
);
634 int drv_conf_tx(struct ieee80211_local
*local
,
635 struct ieee80211_link_data
*link
, u16 ac
,
636 const struct ieee80211_tx_queue_params
*params
);
638 u64
drv_get_tsf(struct ieee80211_local
*local
,
639 struct ieee80211_sub_if_data
*sdata
);
640 void drv_set_tsf(struct ieee80211_local
*local
,
641 struct ieee80211_sub_if_data
*sdata
,
643 void drv_offset_tsf(struct ieee80211_local
*local
,
644 struct ieee80211_sub_if_data
*sdata
,
646 void drv_reset_tsf(struct ieee80211_local
*local
,
647 struct ieee80211_sub_if_data
*sdata
);
649 static inline int drv_tx_last_beacon(struct ieee80211_local
*local
)
651 int ret
= 0; /* default unsupported op for less congestion */
654 lockdep_assert_wiphy(local
->hw
.wiphy
);
656 trace_drv_tx_last_beacon(local
);
657 if (local
->ops
->tx_last_beacon
)
658 ret
= local
->ops
->tx_last_beacon(&local
->hw
);
659 trace_drv_return_int(local
, ret
);
663 int drv_ampdu_action(struct ieee80211_local
*local
,
664 struct ieee80211_sub_if_data
*sdata
,
665 struct ieee80211_ampdu_params
*params
);
667 static inline int drv_get_survey(struct ieee80211_local
*local
, int idx
,
668 struct survey_info
*survey
)
670 int ret
= -EOPNOTSUPP
;
673 lockdep_assert_wiphy(local
->hw
.wiphy
);
675 trace_drv_get_survey(local
, idx
, survey
);
677 if (local
->ops
->get_survey
)
678 ret
= local
->ops
->get_survey(&local
->hw
, idx
, survey
);
680 trace_drv_return_int(local
, ret
);
685 static inline void drv_rfkill_poll(struct ieee80211_local
*local
)
688 lockdep_assert_wiphy(local
->hw
.wiphy
);
690 if (local
->ops
->rfkill_poll
)
691 local
->ops
->rfkill_poll(&local
->hw
);
694 static inline void drv_flush(struct ieee80211_local
*local
,
695 struct ieee80211_sub_if_data
*sdata
,
696 u32 queues
, bool drop
)
698 struct ieee80211_vif
*vif
;
701 lockdep_assert_wiphy(local
->hw
.wiphy
);
703 sdata
= get_bss_sdata(sdata
);
704 vif
= sdata
? &sdata
->vif
: NULL
;
706 if (sdata
&& !check_sdata_in_driver(sdata
))
709 trace_drv_flush(local
, queues
, drop
);
710 if (local
->ops
->flush
)
711 local
->ops
->flush(&local
->hw
, vif
, queues
, drop
);
712 trace_drv_return_void(local
);
715 static inline void drv_flush_sta(struct ieee80211_local
*local
,
716 struct ieee80211_sub_if_data
*sdata
,
717 struct sta_info
*sta
)
720 lockdep_assert_wiphy(local
->hw
.wiphy
);
722 sdata
= get_bss_sdata(sdata
);
724 if (sdata
&& !check_sdata_in_driver(sdata
))
730 trace_drv_flush_sta(local
, sdata
, &sta
->sta
);
731 if (local
->ops
->flush_sta
)
732 local
->ops
->flush_sta(&local
->hw
, &sdata
->vif
, &sta
->sta
);
733 trace_drv_return_void(local
);
736 static inline void drv_channel_switch(struct ieee80211_local
*local
,
737 struct ieee80211_sub_if_data
*sdata
,
738 struct ieee80211_channel_switch
*ch_switch
)
741 lockdep_assert_wiphy(local
->hw
.wiphy
);
743 trace_drv_channel_switch(local
, sdata
, ch_switch
);
744 local
->ops
->channel_switch(&local
->hw
, &sdata
->vif
, ch_switch
);
745 trace_drv_return_void(local
);
749 static inline int drv_set_antenna(struct ieee80211_local
*local
,
750 u32 tx_ant
, u32 rx_ant
)
752 int ret
= -EOPNOTSUPP
;
754 lockdep_assert_wiphy(local
->hw
.wiphy
);
755 if (local
->ops
->set_antenna
)
756 ret
= local
->ops
->set_antenna(&local
->hw
, tx_ant
, rx_ant
);
757 trace_drv_set_antenna(local
, tx_ant
, rx_ant
, ret
);
761 static inline int drv_get_antenna(struct ieee80211_local
*local
,
762 u32
*tx_ant
, u32
*rx_ant
)
764 int ret
= -EOPNOTSUPP
;
766 lockdep_assert_wiphy(local
->hw
.wiphy
);
767 if (local
->ops
->get_antenna
)
768 ret
= local
->ops
->get_antenna(&local
->hw
, tx_ant
, rx_ant
);
769 trace_drv_get_antenna(local
, *tx_ant
, *rx_ant
, ret
);
773 static inline int drv_remain_on_channel(struct ieee80211_local
*local
,
774 struct ieee80211_sub_if_data
*sdata
,
775 struct ieee80211_channel
*chan
,
776 unsigned int duration
,
777 enum ieee80211_roc_type type
)
782 lockdep_assert_wiphy(local
->hw
.wiphy
);
784 trace_drv_remain_on_channel(local
, sdata
, chan
, duration
, type
);
785 ret
= local
->ops
->remain_on_channel(&local
->hw
, &sdata
->vif
,
786 chan
, duration
, type
);
787 trace_drv_return_int(local
, ret
);
793 drv_cancel_remain_on_channel(struct ieee80211_local
*local
,
794 struct ieee80211_sub_if_data
*sdata
)
799 lockdep_assert_wiphy(local
->hw
.wiphy
);
801 trace_drv_cancel_remain_on_channel(local
, sdata
);
802 ret
= local
->ops
->cancel_remain_on_channel(&local
->hw
, &sdata
->vif
);
803 trace_drv_return_int(local
, ret
);
808 static inline int drv_set_ringparam(struct ieee80211_local
*local
,
811 int ret
= -EOPNOTSUPP
;
814 lockdep_assert_wiphy(local
->hw
.wiphy
);
816 trace_drv_set_ringparam(local
, tx
, rx
);
817 if (local
->ops
->set_ringparam
)
818 ret
= local
->ops
->set_ringparam(&local
->hw
, tx
, rx
);
819 trace_drv_return_int(local
, ret
);
824 static inline void drv_get_ringparam(struct ieee80211_local
*local
,
825 u32
*tx
, u32
*tx_max
, u32
*rx
, u32
*rx_max
)
828 lockdep_assert_wiphy(local
->hw
.wiphy
);
830 trace_drv_get_ringparam(local
, tx
, tx_max
, rx
, rx_max
);
831 if (local
->ops
->get_ringparam
)
832 local
->ops
->get_ringparam(&local
->hw
, tx
, tx_max
, rx
, rx_max
);
833 trace_drv_return_void(local
);
836 static inline bool drv_tx_frames_pending(struct ieee80211_local
*local
)
841 lockdep_assert_wiphy(local
->hw
.wiphy
);
843 trace_drv_tx_frames_pending(local
);
844 if (local
->ops
->tx_frames_pending
)
845 ret
= local
->ops
->tx_frames_pending(&local
->hw
);
846 trace_drv_return_bool(local
, ret
);
851 static inline int drv_set_bitrate_mask(struct ieee80211_local
*local
,
852 struct ieee80211_sub_if_data
*sdata
,
853 const struct cfg80211_bitrate_mask
*mask
)
855 int ret
= -EOPNOTSUPP
;
858 lockdep_assert_wiphy(local
->hw
.wiphy
);
860 if (!check_sdata_in_driver(sdata
))
863 trace_drv_set_bitrate_mask(local
, sdata
, mask
);
864 if (local
->ops
->set_bitrate_mask
)
865 ret
= local
->ops
->set_bitrate_mask(&local
->hw
,
867 trace_drv_return_int(local
, ret
);
872 static inline void drv_set_rekey_data(struct ieee80211_local
*local
,
873 struct ieee80211_sub_if_data
*sdata
,
874 struct cfg80211_gtk_rekey_data
*data
)
877 lockdep_assert_wiphy(local
->hw
.wiphy
);
879 if (!check_sdata_in_driver(sdata
))
882 trace_drv_set_rekey_data(local
, sdata
, data
);
883 if (local
->ops
->set_rekey_data
)
884 local
->ops
->set_rekey_data(&local
->hw
, &sdata
->vif
, data
);
885 trace_drv_return_void(local
);
888 static inline void drv_event_callback(struct ieee80211_local
*local
,
889 struct ieee80211_sub_if_data
*sdata
,
890 const struct ieee80211_event
*event
)
892 trace_drv_event_callback(local
, sdata
, event
);
893 if (local
->ops
->event_callback
)
894 local
->ops
->event_callback(&local
->hw
, &sdata
->vif
, event
);
895 trace_drv_return_void(local
);
899 drv_release_buffered_frames(struct ieee80211_local
*local
,
900 struct sta_info
*sta
, u16 tids
, int num_frames
,
901 enum ieee80211_frame_release_type reason
,
904 trace_drv_release_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
906 if (local
->ops
->release_buffered_frames
)
907 local
->ops
->release_buffered_frames(&local
->hw
, &sta
->sta
, tids
,
910 trace_drv_return_void(local
);
914 drv_allow_buffered_frames(struct ieee80211_local
*local
,
915 struct sta_info
*sta
, u16 tids
, int num_frames
,
916 enum ieee80211_frame_release_type reason
,
919 trace_drv_allow_buffered_frames(local
, &sta
->sta
, tids
, num_frames
,
921 if (local
->ops
->allow_buffered_frames
)
922 local
->ops
->allow_buffered_frames(&local
->hw
, &sta
->sta
,
923 tids
, num_frames
, reason
,
925 trace_drv_return_void(local
);
928 static inline void drv_mgd_prepare_tx(struct ieee80211_local
*local
,
929 struct ieee80211_sub_if_data
*sdata
,
930 struct ieee80211_prep_tx_info
*info
)
933 lockdep_assert_wiphy(local
->hw
.wiphy
);
935 if (!check_sdata_in_driver(sdata
))
937 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
939 info
->link_id
= info
->link_id
< 0 ? 0 : info
->link_id
;
940 trace_drv_mgd_prepare_tx(local
, sdata
, info
->duration
,
941 info
->subtype
, info
->success
);
942 if (local
->ops
->mgd_prepare_tx
)
943 local
->ops
->mgd_prepare_tx(&local
->hw
, &sdata
->vif
, info
);
944 trace_drv_return_void(local
);
947 static inline void drv_mgd_complete_tx(struct ieee80211_local
*local
,
948 struct ieee80211_sub_if_data
*sdata
,
949 struct ieee80211_prep_tx_info
*info
)
952 lockdep_assert_wiphy(local
->hw
.wiphy
);
954 if (!check_sdata_in_driver(sdata
))
956 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
958 trace_drv_mgd_complete_tx(local
, sdata
, info
->duration
,
959 info
->subtype
, info
->success
);
960 if (local
->ops
->mgd_complete_tx
)
961 local
->ops
->mgd_complete_tx(&local
->hw
, &sdata
->vif
, info
);
962 trace_drv_return_void(local
);
966 drv_mgd_protect_tdls_discover(struct ieee80211_local
*local
,
967 struct ieee80211_sub_if_data
*sdata
,
971 lockdep_assert_wiphy(local
->hw
.wiphy
);
973 if (!check_sdata_in_driver(sdata
))
975 WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
);
977 link_id
= link_id
> 0 ? link_id
: 0;
979 trace_drv_mgd_protect_tdls_discover(local
, sdata
);
980 if (local
->ops
->mgd_protect_tdls_discover
)
981 local
->ops
->mgd_protect_tdls_discover(&local
->hw
, &sdata
->vif
,
983 trace_drv_return_void(local
);
986 static inline int drv_add_chanctx(struct ieee80211_local
*local
,
987 struct ieee80211_chanctx
*ctx
)
989 int ret
= -EOPNOTSUPP
;
992 lockdep_assert_wiphy(local
->hw
.wiphy
);
994 trace_drv_add_chanctx(local
, ctx
);
995 if (local
->ops
->add_chanctx
)
996 ret
= local
->ops
->add_chanctx(&local
->hw
, &ctx
->conf
);
997 trace_drv_return_int(local
, ret
);
999 ctx
->driver_present
= true;
1004 static inline void drv_remove_chanctx(struct ieee80211_local
*local
,
1005 struct ieee80211_chanctx
*ctx
)
1008 lockdep_assert_wiphy(local
->hw
.wiphy
);
1010 if (WARN_ON(!ctx
->driver_present
))
1013 trace_drv_remove_chanctx(local
, ctx
);
1014 if (local
->ops
->remove_chanctx
)
1015 local
->ops
->remove_chanctx(&local
->hw
, &ctx
->conf
);
1016 trace_drv_return_void(local
);
1017 ctx
->driver_present
= false;
1020 static inline void drv_change_chanctx(struct ieee80211_local
*local
,
1021 struct ieee80211_chanctx
*ctx
,
1025 lockdep_assert_wiphy(local
->hw
.wiphy
);
1027 trace_drv_change_chanctx(local
, ctx
, changed
);
1028 if (local
->ops
->change_chanctx
) {
1029 WARN_ON_ONCE(!ctx
->driver_present
);
1030 local
->ops
->change_chanctx(&local
->hw
, &ctx
->conf
, changed
);
1032 trace_drv_return_void(local
);
1035 int drv_assign_vif_chanctx(struct ieee80211_local
*local
,
1036 struct ieee80211_sub_if_data
*sdata
,
1037 struct ieee80211_bss_conf
*link_conf
,
1038 struct ieee80211_chanctx
*ctx
);
1039 void drv_unassign_vif_chanctx(struct ieee80211_local
*local
,
1040 struct ieee80211_sub_if_data
*sdata
,
1041 struct ieee80211_bss_conf
*link_conf
,
1042 struct ieee80211_chanctx
*ctx
);
1043 int drv_switch_vif_chanctx(struct ieee80211_local
*local
,
1044 struct ieee80211_vif_chanctx_switch
*vifs
,
1045 int n_vifs
, enum ieee80211_chanctx_switch_mode mode
);
1047 static inline int drv_start_ap(struct ieee80211_local
*local
,
1048 struct ieee80211_sub_if_data
*sdata
,
1049 struct ieee80211_bss_conf
*link_conf
)
1054 lockdep_assert_wiphy(local
->hw
.wiphy
);
1056 if (!check_sdata_in_driver(sdata
))
1059 trace_drv_start_ap(local
, sdata
, link_conf
);
1060 if (local
->ops
->start_ap
)
1061 ret
= local
->ops
->start_ap(&local
->hw
, &sdata
->vif
, link_conf
);
1062 trace_drv_return_int(local
, ret
);
1066 static inline void drv_stop_ap(struct ieee80211_local
*local
,
1067 struct ieee80211_sub_if_data
*sdata
,
1068 struct ieee80211_bss_conf
*link_conf
)
1071 lockdep_assert_wiphy(local
->hw
.wiphy
);
1073 if (!check_sdata_in_driver(sdata
))
1076 trace_drv_stop_ap(local
, sdata
, link_conf
);
1077 if (local
->ops
->stop_ap
)
1078 local
->ops
->stop_ap(&local
->hw
, &sdata
->vif
, link_conf
);
1079 trace_drv_return_void(local
);
1083 drv_reconfig_complete(struct ieee80211_local
*local
,
1084 enum ieee80211_reconfig_type reconfig_type
)
1087 lockdep_assert_wiphy(local
->hw
.wiphy
);
1089 trace_drv_reconfig_complete(local
, reconfig_type
);
1090 if (local
->ops
->reconfig_complete
)
1091 local
->ops
->reconfig_complete(&local
->hw
, reconfig_type
);
1092 trace_drv_return_void(local
);
1096 drv_set_default_unicast_key(struct ieee80211_local
*local
,
1097 struct ieee80211_sub_if_data
*sdata
,
1101 lockdep_assert_wiphy(local
->hw
.wiphy
);
1103 if (!check_sdata_in_driver(sdata
))
1106 WARN_ON_ONCE(key_idx
< -1 || key_idx
> 3);
1108 trace_drv_set_default_unicast_key(local
, sdata
, key_idx
);
1109 if (local
->ops
->set_default_unicast_key
)
1110 local
->ops
->set_default_unicast_key(&local
->hw
, &sdata
->vif
,
1112 trace_drv_return_void(local
);
1115 #if IS_ENABLED(CONFIG_IPV6)
1116 static inline void drv_ipv6_addr_change(struct ieee80211_local
*local
,
1117 struct ieee80211_sub_if_data
*sdata
,
1118 struct inet6_dev
*idev
)
1120 trace_drv_ipv6_addr_change(local
, sdata
);
1121 if (local
->ops
->ipv6_addr_change
)
1122 local
->ops
->ipv6_addr_change(&local
->hw
, &sdata
->vif
, idev
);
1123 trace_drv_return_void(local
);
1128 drv_channel_switch_beacon(struct ieee80211_sub_if_data
*sdata
,
1129 struct cfg80211_chan_def
*chandef
)
1131 struct ieee80211_local
*local
= sdata
->local
;
1134 lockdep_assert_wiphy(local
->hw
.wiphy
);
1136 if (local
->ops
->channel_switch_beacon
) {
1137 trace_drv_channel_switch_beacon(local
, sdata
, chandef
);
1138 local
->ops
->channel_switch_beacon(&local
->hw
, &sdata
->vif
,
1144 drv_pre_channel_switch(struct ieee80211_sub_if_data
*sdata
,
1145 struct ieee80211_channel_switch
*ch_switch
)
1147 struct ieee80211_local
*local
= sdata
->local
;
1151 lockdep_assert_wiphy(local
->hw
.wiphy
);
1153 if (!check_sdata_in_driver(sdata
))
1156 if (!ieee80211_vif_link_active(&sdata
->vif
, ch_switch
->link_id
))
1159 trace_drv_pre_channel_switch(local
, sdata
, ch_switch
);
1160 if (local
->ops
->pre_channel_switch
)
1161 ret
= local
->ops
->pre_channel_switch(&local
->hw
, &sdata
->vif
,
1163 trace_drv_return_int(local
, ret
);
1168 drv_post_channel_switch(struct ieee80211_link_data
*link
)
1170 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
1171 struct ieee80211_local
*local
= sdata
->local
;
1175 lockdep_assert_wiphy(local
->hw
.wiphy
);
1177 if (!check_sdata_in_driver(sdata
))
1180 if (!ieee80211_vif_link_active(&sdata
->vif
, link
->link_id
))
1183 trace_drv_post_channel_switch(local
, sdata
);
1184 if (local
->ops
->post_channel_switch
)
1185 ret
= local
->ops
->post_channel_switch(&local
->hw
, &sdata
->vif
,
1187 trace_drv_return_int(local
, ret
);
1192 drv_abort_channel_switch(struct ieee80211_link_data
*link
)
1194 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
1195 struct ieee80211_local
*local
= sdata
->local
;
1198 lockdep_assert_wiphy(local
->hw
.wiphy
);
1200 if (!check_sdata_in_driver(sdata
))
1203 if (!ieee80211_vif_link_active(&sdata
->vif
, link
->link_id
))
1206 trace_drv_abort_channel_switch(local
, sdata
);
1208 if (local
->ops
->abort_channel_switch
)
1209 local
->ops
->abort_channel_switch(&local
->hw
, &sdata
->vif
,
1214 drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data
*sdata
,
1215 struct ieee80211_channel_switch
*ch_switch
)
1217 struct ieee80211_local
*local
= sdata
->local
;
1220 lockdep_assert_wiphy(local
->hw
.wiphy
);
1222 if (!check_sdata_in_driver(sdata
))
1225 if (!ieee80211_vif_link_active(&sdata
->vif
, ch_switch
->link_id
))
1228 trace_drv_channel_switch_rx_beacon(local
, sdata
, ch_switch
);
1229 if (local
->ops
->channel_switch_rx_beacon
)
1230 local
->ops
->channel_switch_rx_beacon(&local
->hw
, &sdata
->vif
,
1234 static inline int drv_join_ibss(struct ieee80211_local
*local
,
1235 struct ieee80211_sub_if_data
*sdata
)
1240 lockdep_assert_wiphy(local
->hw
.wiphy
);
1241 if (!check_sdata_in_driver(sdata
))
1244 trace_drv_join_ibss(local
, sdata
, &sdata
->vif
.bss_conf
);
1245 if (local
->ops
->join_ibss
)
1246 ret
= local
->ops
->join_ibss(&local
->hw
, &sdata
->vif
);
1247 trace_drv_return_int(local
, ret
);
1251 static inline void drv_leave_ibss(struct ieee80211_local
*local
,
1252 struct ieee80211_sub_if_data
*sdata
)
1255 lockdep_assert_wiphy(local
->hw
.wiphy
);
1256 if (!check_sdata_in_driver(sdata
))
1259 trace_drv_leave_ibss(local
, sdata
);
1260 if (local
->ops
->leave_ibss
)
1261 local
->ops
->leave_ibss(&local
->hw
, &sdata
->vif
);
1262 trace_drv_return_void(local
);
1265 static inline u32
drv_get_expected_throughput(struct ieee80211_local
*local
,
1266 struct sta_info
*sta
)
1270 trace_drv_get_expected_throughput(&sta
->sta
);
1271 if (local
->ops
->get_expected_throughput
&& sta
->uploaded
)
1272 ret
= local
->ops
->get_expected_throughput(&local
->hw
, &sta
->sta
);
1273 trace_drv_return_u32(local
, ret
);
1278 static inline int drv_get_txpower(struct ieee80211_local
*local
,
1279 struct ieee80211_sub_if_data
*sdata
,
1280 unsigned int link_id
, int *dbm
)
1285 lockdep_assert_wiphy(local
->hw
.wiphy
);
1287 if (!local
->ops
->get_txpower
)
1290 ret
= local
->ops
->get_txpower(&local
->hw
, &sdata
->vif
, link_id
, dbm
);
1291 trace_drv_get_txpower(local
, sdata
, link_id
, *dbm
, ret
);
1297 drv_tdls_channel_switch(struct ieee80211_local
*local
,
1298 struct ieee80211_sub_if_data
*sdata
,
1299 struct ieee80211_sta
*sta
, u8 oper_class
,
1300 struct cfg80211_chan_def
*chandef
,
1301 struct sk_buff
*tmpl_skb
, u32 ch_sw_tm_ie
)
1306 lockdep_assert_wiphy(local
->hw
.wiphy
);
1307 if (!check_sdata_in_driver(sdata
))
1310 if (!local
->ops
->tdls_channel_switch
)
1313 trace_drv_tdls_channel_switch(local
, sdata
, sta
, oper_class
, chandef
);
1314 ret
= local
->ops
->tdls_channel_switch(&local
->hw
, &sdata
->vif
, sta
,
1315 oper_class
, chandef
, tmpl_skb
,
1317 trace_drv_return_int(local
, ret
);
1322 drv_tdls_cancel_channel_switch(struct ieee80211_local
*local
,
1323 struct ieee80211_sub_if_data
*sdata
,
1324 struct ieee80211_sta
*sta
)
1327 lockdep_assert_wiphy(local
->hw
.wiphy
);
1328 if (!check_sdata_in_driver(sdata
))
1331 if (!local
->ops
->tdls_cancel_channel_switch
)
1334 trace_drv_tdls_cancel_channel_switch(local
, sdata
, sta
);
1335 local
->ops
->tdls_cancel_channel_switch(&local
->hw
, &sdata
->vif
, sta
);
1336 trace_drv_return_void(local
);
1340 drv_tdls_recv_channel_switch(struct ieee80211_local
*local
,
1341 struct ieee80211_sub_if_data
*sdata
,
1342 struct ieee80211_tdls_ch_sw_params
*params
)
1344 trace_drv_tdls_recv_channel_switch(local
, sdata
, params
);
1345 if (local
->ops
->tdls_recv_channel_switch
)
1346 local
->ops
->tdls_recv_channel_switch(&local
->hw
, &sdata
->vif
,
1348 trace_drv_return_void(local
);
1351 static inline void drv_wake_tx_queue(struct ieee80211_local
*local
,
1352 struct txq_info
*txq
)
1354 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(txq
->txq
.vif
);
1356 /* In reconfig don't transmit now, but mark for waking later */
1357 if (local
->in_reconfig
) {
1358 set_bit(IEEE80211_TXQ_DIRTY
, &txq
->flags
);
1362 if (!check_sdata_in_driver(sdata
))
1365 trace_drv_wake_tx_queue(local
, sdata
, txq
);
1366 local
->ops
->wake_tx_queue(&local
->hw
, &txq
->txq
);
1369 static inline void schedule_and_wake_txq(struct ieee80211_local
*local
,
1370 struct txq_info
*txqi
)
1372 ieee80211_schedule_txq(&local
->hw
, &txqi
->txq
);
1373 drv_wake_tx_queue(local
, txqi
);
1376 static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local
*local
,
1377 struct sk_buff
*head
,
1378 struct sk_buff
*skb
)
1380 if (!local
->ops
->can_aggregate_in_amsdu
)
1383 return local
->ops
->can_aggregate_in_amsdu(&local
->hw
, head
, skb
);
1387 drv_get_ftm_responder_stats(struct ieee80211_local
*local
,
1388 struct ieee80211_sub_if_data
*sdata
,
1389 struct cfg80211_ftm_responder_stats
*ftm_stats
)
1391 u32 ret
= -EOPNOTSUPP
;
1394 lockdep_assert_wiphy(local
->hw
.wiphy
);
1395 if (!check_sdata_in_driver(sdata
))
1398 if (local
->ops
->get_ftm_responder_stats
)
1399 ret
= local
->ops
->get_ftm_responder_stats(&local
->hw
,
1402 trace_drv_get_ftm_responder_stats(local
, sdata
, ftm_stats
);
1407 static inline int drv_start_pmsr(struct ieee80211_local
*local
,
1408 struct ieee80211_sub_if_data
*sdata
,
1409 struct cfg80211_pmsr_request
*request
)
1411 int ret
= -EOPNOTSUPP
;
1414 lockdep_assert_wiphy(local
->hw
.wiphy
);
1415 if (!check_sdata_in_driver(sdata
))
1418 trace_drv_start_pmsr(local
, sdata
);
1420 if (local
->ops
->start_pmsr
)
1421 ret
= local
->ops
->start_pmsr(&local
->hw
, &sdata
->vif
, request
);
1422 trace_drv_return_int(local
, ret
);
1427 static inline void drv_abort_pmsr(struct ieee80211_local
*local
,
1428 struct ieee80211_sub_if_data
*sdata
,
1429 struct cfg80211_pmsr_request
*request
)
1431 trace_drv_abort_pmsr(local
, sdata
);
1434 lockdep_assert_wiphy(local
->hw
.wiphy
);
1435 if (!check_sdata_in_driver(sdata
))
1438 if (local
->ops
->abort_pmsr
)
1439 local
->ops
->abort_pmsr(&local
->hw
, &sdata
->vif
, request
);
1440 trace_drv_return_void(local
);
1443 static inline int drv_start_nan(struct ieee80211_local
*local
,
1444 struct ieee80211_sub_if_data
*sdata
,
1445 struct cfg80211_nan_conf
*conf
)
1450 lockdep_assert_wiphy(local
->hw
.wiphy
);
1451 check_sdata_in_driver(sdata
);
1453 trace_drv_start_nan(local
, sdata
, conf
);
1454 ret
= local
->ops
->start_nan(&local
->hw
, &sdata
->vif
, conf
);
1455 trace_drv_return_int(local
, ret
);
1459 static inline void drv_stop_nan(struct ieee80211_local
*local
,
1460 struct ieee80211_sub_if_data
*sdata
)
1463 lockdep_assert_wiphy(local
->hw
.wiphy
);
1464 check_sdata_in_driver(sdata
);
1466 trace_drv_stop_nan(local
, sdata
);
1467 local
->ops
->stop_nan(&local
->hw
, &sdata
->vif
);
1468 trace_drv_return_void(local
);
1471 static inline int drv_nan_change_conf(struct ieee80211_local
*local
,
1472 struct ieee80211_sub_if_data
*sdata
,
1473 struct cfg80211_nan_conf
*conf
,
1479 lockdep_assert_wiphy(local
->hw
.wiphy
);
1480 check_sdata_in_driver(sdata
);
1482 if (!local
->ops
->nan_change_conf
)
1485 trace_drv_nan_change_conf(local
, sdata
, conf
, changes
);
1486 ret
= local
->ops
->nan_change_conf(&local
->hw
, &sdata
->vif
, conf
,
1488 trace_drv_return_int(local
, ret
);
1493 static inline int drv_add_nan_func(struct ieee80211_local
*local
,
1494 struct ieee80211_sub_if_data
*sdata
,
1495 const struct cfg80211_nan_func
*nan_func
)
1500 lockdep_assert_wiphy(local
->hw
.wiphy
);
1501 check_sdata_in_driver(sdata
);
1503 if (!local
->ops
->add_nan_func
)
1506 trace_drv_add_nan_func(local
, sdata
, nan_func
);
1507 ret
= local
->ops
->add_nan_func(&local
->hw
, &sdata
->vif
, nan_func
);
1508 trace_drv_return_int(local
, ret
);
1513 static inline void drv_del_nan_func(struct ieee80211_local
*local
,
1514 struct ieee80211_sub_if_data
*sdata
,
1518 lockdep_assert_wiphy(local
->hw
.wiphy
);
1519 check_sdata_in_driver(sdata
);
1521 trace_drv_del_nan_func(local
, sdata
, instance_id
);
1522 if (local
->ops
->del_nan_func
)
1523 local
->ops
->del_nan_func(&local
->hw
, &sdata
->vif
, instance_id
);
1524 trace_drv_return_void(local
);
1527 static inline int drv_set_tid_config(struct ieee80211_local
*local
,
1528 struct ieee80211_sub_if_data
*sdata
,
1529 struct ieee80211_sta
*sta
,
1530 struct cfg80211_tid_config
*tid_conf
)
1535 lockdep_assert_wiphy(local
->hw
.wiphy
);
1536 ret
= local
->ops
->set_tid_config(&local
->hw
, &sdata
->vif
, sta
,
1538 trace_drv_return_int(local
, ret
);
1543 static inline int drv_reset_tid_config(struct ieee80211_local
*local
,
1544 struct ieee80211_sub_if_data
*sdata
,
1545 struct ieee80211_sta
*sta
, u8 tids
)
1550 lockdep_assert_wiphy(local
->hw
.wiphy
);
1551 ret
= local
->ops
->reset_tid_config(&local
->hw
, &sdata
->vif
, sta
, tids
);
1552 trace_drv_return_int(local
, ret
);
1557 static inline void drv_update_vif_offload(struct ieee80211_local
*local
,
1558 struct ieee80211_sub_if_data
*sdata
)
1561 lockdep_assert_wiphy(local
->hw
.wiphy
);
1562 check_sdata_in_driver(sdata
);
1564 if (!local
->ops
->update_vif_offload
)
1567 trace_drv_update_vif_offload(local
, sdata
);
1568 local
->ops
->update_vif_offload(&local
->hw
, &sdata
->vif
);
1569 trace_drv_return_void(local
);
1572 static inline void drv_sta_set_4addr(struct ieee80211_local
*local
,
1573 struct ieee80211_sub_if_data
*sdata
,
1574 struct ieee80211_sta
*sta
, bool enabled
)
1576 sdata
= get_bss_sdata(sdata
);
1579 lockdep_assert_wiphy(local
->hw
.wiphy
);
1580 if (!check_sdata_in_driver(sdata
))
1583 trace_drv_sta_set_4addr(local
, sdata
, sta
, enabled
);
1584 if (local
->ops
->sta_set_4addr
)
1585 local
->ops
->sta_set_4addr(&local
->hw
, &sdata
->vif
, sta
, enabled
);
1586 trace_drv_return_void(local
);
1589 static inline void drv_sta_set_decap_offload(struct ieee80211_local
*local
,
1590 struct ieee80211_sub_if_data
*sdata
,
1591 struct ieee80211_sta
*sta
,
1594 sdata
= get_bss_sdata(sdata
);
1597 lockdep_assert_wiphy(local
->hw
.wiphy
);
1598 if (!check_sdata_in_driver(sdata
))
1601 trace_drv_sta_set_decap_offload(local
, sdata
, sta
, enabled
);
1602 if (local
->ops
->sta_set_decap_offload
)
1603 local
->ops
->sta_set_decap_offload(&local
->hw
, &sdata
->vif
, sta
,
1605 trace_drv_return_void(local
);
1608 static inline void drv_add_twt_setup(struct ieee80211_local
*local
,
1609 struct ieee80211_sub_if_data
*sdata
,
1610 struct ieee80211_sta
*sta
,
1611 struct ieee80211_twt_setup
*twt
)
1613 struct ieee80211_twt_params
*twt_agrt
;
1616 lockdep_assert_wiphy(local
->hw
.wiphy
);
1618 if (!check_sdata_in_driver(sdata
))
1621 twt_agrt
= (void *)twt
->params
;
1623 trace_drv_add_twt_setup(local
, sta
, twt
, twt_agrt
);
1624 local
->ops
->add_twt_setup(&local
->hw
, sta
, twt
);
1625 trace_drv_return_void(local
);
1628 static inline void drv_twt_teardown_request(struct ieee80211_local
*local
,
1629 struct ieee80211_sub_if_data
*sdata
,
1630 struct ieee80211_sta
*sta
,
1634 lockdep_assert_wiphy(local
->hw
.wiphy
);
1635 if (!check_sdata_in_driver(sdata
))
1638 if (!local
->ops
->twt_teardown_request
)
1641 trace_drv_twt_teardown_request(local
, sta
, flowid
);
1642 local
->ops
->twt_teardown_request(&local
->hw
, sta
, flowid
);
1643 trace_drv_return_void(local
);
1646 static inline int drv_net_fill_forward_path(struct ieee80211_local
*local
,
1647 struct ieee80211_sub_if_data
*sdata
,
1648 struct ieee80211_sta
*sta
,
1649 struct net_device_path_ctx
*ctx
,
1650 struct net_device_path
*path
)
1652 int ret
= -EOPNOTSUPP
;
1654 sdata
= get_bss_sdata(sdata
);
1655 if (!check_sdata_in_driver(sdata
))
1658 trace_drv_net_fill_forward_path(local
, sdata
, sta
);
1659 if (local
->ops
->net_fill_forward_path
)
1660 ret
= local
->ops
->net_fill_forward_path(&local
->hw
,
1663 trace_drv_return_int(local
, ret
);
1668 static inline int drv_net_setup_tc(struct ieee80211_local
*local
,
1669 struct ieee80211_sub_if_data
*sdata
,
1670 struct net_device
*dev
,
1671 enum tc_setup_type type
, void *type_data
)
1673 int ret
= -EOPNOTSUPP
;
1677 sdata
= get_bss_sdata(sdata
);
1678 trace_drv_net_setup_tc(local
, sdata
, type
);
1679 if (local
->ops
->net_setup_tc
)
1680 ret
= local
->ops
->net_setup_tc(&local
->hw
, &sdata
->vif
, dev
,
1682 trace_drv_return_int(local
, ret
);
1687 static inline bool drv_can_activate_links(struct ieee80211_local
*local
,
1688 struct ieee80211_sub_if_data
*sdata
,
1693 lockdep_assert_wiphy(local
->hw
.wiphy
);
1695 if (!check_sdata_in_driver(sdata
))
1698 trace_drv_can_activate_links(local
, sdata
, active_links
);
1699 if (local
->ops
->can_activate_links
)
1700 ret
= local
->ops
->can_activate_links(&local
->hw
, &sdata
->vif
,
1702 trace_drv_return_bool(local
, ret
);
1707 int drv_change_vif_links(struct ieee80211_local
*local
,
1708 struct ieee80211_sub_if_data
*sdata
,
1709 u16 old_links
, u16 new_links
,
1710 struct ieee80211_bss_conf
*old
[IEEE80211_MLD_MAX_NUM_LINKS
]);
1711 int drv_change_sta_links(struct ieee80211_local
*local
,
1712 struct ieee80211_sub_if_data
*sdata
,
1713 struct ieee80211_sta
*sta
,
1714 u16 old_links
, u16 new_links
);
1716 static inline enum ieee80211_neg_ttlm_res
1717 drv_can_neg_ttlm(struct ieee80211_local
*local
,
1718 struct ieee80211_sub_if_data
*sdata
,
1719 struct ieee80211_neg_ttlm
*neg_ttlm
)
1721 enum ieee80211_neg_ttlm_res res
= NEG_TTLM_RES_REJECT
;
1724 if (!check_sdata_in_driver(sdata
))
1727 trace_drv_can_neg_ttlm(local
, sdata
, neg_ttlm
);
1728 if (local
->ops
->can_neg_ttlm
)
1729 res
= local
->ops
->can_neg_ttlm(&local
->hw
, &sdata
->vif
,
1731 trace_drv_neg_ttlm_res(local
, sdata
, res
, neg_ttlm
);
1737 drv_prep_add_interface(struct ieee80211_local
*local
,
1738 enum nl80211_iftype type
)
1740 trace_drv_prep_add_interface(local
, type
);
1741 if (local
->ops
->prep_add_interface
)
1742 local
->ops
->prep_add_interface(&local
->hw
, type
);
1744 trace_drv_return_void(local
);
1747 #endif /* __MAC80211_DRIVER_OPS */