madwifi: improve mode selection, do not scan channels which do not fit the desired...
authorFelix Fietkau <nbd@openwrt.org>
Thu, 7 May 2009 11:32:43 +0000 (11:32 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 7 May 2009 11:32:43 +0000 (11:32 +0000)
SVN-Revision: 15663

package/madwifi/patches/351-scanlist.patch
package/madwifi/patches/389-autochannel.patch
package/madwifi/patches/411-autochannel_multi.patch
package/madwifi/patches/418-turbo.patch [deleted file]
package/madwifi/patches/421-channel_handling.patch

index 67e7574..c11f28e 100644 (file)
                /* Identify mode capabilities. */
                if (IEEE80211_IS_CHAN_A(c))
                        ic->ic_modecaps |= 1 << IEEE80211_MODE_11A;
+@@ -1447,10 +1452,6 @@ ieee80211_media_change(struct net_device
+               vap->iv_fixed_rate = newrate;           /* fixed TX rate */
+               error = -ENETRESET;
+       }
+-      if (vap->iv_des_mode != newmode) {
+-              vap->iv_des_mode = newmode;             /* desired PHY mode */
+-              error = -ENETRESET;
+-      }
+       return error;
+ }
+ EXPORT_SYMBOL(ieee80211_media_change);
 --- a/net80211/_ieee80211.h
 +++ b/net80211/_ieee80211.h
 @@ -132,6 +132,11 @@ enum ieee80211_scanmode {
        IEEE80211_WMMPARAMS_CWMIN       = 1,
 --- a/net80211/ieee80211_scan_ap.c
 +++ b/net80211/ieee80211_scan_ap.c
-@@ -129,131 +129,7 @@ struct ap_state {
+@@ -105,11 +105,6 @@ struct scan_entry {
+ };
+ struct ap_state {
+-      unsigned int as_vap_desired_mode;       /* Used for channel selection, 
+-                                               * vap->iv_des_mode */
+-      unsigned int as_required_mode;          /* Used for channel selection, 
+-                                               * filtered version of 
+-                                               * as_vap_desired_mode */
+       int as_maxrssi[IEEE80211_CHAN_MAX];     /* Used for channel selection */
+       /* These fields are just for scan caching for returning responses to
+@@ -129,131 +124,7 @@ struct ap_state {
  
  static int ap_flush(struct ieee80211_scan_state *);
  static void action_tasklet(IEEE80211_TQUEUE_ARG);
  
  /*
   * Attach prior to any scanning work.
-@@ -327,29 +203,6 @@ saveie(u_int8_t **iep, const u_int8_t *i
+@@ -327,29 +198,6 @@ saveie(u_int8_t **iep, const u_int8_t *i
                ieee80211_saveie(iep, ie);
  }
  
  /*
   * Start an ap scan by populating the channel list.
   */
-@@ -358,8 +211,6 @@ ap_start(struct ieee80211_scan_state *ss
+@@ -358,90 +206,15 @@ ap_start(struct ieee80211_scan_state *ss
  {
        struct ap_state *as         = ss->ss_priv;
        struct ieee80211com *ic     = NULL;
        int i;
        unsigned int mode = 0;
  
-@@ -368,80 +219,8 @@ ap_start(struct ieee80211_scan_state *ss
+       SCAN_AP_LOCK_IRQ(as);
+       ic = vap->iv_ic;
        /* Determine mode flags to match, or leave zero for auto mode */
-       as->as_vap_desired_mode = vap->iv_des_mode;
-       as->as_required_mode    = 0;
+-      as->as_vap_desired_mode = vap->iv_des_mode;
+-      as->as_required_mode    = 0;
 -      if (as->as_vap_desired_mode != IEEE80211_MODE_AUTO) {
 -              as->as_required_mode = chanflags[as->as_vap_desired_mode];
 -              if ((vap->iv_ath_cap & IEEE80211_ATHC_TURBOP) && 
 -              }
 -      }
 -
--      ss->ss_last = 0;
+       ss->ss_last = 0;
 -      /* Use the table of ordered channels to construct the list
 -       * of channels for scanning.  Any channels in the ordered
 -       * list not in the master list will be discarded. */
 -              /* XR is not supported on turbo channels */
 -              if (IEEE80211_IS_CHAN_TURBO(c) && vap->iv_flags & IEEE80211_F_XR)
 -                      continue;
-+      ieee80211_scan_add_channels(ic, ss, vap->iv_des_mode);
+-
 -              /* Dynamic channels are scanned in base mode */
 -              if (!as->as_required_mode && !IEEE80211_IS_CHAN_ST(c))
 -                      continue;
 -              /* Make sure the channel is active */
 -              if ((c == NULL) || isclr(ic->ic_chan_active, c->ic_ieee))
 -                      continue;
--
++      ieee80211_scan_add_channels(ic, ss, vap->iv_des_mode);
 -              /* Don't overrun */
 -              if (ss->ss_last >= IEEE80211_SCAN_MAX)
 -                      break;
        ss->ss_next = 0;
        /* XXX tunables */
        ss->ss_mindwell = msecs_to_jiffies(200);        /* 200ms */
-@@ -761,13 +540,6 @@ pick_channel(struct ieee80211_scan_state
+@@ -761,18 +534,6 @@ pick_channel(struct ieee80211_scan_state
                if (IEEE80211_IS_CHAN_RADAR(c->chan))
                        continue;
  
 -                  (as->as_vap_desired_mode != IEEE80211_MODE_TURBO_STATIC_A))
 -                      continue;
 -
-               /* Verify mode matches any fixed mode specified */
-               if((c->chan->ic_flags & as->as_required_mode) != 
-                               as->as_required_mode)
+-              /* Verify mode matches any fixed mode specified */
+-              if((c->chan->ic_flags & as->as_required_mode) != 
+-                              as->as_required_mode)
+-                      continue;
+-
+               if ((ic->ic_bsschan != NULL) &&
+                       (ic->ic_bsschan != IEEE80211_CHAN_ANYC)) {
 --- a/net80211/ieee80211_scan.c
 +++ b/net80211/ieee80211_scan.c
 @@ -958,6 +958,80 @@ ieee80211_scan_flush(struct ieee80211com
index 1c62285..65e03e7 100644 (file)
@@ -95,7 +95,7 @@
  #define       IEEE80211_CHAN_MAX      255
 --- a/net80211/ieee80211_scan_ap.c
 +++ b/net80211/ieee80211_scan_ap.c
-@@ -423,6 +423,19 @@ pc_cmp_rssi(struct ap_state *as, struct 
+@@ -417,6 +417,19 @@ pc_cmp_rssi(struct ap_state *as, struct 
  
  /* This function must be invoked with locks acquired */
  static int
  pc_cmp_samechan(struct ieee80211com *ic, struct ieee80211_channel *a,
                struct ieee80211_channel *b)
  {
-@@ -457,6 +470,7 @@ pc_cmp(const void *_a, const void *_b)
+@@ -451,6 +464,7 @@ pc_cmp(const void *_a, const void *_b)
  
        EVALUATE_CRITERION(radar, a, b);
        EVALUATE_CRITERION(keepmode, params, a, b);
index ab48e70..b6093cf 100644 (file)
        /* update Supported Channels information element */
 --- a/net80211/ieee80211_scan_ap.c
 +++ b/net80211/ieee80211_scan_ap.c
-@@ -213,9 +213,15 @@ ap_start(struct ieee80211_scan_state *ss
+@@ -208,9 +208,15 @@ ap_start(struct ieee80211_scan_state *ss
        struct ieee80211com *ic     = NULL;
        int i;
        unsigned int mode = 0;
 +      spin_unlock_irqrestore(&channel_lock, sflags);
 +
        /* Determine mode flags to match, or leave zero for auto mode */
-       as->as_vap_desired_mode = vap->iv_des_mode;
-       as->as_required_mode    = 0;
-@@ -429,8 +435,10 @@ pc_cmp_idletime(struct ieee80211_channel
+       ss->ss_last = 0;
+       ieee80211_scan_add_channels(ic, ss, vap->iv_des_mode);
+@@ -423,8 +429,10 @@ pc_cmp_idletime(struct ieee80211_channel
        if (!a->ic_idletime || !b->ic_idletime)
                return 0;
  
  }
  
  
-@@ -616,6 +624,7 @@ ap_end(struct ieee80211_scan_state *ss, 
+@@ -605,6 +613,7 @@ ap_end(struct ieee80211_scan_state *ss, 
        struct ap_state *as = ss->ss_priv;
        struct ieee80211_channel *bestchan = NULL;
        struct ieee80211com *ic = NULL;
        int res = 1;
  
        SCAN_AP_LOCK_IRQ(as);
-@@ -624,8 +633,11 @@ ap_end(struct ieee80211_scan_state *ss, 
+@@ -613,8 +622,11 @@ ap_end(struct ieee80211_scan_state *ss, 
                ("wrong opmode %u", vap->iv_opmode));
  
        ic = vap->iv_ic;
                if (ss->ss_last > 0) {
                        /* no suitable channel, should not happen */
                        printk(KERN_ERR "%s: %s: no suitable channel! "
-@@ -644,6 +656,7 @@ ap_end(struct ieee80211_scan_state *ss, 
+@@ -633,6 +645,7 @@ ap_end(struct ieee80211_scan_state *ss, 
                                        bestchan->ic_freq, bestchan->ic_flags &
                                        ~IEEE80211_CHAN_TURBO)) == NULL) {
                                /* should never happen ?? */
                                SCAN_AP_UNLOCK_IRQ_EARLY(as);
                                return 0;
                        }
-@@ -656,6 +669,9 @@ ap_end(struct ieee80211_scan_state *ss, 
+@@ -645,6 +658,9 @@ ap_end(struct ieee80211_scan_state *ss, 
                        as->as_action = action;
                as->as_selbss = se;
  
diff --git a/package/madwifi/patches/418-turbo.patch b/package/madwifi/patches/418-turbo.patch
deleted file mode 100644 (file)
index 4e13f90..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/net80211/ieee80211_scan.c
-+++ b/net80211/ieee80211_scan.c
-@@ -1129,7 +1129,11 @@ ieee80211_scan_add_channels(struct ieee8
-                       continue;
-               if (c->ic_scanflags & IEEE80211_NOSCAN_SET)
-                       continue;
--              if (modeflags &&
-+              if (ss->ss_vap->iv_opmode == IEEE80211_M_HOSTAP) {
-+                      if ((c->ic_flags & (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) !=
-+                          (modeflags & (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)))
-+                              continue;
-+              } else if (modeflags &&
-                       ((c->ic_flags & IEEE80211_CHAN_ALLTURBO) !=
-                        (modeflags & IEEE80211_CHAN_ALLTURBO)))
-                       continue;
index 5418f1b..697dfcf 100644 (file)
        for (i = 0; i < nrates; i++)
                if (IEEERATE(ic, mode, i) == rate)
                        return i;
-@@ -1881,11 +1915,6 @@ ieee80211_build_countryie(struct ieee802
+@@ -1877,11 +1911,6 @@ ieee80211_build_countryie(struct ieee802
                        if (ieee80211_chan2mode(c) != curmode_noturbo)
                                continue;
  
                        if (*cur_runlen == 0) {
                                (*cur_runlen)++;
                                *cur_pow = c->ic_maxregpower;
-@@ -1919,7 +1948,7 @@ void
+@@ -1915,7 +1944,7 @@ void
  ieee80211_build_sc_ie(struct ieee80211com *ic)
  {
        struct ieee80211_ie_sc *ie = &ic->ic_sc_ie;
  
 --- a/net80211/ieee80211_scan_ap.c
 +++ b/net80211/ieee80211_scan_ap.c
-@@ -518,12 +518,13 @@ pick_channel(struct ieee80211_scan_state
+@@ -512,12 +512,13 @@ pick_channel(struct ieee80211_scan_state
        int ss_last = ss->ss_last;
        struct ieee80211_channel *best;
        struct ap_state *as = ss->ss_priv;
        for (i = 0; i < ss_last; i++) {
                chans[i].chan = ss->ss_chans[i];
                chans[i].orig = i;
-@@ -612,6 +613,7 @@ pick_channel(struct ieee80211_scan_state
+@@ -601,6 +602,7 @@ pick_channel(struct ieee80211_scan_state
                                "%s: best: channel %u rssi %d\n",
                                __func__, i, as->as_maxrssi[i]);
        }
        return best;
  }
  
-@@ -647,6 +649,7 @@ ap_end(struct ieee80211_scan_state *ss, 
+@@ -636,6 +638,7 @@ ap_end(struct ieee80211_scan_state *ss, 
                res = 1; /* Do NOT restart scan */
        } else {
                struct ieee80211_scan_entry se;
                /* XXX: notify all VAPs? */
                /* if this is a dynamic turbo frequency , start with normal 
                 * mode first */
-@@ -661,6 +664,11 @@ ap_end(struct ieee80211_scan_state *ss, 
+@@ -650,6 +653,11 @@ ap_end(struct ieee80211_scan_state *ss, 
                                return 0;
                        }
                }