Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
[pandora-kernel.git] / net / mac80211 / work.c
index 6bf787a..e73c8ca 100644 (file)
@@ -30,7 +30,6 @@
 #define IEEE80211_AUTH_MAX_TRIES 3
 #define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
 #define IEEE80211_ASSOC_MAX_TRIES 3
-#define IEEE80211_MAX_PROBE_TRIES 5
 
 enum work_action {
        WORK_ACT_MISMATCH,
@@ -126,12 +125,6 @@ static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
 
        /* determine capability flags */
 
-       if (ieee80211_disable_40mhz_24ghz &&
-           sband->band == IEEE80211_BAND_2GHZ) {
-               cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
-               cap &= ~IEEE80211_HT_CAP_SGI_40;
-       }
-
        switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
        case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
                if (flags & IEEE80211_CHAN_NO_HT40PLUS) {
@@ -874,6 +867,44 @@ 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;
@@ -927,14 +958,22 @@ static void ieee80211_work_work(struct work_struct *work)
                        bool on_oper_chan;
                        bool tmp_chan_changed = false;
                        bool 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);
+
                        if (local->tmp_channel)
                                if ((local->tmp_channel != wk->chan) ||
-                                   (local->tmp_channel_type != wk->chan_type))
+                                   (local->tmp_channel_type != wk_ct))
                                        tmp_chan_changed = true;
 
                        local->tmp_channel = wk->chan;
-                       local->tmp_channel_type = wk->chan_type;
+                       local->tmp_channel_type = wk_ct;
                        /*
                         * Leave the station vifs in awake mode if they
                         * happen to be on the same channel as
@@ -1031,7 +1070,8 @@ static void ieee80211_work_work(struct work_struct *work)
                        continue;
                if (wk->chan != local->tmp_channel)
                        continue;
-               if (wk->chan_type != local->tmp_channel_type)
+               if (ieee80211_work_ct_coexists(wk->chan_type,
+                                              local->tmp_channel_type))
                        continue;
                remain_off_channel = true;
        }