mac80211: revert on-channel work optimisations
authorJohannes Berg <johannes.berg@intel.com>
Tue, 29 Nov 2011 09:20:02 +0000 (10:20 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 30 Nov 2011 20:08:31 +0000 (15:08 -0500)
The on-channel work optimisations have caused a
number of issues, and the code is unfortunately
very complex and almost impossible to follow.
Instead of attempting to put in more workarounds
let's just remove those optimisations, we can
work on them again later, after we change the
whole auth/assoc design.

This should fix rate_control_send_low() warnings,
see RH bug 731365.

Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211_i.h
net/mac80211/main.c
net/mac80211/offchannel.c
net/mac80211/scan.c
net/mac80211/work.c

index a785d61defe14d5b8063721123af7ae5e7cf43c4..bdefa6ba3f4cc71b8a2a3c50564f43f0502220a4 100644 (file)
@@ -1220,13 +1220,11 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
 void ieee80211_sched_scan_stopped_work(struct work_struct *work);
 
 /* off-channel helpers */
-bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
 void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
                                        bool tell_ap);
 void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
                                    bool offchannel_ps_enable);
 void ieee80211_offchannel_return(struct ieee80211_local *local,
-                                bool enable_beaconing,
                                 bool offchannel_ps_disable);
 void ieee80211_hw_roc_setup(struct ieee80211_local *local);
 
index dddedfad5404e8700ebb675206753c9c6f438bd9..944bed35d923af0b3bcfb071e5aa59dc15ef4a87 100644 (file)
@@ -92,47 +92,6 @@ static void ieee80211_reconfig_filter(struct work_struct *work)
        ieee80211_configure_filter(local);
 }
 
-/*
- * Returns true if we are logically configured to be on
- * the operating channel AND the hardware-conf is currently
- * configured on the operating channel.  Compares channel-type
- * as well.
- */
-bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local)
-{
-       struct ieee80211_channel *chan;
-       enum nl80211_channel_type channel_type;
-
-       /* This logic needs to match logic in ieee80211_hw_config */
-       if (local->scan_channel) {
-               chan = local->scan_channel;
-               /* If scanning on oper channel, use whatever channel-type
-                * is currently in use.
-                */
-               if (chan == local->oper_channel)
-                       channel_type = local->_oper_channel_type;
-               else
-                       channel_type = NL80211_CHAN_NO_HT;
-       } else if (local->tmp_channel) {
-               chan = local->tmp_channel;
-               channel_type = local->tmp_channel_type;
-       } else {
-               chan = local->oper_channel;
-               channel_type = local->_oper_channel_type;
-       }
-
-       if (chan != local->oper_channel ||
-           channel_type != local->_oper_channel_type)
-               return false;
-
-       /* Check current hardware-config against oper_channel. */
-       if (local->oper_channel != local->hw.conf.channel ||
-           local->_oper_channel_type != local->hw.conf.channel_type)
-               return false;
-
-       return true;
-}
-
 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
 {
        struct ieee80211_channel *chan;
index ebd8cccac8f277184b14d0b990c80e6ef4b04d93..e4330d843575321742d2a964fb60ed5a10551998 100644 (file)
@@ -156,7 +156,6 @@ void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
 }
 
 void ieee80211_offchannel_return(struct ieee80211_local *local,
-                                bool enable_beaconing,
                                 bool offchannel_ps_disable)
 {
        struct ieee80211_sub_if_data *sdata;
@@ -188,11 +187,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
                        netif_tx_wake_all_queues(sdata->dev);
                }
 
-               /* Check to see if we should re-enable beaconing */
-               if (enable_beaconing &&
-                   (sdata->vif.type == NL80211_IFTYPE_AP ||
-                    sdata->vif.type == NL80211_IFTYPE_ADHOC ||
-                    sdata->vif.type == NL80211_IFTYPE_MESH_POINT))
+               if (sdata->vif.type == NL80211_IFTYPE_AP ||
+                   sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+                   sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
                        ieee80211_bss_info_change_notify(
                                sdata, BSS_CHANGED_BEACON_ENABLED);
        }
index 81863031e0a326116b6aad620ac4df6667929d7e..2c5041cc71f81556dbbb970355def8f546d52542 100644 (file)
@@ -297,7 +297,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
        if (!was_hw_scan) {
                ieee80211_configure_filter(local);
                drv_sw_scan_complete(local);
-               ieee80211_offchannel_return(local, true, true);
+               ieee80211_offchannel_return(local, true);
        }
 
        ieee80211_recalc_idle(local);
@@ -602,7 +602,7 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local,
         * in off-channel state..will put that back
         * on-channel at the end of scanning.
         */
-       ieee80211_offchannel_return(local, true, false);
+       ieee80211_offchannel_return(local, false);
 
        *next_delay = HZ / 5;
        /* afterwards, resume scan & go to next channel */
