mac80211: unify SW/offload remain-on-channel
Johannes Berg
maintainerRFC 1/1 mac80211: unify SW/offload remain-on-channel
From: Johannes Berg <[email protected]>
Redesign all the off-channel code, getting rid of the generic off-channel work concept, replacing it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC implementation:
* offloaded remain-on-channel couldn't be queued, now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is mutually exclusive with scanning, use the new queue to handle that case -- I expect that it will later depend on a HW flag
The bigger issue though is that there's a bad bug in the current implementation: if we get a mgmt TX request while HW roc is active, and this new request has a wait time, we actually schedule a software ROC instead since we can't guarantee the existing offloaded ROC will still be that long. To fix this, the queuing mechanism was needed.
Overall, this unifies the behaviour between the offloaded and software-implemented case.
--- include/net/mac80211.h | 3 net/mac80211/Makefile | 1 net/mac80211/cfg.c | 356 ++++++++++++++++++------------------------- net/mac80211/ieee80211_i.h | 82 +-------- net/mac80211/iface.c | 23 -- net/mac80211/main.c | 10 - net/mac80211/offchannel.c | 244 ++++++++++++++++++++++++----- net/mac80211/scan.c | 4 net/mac80211/status.c | 22 -- net/mac80211/work.c | 370 --------------------------------------------- 10 files changed, 376 insertions(+), 739 deletions(-)
net/mac80211/Makefile +0 -1
@@ -9,7 +9,6 @@ mac80211-y := \ scan.o offchannel.o \ ht.o agg-tx.o agg-rx.o \ ibss.o \ - work.o \ iface.o \ rate.o \ michael.o \
net/mac80211/ieee80211_i.h +15 -67
122 lines not on this page · raw message
net/mac80211/iface.c +4 -19
@@ -528,10 +528,7 @@ static void ieee80211_do_stop(struct iee*/ netif_tx_stop_all_queues (sdata->dev); -/* -* Purge work for this interface. -*/ -ieee80211_work_purge (sdata); +ieee80211_roc_purge (sdata);/* * Remove all stations associated with this interface.
@@ -637,18 +634,6 @@ static void ieee80211_do_stop(struct ieeieee80211_configure_filter (local);break ;default : -mutex_lock (&local->mtx); -if (local->hw_roc_dev == sdata->dev && - local->hw_roc_channel) { -/* ignore return value since this is racy */ -drv_cancel_remain_on_channel (local); -ieee80211_queue_work (&local->hw, &local->hw_roc_done); - } -mutex_unlock (&local->mtx); - -flush_work (&local->hw_roc_start); -flush_work (&local->hw_roc_done); -flush_work (&sdata->work);/* * When we get here, the interface is marked down.
@@ -1455,8 +1440,8 @@ u32 __ieee80211_recalc_idle(struct ieee8struct ieee80211_sub_if_data *sdata;int count =0 ;bool working = false, scanning = false; -struct ieee80211_work *wk;unsigned int led_trig_start =0 , led_trig_stop =0 ; +struct ieee80211_roc_work *roc;#ifdef CONFIG_PROVE_LOCKING WARN_ON(debug_locks && !lockdep_rtnl_is_held() &&
@@ -1492,9 +1477,9 @@ u32 __ieee80211_recalc_idle(struct ieee8 }if (!local->ops->remain_on_channel) { -list_for_each_entry (wk, &local->work_list, list) { +list_for_each_entry (roc, &local->roc_list, list) { working = true; - wk->sdata->vif.bss_conf.idle = false; + roc->sdata->vif.bss_conf.idle = false; } }
net/mac80211/main.c +1 -9
@@ -625,8 +625,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(INIT_DELAYED_WORK (&local->scan_work, ieee80211_scan_work); -ieee80211_work_init (local); -INIT_WORK (&local->restart_work, ieee80211_restart_work);INIT_WORK (&local->reconfig_filter, ieee80211_reconfig_filter);
@@ -669,7 +667,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(ieee80211_led_names (local); -ieee80211_hw_roc_setup (local); +ieee80211_roc_setup (local);return &local->hw; }
@@ -1009,12 +1007,6 @@ void ieee80211_unregister_hw(struct ieeertnl_unlock (); -/* -* Now all work items will be gone, but the -* timer might still be armed, so delete it -*/ -del_timer_sync (&local->work_timer); -cancel_work_sync (&local->restart_work);cancel_work_sync (&local->reconfig_filter);
net/mac80211/scan.c +2 -2
@@ -324,7 +324,7 @@ static void __ieee80211_scan_completed(sieee80211_mlme_notify_scan_completed (local);ieee80211_ibss_notify_scan_completed (local);ieee80211_mesh_notify_scan_completed (local); -ieee80211_queue_work (&local->hw, &local->work_work); +ieee80211_start_next_roc (local); }void ieee80211_scan_completed (struct ieee80211_hw *hw,bool aborted)
@@ -377,7 +377,7 @@ static int ieee80211_start_sw_scan(strucstatic bool ieee80211_can_scan (struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata) { -if (!list_empty (&local->work_list)) +if (!list_empty (&local->roc_list))return false; if (sdata->vif.type == NL80211_IFTYPE_STATION &&
net/mac80211/status.c +3 -19
@@ -528,26 +528,10 @@ void ieee80211_tx_status(struct ieee8021cfg80211_probe_status (skb->dev, hdr->addr1, cookie, acked,GFP_ATOMIC ); }else { -struct ieee80211_work *wk; - -rcu_read_lock (); -list_for_each_entry_rcu (wk, &local->work_list, list) { -if (wk->type !=IEEE80211_WORK_OFFCHANNEL_TX ) -continue ; -if (wk->offchan_tx.frame != skb) -continue ; - wk->offchan_tx.status = true; -break ; - } -rcu_read_unlock (); -if (local->hw_roc_skb_for_status == skb) { - cookie = local->hw_roc_cookie ^2 ; - local->hw_roc_skb_for_status =NULL ; - } -cfg80211_mgmt_tx_status ( - skb->dev, cookie, skb->data, skb->len, - !!(info->flags &IEEE80211_TX_STAT_ACK ), + skb->dev, (unsigned long )skb, + skb->data, skb->len, + info->flags &IEEE80211_TX_STAT_ACK ,GFP_ATOMIC ); } }
net/mac80211/work.c deleted +0 -370
370 lines not on this page · raw message
net/mac80211/cfg.c +151 -205
444 lines not on this page · raw message
net/mac80211/offchannel.c +200 -44
290 lines not on this page · raw message
include/net/mac80211.h +0 -3
@@ -2184,9 +2184,6 @@ enum ieee80211_rate_control_changed {* normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the * duration (which will always be non-zero) expires, the driver must call * ieee80211_remain_on_channel_expired(). -* The driver must not call ieee80211_remain_on_channel_expired() before -* the TX status for a frame that was sent off-channel, otherwise the TX -* status is reported to userspace in an invalid way. * Note that this callback may be called while the device is in IDLE and * must be accepted in this case. * This callback may sleep.