Lines Matching refs:local
27 struct ieee80211_local *local = sdata->local; in ieee80211_offchannel_ps_enable() local
30 local->offchannel_ps_enabled = false; in ieee80211_offchannel_ps_enable()
34 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_offchannel_ps_enable()
38 cancel_work_sync(&local->dynamic_ps_enable_work); in ieee80211_offchannel_ps_enable()
40 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_offchannel_ps_enable()
41 local->offchannel_ps_enabled = true; in ieee80211_offchannel_ps_enable()
42 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_offchannel_ps_enable()
43 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); in ieee80211_offchannel_ps_enable()
46 if (!local->offchannel_ps_enabled || in ieee80211_offchannel_ps_enable()
47 !ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) in ieee80211_offchannel_ps_enable()
58 ieee80211_send_nullfunc(local, sdata, true); in ieee80211_offchannel_ps_enable()
64 struct ieee80211_local *local = sdata->local; in ieee80211_offchannel_ps_disable() local
66 if (!local->ps_sdata) in ieee80211_offchannel_ps_disable()
67 ieee80211_send_nullfunc(local, sdata, false); in ieee80211_offchannel_ps_disable()
68 else if (local->offchannel_ps_enabled) { in ieee80211_offchannel_ps_disable()
85 local->hw.conf.flags |= IEEE80211_CONF_PS; in ieee80211_offchannel_ps_disable()
86 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); in ieee80211_offchannel_ps_disable()
87 } else if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_offchannel_ps_disable()
94 ieee80211_send_nullfunc(local, sdata, false); in ieee80211_offchannel_ps_disable()
95 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_offchannel_ps_disable()
96 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); in ieee80211_offchannel_ps_disable()
103 void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local) in ieee80211_offchannel_stop_vifs() argument
107 if (WARN_ON(local->use_chanctx)) in ieee80211_offchannel_stop_vifs()
119 ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, in ieee80211_offchannel_stop_vifs()
122 ieee80211_flush_queues(local, NULL, false); in ieee80211_offchannel_stop_vifs()
124 mutex_lock(&local->iflist_mtx); in ieee80211_offchannel_stop_vifs()
125 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_offchannel_stop_vifs()
149 mutex_unlock(&local->iflist_mtx); in ieee80211_offchannel_stop_vifs()
152 void ieee80211_offchannel_return(struct ieee80211_local *local) in ieee80211_offchannel_return() argument
156 if (WARN_ON(local->use_chanctx)) in ieee80211_offchannel_return()
159 mutex_lock(&local->iflist_mtx); in ieee80211_offchannel_return()
160 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_offchannel_return()
182 mutex_unlock(&local->iflist_mtx); in ieee80211_offchannel_return()
184 ieee80211_wake_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, in ieee80211_offchannel_return()
196 ieee80211_free_txskb(&roc->sdata->local->hw, roc->frame); in ieee80211_roc_notify_destroy()
212 static unsigned long ieee80211_end_finished_rocs(struct ieee80211_local *local, in ieee80211_end_finished_rocs() argument
218 lockdep_assert_held(&local->mtx); in ieee80211_end_finished_rocs()
220 list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { in ieee80211_end_finished_rocs()
243 static bool ieee80211_recalc_sw_work(struct ieee80211_local *local, in ieee80211_recalc_sw_work() argument
246 long dur = ieee80211_end_finished_rocs(local, now); in ieee80211_recalc_sw_work()
251 mod_delayed_work(local->workqueue, &local->roc_work, dur); in ieee80211_recalc_sw_work()
281 struct ieee80211_local *local = in ieee80211_hw_roc_start() local
285 mutex_lock(&local->mtx); in ieee80211_hw_roc_start()
287 list_for_each_entry(roc, &local->roc_list, list) { in ieee80211_hw_roc_start()
292 ieee80211_handle_roc_started(roc, local->hw_roc_start_time); in ieee80211_hw_roc_start()
295 mutex_unlock(&local->mtx); in ieee80211_hw_roc_start()
300 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_ready_on_channel() local
302 local->hw_roc_start_time = jiffies; in ieee80211_ready_on_channel()
304 trace_api_ready_on_channel(local); in ieee80211_ready_on_channel()
306 ieee80211_queue_work(hw, &local->hw_roc_start); in ieee80211_ready_on_channel()
310 static void _ieee80211_start_next_roc(struct ieee80211_local *local) in _ieee80211_start_next_roc() argument
316 lockdep_assert_held(&local->mtx); in _ieee80211_start_next_roc()
318 if (WARN_ON(list_empty(&local->roc_list))) in _ieee80211_start_next_roc()
321 roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work, in _ieee80211_start_next_roc()
331 list_for_each_entry(tmp, &local->roc_list, list) { in _ieee80211_start_next_roc()
341 if (local->ops->remain_on_channel) { in _ieee80211_start_next_roc()
342 int ret = drv_remain_on_channel(local, roc->sdata, roc->chan, in _ieee80211_start_next_roc()
346 wiphy_warn(local->hw.wiphy, in _ieee80211_start_next_roc()
352 list_for_each_entry(tmp, &local->roc_list, list) { in _ieee80211_start_next_roc()
359 ieee80211_queue_work(&local->hw, &local->hw_roc_done); in _ieee80211_start_next_roc()
364 list_for_each_entry(tmp, &local->roc_list, list) { in _ieee80211_start_next_roc()
375 roc->on_channel = roc->chan == local->_oper_chandef.chan && in _ieee80211_start_next_roc()
376 local->_oper_chandef.width != NL80211_CHAN_WIDTH_5 && in _ieee80211_start_next_roc()
377 local->_oper_chandef.width != NL80211_CHAN_WIDTH_10; in _ieee80211_start_next_roc()
380 ieee80211_recalc_idle(local); in _ieee80211_start_next_roc()
383 ieee80211_offchannel_stop_vifs(local); in _ieee80211_start_next_roc()
385 local->tmp_channel = roc->chan; in _ieee80211_start_next_roc()
386 ieee80211_hw_config(local, 0); in _ieee80211_start_next_roc()
389 ieee80211_queue_delayed_work(&local->hw, &local->roc_work, in _ieee80211_start_next_roc()
393 list_for_each_entry(tmp, &local->roc_list, list) { in _ieee80211_start_next_roc()
403 void ieee80211_start_next_roc(struct ieee80211_local *local) in ieee80211_start_next_roc() argument
407 lockdep_assert_held(&local->mtx); in ieee80211_start_next_roc()
409 if (list_empty(&local->roc_list)) { in ieee80211_start_next_roc()
410 ieee80211_run_deferred_scan(local); in ieee80211_start_next_roc()
415 if (local->in_reconfig) in ieee80211_start_next_roc()
418 roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work, in ieee80211_start_next_roc()
424 if (local->ops->remain_on_channel) { in ieee80211_start_next_roc()
425 _ieee80211_start_next_roc(local); in ieee80211_start_next_roc()
428 ieee80211_queue_delayed_work(&local->hw, &local->roc_work, in ieee80211_start_next_roc()
433 static void __ieee80211_roc_work(struct ieee80211_local *local) in __ieee80211_roc_work() argument
438 lockdep_assert_held(&local->mtx); in __ieee80211_roc_work()
440 if (WARN_ON(local->ops->remain_on_channel)) in __ieee80211_roc_work()
443 roc = list_first_entry_or_null(&local->roc_list, in __ieee80211_roc_work()
449 WARN_ON(local->use_chanctx); in __ieee80211_roc_work()
450 _ieee80211_start_next_roc(local); in __ieee80211_roc_work()
453 if (ieee80211_recalc_sw_work(local, jiffies)) in __ieee80211_roc_work()
459 ieee80211_flush_queues(local, NULL, false); in __ieee80211_roc_work()
461 local->tmp_channel = NULL; in __ieee80211_roc_work()
462 ieee80211_hw_config(local, 0); in __ieee80211_roc_work()
464 ieee80211_offchannel_return(local); in __ieee80211_roc_work()
467 ieee80211_recalc_idle(local); in __ieee80211_roc_work()
468 ieee80211_start_next_roc(local); in __ieee80211_roc_work()
474 struct ieee80211_local *local = in ieee80211_roc_work() local
477 mutex_lock(&local->mtx); in ieee80211_roc_work()
478 __ieee80211_roc_work(local); in ieee80211_roc_work()
479 mutex_unlock(&local->mtx); in ieee80211_roc_work()
484 struct ieee80211_local *local = in ieee80211_hw_roc_done() local
487 mutex_lock(&local->mtx); in ieee80211_hw_roc_done()
489 ieee80211_end_finished_rocs(local, jiffies); in ieee80211_hw_roc_done()
492 ieee80211_start_next_roc(local); in ieee80211_hw_roc_done()
494 mutex_unlock(&local->mtx); in ieee80211_hw_roc_done()
499 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_remain_on_channel_expired() local
501 trace_api_remain_on_channel_expired(local); in ieee80211_remain_on_channel_expired()
503 ieee80211_queue_work(hw, &local->hw_roc_done); in ieee80211_remain_on_channel_expired()
508 ieee80211_coalesce_hw_started_roc(struct ieee80211_local *local, in ieee80211_coalesce_hw_started_roc() argument
547 static int ieee80211_start_roc_work(struct ieee80211_local *local, in ieee80211_start_roc_work() argument
558 lockdep_assert_held(&local->mtx); in ieee80211_start_roc_work()
560 if (local->use_chanctx && !local->ops->remain_on_channel) in ieee80211_start_roc_work()
591 roc->cookie = ieee80211_mgmt_tx_cookie(local); in ieee80211_start_roc_work()
598 if (list_empty(&local->roc_list) && in ieee80211_start_roc_work()
599 !local->scanning && !ieee80211_is_radar_required(local)) { in ieee80211_start_roc_work()
601 if (!local->ops->remain_on_channel) { in ieee80211_start_roc_work()
602 list_add_tail(&roc->list, &local->roc_list); in ieee80211_start_roc_work()
603 ieee80211_queue_delayed_work(&local->hw, in ieee80211_start_roc_work()
604 &local->roc_work, 0); in ieee80211_start_roc_work()
609 ret = drv_remain_on_channel(local, sdata, channel, in ieee80211_start_roc_work()
616 list_add_tail(&roc->list, &local->roc_list); in ieee80211_start_roc_work()
624 list_for_each_entry(tmp, &local->roc_list, list) { in ieee80211_start_roc_work()
641 if (!local->ops->remain_on_channel) { in ieee80211_start_roc_work()
653 struct wiphy *wiphy = local->hw.wiphy; in ieee80211_start_roc_work()
665 ieee80211_recalc_sw_work(local, now); in ieee80211_start_roc_work()
669 queued = ieee80211_coalesce_hw_started_roc(local, roc, tmp); in ieee80211_start_roc_work()
681 list_add_tail(&roc->list, &local->roc_list); in ieee80211_start_roc_work()
691 struct ieee80211_local *local = sdata->local; in ieee80211_remain_on_channel() local
694 mutex_lock(&local->mtx); in ieee80211_remain_on_channel()
695 ret = ieee80211_start_roc_work(local, sdata, chan, in ieee80211_remain_on_channel()
698 mutex_unlock(&local->mtx); in ieee80211_remain_on_channel()
703 static int ieee80211_cancel_roc(struct ieee80211_local *local, in ieee80211_cancel_roc() argument
712 flush_work(&local->hw_roc_start); in ieee80211_cancel_roc()
714 mutex_lock(&local->mtx); in ieee80211_cancel_roc()
715 list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { in ieee80211_cancel_roc()
726 mutex_unlock(&local->mtx); in ieee80211_cancel_roc()
735 if (local->ops->remain_on_channel) { in ieee80211_cancel_roc()
736 ret = drv_cancel_remain_on_channel(local, roc->sdata); in ieee80211_cancel_roc()
738 mutex_unlock(&local->mtx); in ieee80211_cancel_roc()
747 list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { in ieee80211_cancel_roc()
758 ieee80211_start_next_roc(local); in ieee80211_cancel_roc()
762 mod_delayed_work(local->workqueue, &local->roc_work, 0); in ieee80211_cancel_roc()
766 mutex_unlock(&local->mtx); in ieee80211_cancel_roc()
775 struct ieee80211_local *local = sdata->local; in ieee80211_cancel_remain_on_channel() local
777 return ieee80211_cancel_roc(local, cookie, false); in ieee80211_cancel_remain_on_channel()
784 struct ieee80211_local *local = sdata->local; in ieee80211_mgmt_tx() local
837 local->ops->remain_on_channel && in ieee80211_mgmt_tx()
857 mutex_lock(&local->mtx); in ieee80211_mgmt_tx()
885 skb = dev_alloc_skb(local->hw.extra_tx_headroom + params->len); in ieee80211_mgmt_tx()
890 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_mgmt_tx()
928 ret = ieee80211_attach_ack_skb(local, skb, cookie, GFP_KERNEL); in ieee80211_mgmt_tx()
950 if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) in ieee80211_mgmt_tx()
952 local->hw.offchannel_tx_hw_queue; in ieee80211_mgmt_tx()
955 ret = ieee80211_start_roc_work(local, sdata, params->chan, in ieee80211_mgmt_tx()
959 ieee80211_free_txskb(&local->hw, skb); in ieee80211_mgmt_tx()
961 mutex_unlock(&local->mtx); in ieee80211_mgmt_tx()
968 struct ieee80211_local *local = wiphy_priv(wiphy); in ieee80211_mgmt_tx_cancel_wait() local
970 return ieee80211_cancel_roc(local, cookie, true); in ieee80211_mgmt_tx_cancel_wait()
973 void ieee80211_roc_setup(struct ieee80211_local *local) in ieee80211_roc_setup() argument
975 INIT_WORK(&local->hw_roc_start, ieee80211_hw_roc_start); in ieee80211_roc_setup()
976 INIT_WORK(&local->hw_roc_done, ieee80211_hw_roc_done); in ieee80211_roc_setup()
977 INIT_DELAYED_WORK(&local->roc_work, ieee80211_roc_work); in ieee80211_roc_setup()
978 INIT_LIST_HEAD(&local->roc_list); in ieee80211_roc_setup()
981 void ieee80211_roc_purge(struct ieee80211_local *local, in ieee80211_roc_purge() argument
987 mutex_lock(&local->mtx); in ieee80211_roc_purge()
988 list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { in ieee80211_roc_purge()
993 if (local->ops->remain_on_channel) { in ieee80211_roc_purge()
995 drv_cancel_remain_on_channel(local, sdata); in ieee80211_roc_purge()
1006 __ieee80211_roc_work(local); in ieee80211_roc_purge()
1007 mutex_unlock(&local->mtx); in ieee80211_roc_purge()