index 6884a2d986dc99d5f1e803f08e20376559ece9dc..c6dd01a05291e25865bac897a67353785131a4fa 100644 (file)
@@ -862,44 +862,6 @@ static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local,
        kfree_skb(skb);
 }
 
-static bool ieee80211_work_ct_coexists(enum nl80211_channel_type wk_ct,
-                                      enum nl80211_channel_type oper_ct)
-{
-       switch (wk_ct) {
-       case NL80211_CHAN_NO_HT:
-               return true;
-       case NL80211_CHAN_HT20:
-               if (oper_ct != NL80211_CHAN_NO_HT)
-                       return true;
-               return false;
-       case NL80211_CHAN_HT40MINUS:
-       case NL80211_CHAN_HT40PLUS:
-               return (wk_ct == oper_ct);
-       }
-       WARN_ON(1); /* shouldn't get here */
-       return false;
-}
-
-static enum nl80211_channel_type
-ieee80211_calc_ct(enum nl80211_channel_type wk_ct,
-                 enum nl80211_channel_type oper_ct)
-{
-       switch (wk_ct) {
-       case NL80211_CHAN_NO_HT:
-               return oper_ct;
-       case NL80211_CHAN_HT20:
-               if (oper_ct != NL80211_CHAN_NO_HT)
-                       return oper_ct;
-               return wk_ct;
-       case NL80211_CHAN_HT40MINUS:
-       case NL80211_CHAN_HT40PLUS:
-               return wk_ct;
-       }
-       WARN_ON(1); /* shouldn't get here */
-       return wk_ct;
-}
-
-
 static void ieee80211_work_timer(unsigned long data)
 {
        struct ieee80211_local *local = (void *) data;
@@ -950,40 +912,12 @@ static void ieee80211_work_work(struct work_struct *work)
                }
 
                if (!started && !local->tmp_channel) {
-                       bool on_oper_chan, on_oper_chan2;
-                       enum nl80211_channel_type wk_ct;
-
-                       on_oper_chan = ieee80211_cfg_on_oper_channel(local);
-
-                       /* Work with existing channel type if possible. */
-                       wk_ct = wk->chan_type;
-                       if (wk->chan == local->hw.conf.channel)
-                               wk_ct = ieee80211_calc_ct(wk->chan_type,
-                                               local->hw.conf.channel_type);
+                       ieee80211_offchannel_stop_vifs(local, true);
 
                        local->tmp_channel = wk->chan;
-                       local->tmp_channel_type = wk_ct;
-                       /*
-                        * Leave the station vifs in awake mode if they
-                        * happen to be on the same channel as
-                        * the requested channel.
-                        */
-                       on_oper_chan2 = ieee80211_cfg_on_oper_channel(local);
-                       if (on_oper_chan != on_oper_chan2) {
-                               if (on_oper_chan2) {
-                                       /* going off oper channel, PS too */
-                                       ieee80211_offchannel_stop_vifs(local,
-                                                                      true);
-                                       ieee80211_hw_config(local, 0);
-                               } else {
-                                       /* going on channel, but leave PS
-                                        * off-channel. */
-                                       ieee80211_hw_config(local, 0);
-                                       ieee80211_offchannel_return(local,
-                                                                   true,
-                                                                   false);
-                               }
-                       }
+                       local->tmp_channel_type = wk->chan_type;
+
+                       ieee80211_hw_config(local, 0);
 
                        started = true;
                        wk->timeout = jiffies;
@@ -1052,34 +986,17 @@ static void ieee80211_work_work(struct work_struct *work)
        list_for_each_entry(wk, &local->work_list, list) {
                if (!wk->started)
                        continue;
-               if (wk->chan != local->tmp_channel)
-                       continue;
-               if (!ieee80211_work_ct_coexists(wk->chan_type,
-                                               local->tmp_channel_type))
+               if (wk->chan != local->tmp_channel ||
+                   wk->chan_type != local->tmp_channel_type)
                        continue;
                remain_off_channel = true;
        }
 
        if (!remain_off_channel && local->tmp_channel) {
                local->tmp_channel = NULL;
-               /* If tmp_channel wasn't operating channel, then
-                * we need to go back on-channel.
-                * NOTE:  If we can ever be here while scannning,
-                * or if the hw_config() channel config logic changes,
-                * then we may need to do a more thorough check to see if
-                * we still need to do a hardware config.  Currently,
-                * we cannot be here while scanning, however.
-                */
-               if (!ieee80211_cfg_on_oper_channel(local))
-                       ieee80211_hw_config(local, 0);
+               ieee80211_hw_config(local, 0);
 
-               /* At the least, we need to disable offchannel_ps,
-                * so just go ahead and run the entire offchannel
-                * return logic here.  We *could* skip enabling
-                * beaconing if we were already on-oper-channel
-                * as a future optimization.
-                */
-               ieee80211_offchannel_return(local, true, true);
+               ieee80211_offchannel_return(local, true);
 
                /* give connection some time to breathe */
                run_again(local, jiffies + HZ/2);