Lines Matching +full:ac +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2022-2024 Intel Corporation
9 #include "driver-ops.h"
18 lockdep_assert_wiphy(local->hw.wiphy); in drv_start()
20 if (WARN_ON(local->started)) in drv_start()
21 return -EALREADY; in drv_start()
24 local->started = true; in drv_start()
27 ret = local->ops->start(&local->hw); in drv_start()
31 local->started = false; in drv_start()
39 lockdep_assert_wiphy(local->hw.wiphy); in drv_stop()
41 if (WARN_ON(!local->started)) in drv_stop()
45 local->ops->stop(&local->hw, suspend); in drv_stop()
49 tasklet_disable(&local->tasklet); in drv_stop()
50 tasklet_enable(&local->tasklet); in drv_stop()
54 local->started = false; in drv_stop()
63 lockdep_assert_wiphy(local->hw.wiphy); in drv_add_interface()
65 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN || in drv_add_interface()
66 (sdata->vif.type == NL80211_IFTYPE_MONITOR && in drv_add_interface()
67 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) && in drv_add_interface()
68 !(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE)))) in drv_add_interface()
69 return -EINVAL; in drv_add_interface()
72 ret = local->ops->add_interface(&local->hw, &sdata->vif); in drv_add_interface()
78 if (!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) { in drv_add_interface()
79 sdata->flags |= IEEE80211_SDATA_IN_DRIVER; in drv_add_interface()
83 ieee80211_link_debugfs_drv_add(&sdata->deflink); in drv_add_interface()
96 lockdep_assert_wiphy(local->hw.wiphy); in drv_change_interface()
99 return -EIO; in drv_change_interface()
102 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); in drv_change_interface()
111 lockdep_assert_wiphy(local->hw.wiphy); in drv_remove_interface()
116 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in drv_remove_interface()
119 ieee80211_debugfs_recreate_netdev(sdata, sdata->vif.valid_links); in drv_remove_interface()
122 local->ops->remove_interface(&local->hw, &sdata->vif); in drv_remove_interface()
136 lockdep_assert_wiphy(local->hw.wiphy); in drv_sta_state()
140 return -EIO; in drv_sta_state()
142 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); in drv_sta_state()
143 if (local->ops->sta_state) { in drv_sta_state()
144 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta, in drv_sta_state()
148 ret = drv_sta_add(local, sdata, &sta->sta); in drv_sta_state()
150 sta->uploaded = true; in drv_sta_state()
151 if (rcu_access_pointer(sta->sta.rates)) in drv_sta_state()
152 drv_sta_rate_tbl_update(local, sdata, &sta->sta); in drv_sta_state()
156 drv_sta_remove(local, sdata, &sta->sta); in drv_sta_state()
167 int ret = -EOPNOTSUPP; in drv_sta_set_txpwr()
170 lockdep_assert_wiphy(local->hw.wiphy); in drv_sta_set_txpwr()
174 return -EIO; in drv_sta_set_txpwr()
176 trace_drv_sta_set_txpwr(local, sdata, &sta->sta); in drv_sta_set_txpwr()
177 if (local->ops->sta_set_txpwr) in drv_sta_set_txpwr()
178 ret = local->ops->sta_set_txpwr(&local->hw, &sdata->vif, in drv_sta_set_txpwr()
179 &sta->sta); in drv_sta_set_txpwr()
193 (sdata->vif.type != NL80211_IFTYPE_ADHOC && in drv_sta_rc_update()
194 sdata->vif.type != NL80211_IFTYPE_MESH_POINT)); in drv_sta_rc_update()
197 if (local->ops->sta_rc_update) in drv_sta_rc_update()
198 local->ops->sta_rc_update(&local->hw, &sdata->vif, in drv_sta_rc_update()
205 struct ieee80211_link_data *link, u16 ac, in drv_conf_tx() argument
208 struct ieee80211_sub_if_data *sdata = link->sdata; in drv_conf_tx()
209 int ret = -EOPNOTSUPP; in drv_conf_tx()
212 lockdep_assert_wiphy(local->hw.wiphy); in drv_conf_tx()
215 return -EIO; in drv_conf_tx()
217 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) in drv_conf_tx()
220 if (params->cw_min == 0 || params->cw_min > params->cw_max) { in drv_conf_tx()
225 WARN_ONCE(local->ops->conf_tx, in drv_conf_tx()
227 sdata->name, params->cw_min, params->cw_max); in drv_conf_tx()
228 return -EINVAL; in drv_conf_tx()
231 trace_drv_conf_tx(local, sdata, link->link_id, ac, params); in drv_conf_tx()
232 if (local->ops->conf_tx) in drv_conf_tx()
233 ret = local->ops->conf_tx(&local->hw, &sdata->vif, in drv_conf_tx()
234 link->link_id, ac, params); in drv_conf_tx()
242 u64 ret = -1ULL; in drv_get_tsf()
245 lockdep_assert_wiphy(local->hw.wiphy); in drv_get_tsf()
251 if (local->ops->get_tsf) in drv_get_tsf()
252 ret = local->ops->get_tsf(&local->hw, &sdata->vif); in drv_get_tsf()
262 lockdep_assert_wiphy(local->hw.wiphy); in drv_set_tsf()
268 if (local->ops->set_tsf) in drv_set_tsf()
269 local->ops->set_tsf(&local->hw, &sdata->vif, tsf); in drv_set_tsf()
278 lockdep_assert_wiphy(local->hw.wiphy); in drv_offset_tsf()
284 if (local->ops->offset_tsf) in drv_offset_tsf()
285 local->ops->offset_tsf(&local->hw, &sdata->vif, offset); in drv_offset_tsf()
293 lockdep_assert_wiphy(local->hw.wiphy); in drv_reset_tsf()
299 if (local->ops->reset_tsf) in drv_reset_tsf()
300 local->ops->reset_tsf(&local->hw, &sdata->vif); in drv_reset_tsf()
312 lockdep_assert_wiphy(local->hw.wiphy); in drv_assign_vif_chanctx()
316 * make it call ->config() when the chanctx is actually in drv_assign_vif_chanctx()
321 if (sdata->vif.type == NL80211_IFTYPE_MONITOR && in drv_assign_vif_chanctx()
322 local->emulate_chanctx && in drv_assign_vif_chanctx()
323 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) in drv_assign_vif_chanctx()
327 return -EIO; in drv_assign_vif_chanctx()
329 if (!ieee80211_vif_link_active(&sdata->vif, link_conf->link_id)) in drv_assign_vif_chanctx()
333 if (local->ops->assign_vif_chanctx) { in drv_assign_vif_chanctx()
334 WARN_ON_ONCE(!ctx->driver_present); in drv_assign_vif_chanctx()
335 ret = local->ops->assign_vif_chanctx(&local->hw, in drv_assign_vif_chanctx()
336 &sdata->vif, in drv_assign_vif_chanctx()
338 &ctx->conf); in drv_assign_vif_chanctx()
351 lockdep_assert_wiphy(local->hw.wiphy); in drv_unassign_vif_chanctx()
353 if (sdata->vif.type == NL80211_IFTYPE_MONITOR && in drv_unassign_vif_chanctx()
354 local->emulate_chanctx && in drv_unassign_vif_chanctx()
355 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) in drv_unassign_vif_chanctx()
361 if (!ieee80211_vif_link_active(&sdata->vif, link_conf->link_id)) in drv_unassign_vif_chanctx()
365 if (local->ops->unassign_vif_chanctx) { in drv_unassign_vif_chanctx()
366 WARN_ON_ONCE(!ctx->driver_present); in drv_unassign_vif_chanctx()
367 local->ops->unassign_vif_chanctx(&local->hw, in drv_unassign_vif_chanctx()
368 &sdata->vif, in drv_unassign_vif_chanctx()
370 &ctx->conf); in drv_unassign_vif_chanctx()
383 lockdep_assert_wiphy(local->hw.wiphy); in drv_switch_vif_chanctx()
385 if (!local->ops->switch_vif_chanctx) in drv_switch_vif_chanctx()
386 return -EOPNOTSUPP; in drv_switch_vif_chanctx()
398 WARN_ON_ONCE(!old_ctx->driver_present); in drv_switch_vif_chanctx()
400 new_ctx->driver_present) || in drv_switch_vif_chanctx()
402 !new_ctx->driver_present)); in drv_switch_vif_chanctx()
406 ret = local->ops->switch_vif_chanctx(&local->hw, in drv_switch_vif_chanctx()
421 new_ctx->driver_present = true; in drv_switch_vif_chanctx()
422 old_ctx->driver_present = false; in drv_switch_vif_chanctx()
433 int ret = -EOPNOTSUPP; in drv_ampdu_action()
436 lockdep_assert_wiphy(local->hw.wiphy); in drv_ampdu_action()
440 return -EIO; in drv_ampdu_action()
444 if (local->ops->ampdu_action) in drv_ampdu_action()
445 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, params); in drv_ampdu_action()
458 lockdep_assert_wiphy(local->hw.wiphy); in drv_link_info_changed()
462 sdata->vif.type != NL80211_IFTYPE_AP && in drv_link_info_changed()
463 sdata->vif.type != NL80211_IFTYPE_ADHOC && in drv_link_info_changed()
464 sdata->vif.type != NL80211_IFTYPE_MESH_POINT && in drv_link_info_changed()
465 sdata->vif.type != NL80211_IFTYPE_OCB)) in drv_link_info_changed()
468 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE || in drv_link_info_changed()
469 sdata->vif.type == NL80211_IFTYPE_NAN || in drv_link_info_changed()
470 (sdata->vif.type == NL80211_IFTYPE_MONITOR && in drv_link_info_changed()
471 !sdata->vif.bss_conf.mu_mimo_owner && in drv_link_info_changed()
478 if (!ieee80211_vif_link_active(&sdata->vif, link_id)) in drv_link_info_changed()
482 if (local->ops->link_info_changed) in drv_link_info_changed()
483 local->ops->link_info_changed(&local->hw, &sdata->vif, in drv_link_info_changed()
485 else if (local->ops->bss_info_changed) in drv_link_info_changed()
486 local->ops->bss_info_changed(&local->hw, &sdata->vif, in drv_link_info_changed()
500 lockdep_assert_wiphy(local->hw.wiphy); in drv_set_key()
504 return -EIO; in drv_set_key()
506 if (WARN_ON(key->link_id >= 0 && sdata->vif.active_links && in drv_set_key()
507 !(sdata->vif.active_links & BIT(key->link_id)))) in drv_set_key()
508 return -ENOLINK; in drv_set_key()
511 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); in drv_set_key()
521 struct ieee80211_link_data *link; in drv_change_vif_links() local
525 int ret = -EOPNOTSUPP; in drv_change_vif_links()
528 lockdep_assert_wiphy(local->hw.wiphy); in drv_change_vif_links()
531 return -EIO; in drv_change_vif_links()
540 link = rcu_access_pointer(sdata->link[link_id]); in drv_change_vif_links()
542 ieee80211_link_debugfs_drv_remove(link); in drv_change_vif_links()
546 if (local->ops->change_vif_links) in drv_change_vif_links()
547 ret = local->ops->change_vif_links(&local->hw, &sdata->vif, in drv_change_vif_links()
554 if (!local->in_reconfig && !local->resuming) { in drv_change_vif_links()
557 link = rcu_access_pointer(sdata->link[link_id]); in drv_change_vif_links()
559 ieee80211_link_debugfs_drv_add(link); in drv_change_vif_links()
576 int ret = -EOPNOTSUPP; in drv_change_sta_links()
579 lockdep_assert_wiphy(local->hw.wiphy); in drv_change_sta_links()
582 return -EIO; in drv_change_sta_links()
584 old_links &= sdata->vif.active_links; in drv_change_sta_links()
585 new_links &= sdata->vif.active_links; in drv_change_sta_links()
594 link_sta = rcu_dereference_protected(info->link[link_id], in drv_change_sta_links()
595 lockdep_is_held(&local->hw.wiphy->mtx)); in drv_change_sta_links()
601 if (local->ops->change_sta_links) in drv_change_sta_links()
602 ret = local->ops->change_sta_links(&local->hw, &sdata->vif, sta, in drv_change_sta_links()
610 if (local->in_reconfig || local->resuming) in drv_change_sta_links()
614 link_sta = rcu_dereference_protected(info->link[link_id], in drv_change_sta_links()
615 lockdep_is_held(&local->hw.wiphy->mtx)); in drv_change_sta_links()