PERFORCE change 136531 for review
Sam Leffler
sam at FreeBSD.org
Fri Feb 29 23:35:34 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=136531
Change 136531 by sam at sam_ebb on 2008/02/29 23:35:12
merge adhoc mode scan changes from HEAD (done differently)
Affected files ...
.. //depot/projects/vap/sys/net80211/ieee80211_scan_sta.c#19 edit
Differences ...
==== //depot/projects/vap/sys/net80211/ieee80211_scan_sta.c#19 (text+ko) ====
@@ -441,67 +441,12 @@
#undef N
}
-static const uint16_t rcl1[] = /* 8 FCC channel: 52, 56, 60, 64, 36, 40, 44, 48 */
-{ 5260, 5280, 5300, 5320, 5180, 5200, 5220, 5240 };
-static const uint16_t rcl2[] = /* 4 MKK channels: 34, 38, 42, 46 */
-{ 5170, 5190, 5210, 5230 };
-static const uint16_t rcl3[] = /* 2.4Ghz ch: 1,6,11,7,13 */
-{ 2412, 2437, 2462, 2442, 2472 };
-static const uint16_t rcl4[] = /* 5 FCC channel: 149, 153, 161, 165 */
-{ 5745, 5765, 5785, 5805, 5825 };
-static const uint16_t rcl7[] = /* 11 ETSI channel: 100,104,108,112,116,120,124,128,132,136,140 */
-{ 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700 };
-static const uint16_t rcl8[] = /* 2.4Ghz ch: 2,3,4,5,8,9,10,12 */
-{ 2417, 2422, 2427, 2432, 2447, 2452, 2457, 2467 };
-static const uint16_t rcl9[] = /* 2.4Ghz ch: 14 */
-{ 2484 };
-static const uint16_t rcl10[] = /* Added Korean channels 2312-2372 */
-{ 2312, 2317, 2322, 2327, 2332, 2337, 2342, 2347, 2352, 2357, 2362, 2367, 2372 };
-static const uint16_t rcl11[] = /* Added Japan channels in 4.9/5.0 spectrum */
-{ 5040, 5060, 5080, 4920, 4940, 4960, 4980 };
-#ifdef ATH_TURBO_SCAN
-static const uint16_t rcl5[] = /* 3 static turbo channels */
-{ 5210, 5250, 5290 };
-static const uint16_t rcl6[] = /* 2 static turbo channels */
-{ 5760, 5800 };
-static const uint16_t rcl6x[] = /* 4 FCC3 turbo channels */
-{ 5540, 5580, 5620, 5660 };
-static const uint16_t rcl12[] = /* 2.4Ghz Turbo channel 6 */
-{ 2437 };
-static const uint16_t rcl13[] = /* dynamic Turbo channels */
-{ 5200, 5240, 5280, 5765, 5805 };
-#endif /* ATH_TURBO_SCAN */
-
struct scanlist {
uint16_t mode;
uint16_t count;
const uint16_t *list;
};
-#define X(a) .count = sizeof(a)/sizeof(a[0]), .list = a
-
-static const struct scanlist staScanTable[] = {
- { IEEE80211_MODE_11B, X(rcl3) },
- { IEEE80211_MODE_11A, X(rcl1) },
- { IEEE80211_MODE_11A, X(rcl2) },
- { IEEE80211_MODE_11B, X(rcl8) },
- { IEEE80211_MODE_11B, X(rcl9) },
- { IEEE80211_MODE_11A, X(rcl4) },
-#ifdef ATH_TURBO_SCAN
- { IEEE80211_MODE_STURBO_A, X(rcl5) },
- { IEEE80211_MODE_STURBO_A, X(rcl6) },
- { IEEE80211_MODE_TURBO_A, X(rcl6x) },
- { IEEE80211_MODE_TURBO_A, X(rcl13) },
-#endif /* ATH_TURBO_SCAN */
- { IEEE80211_MODE_11A, X(rcl7) },
- { IEEE80211_MODE_11B, X(rcl10) },
- { IEEE80211_MODE_11A, X(rcl11) },
-#ifdef ATH_TURBO_SCAN
- { IEEE80211_MODE_TURBO_G, X(rcl12) },
-#endif /* ATH_TURBO_SCAN */
- { .list = NULL }
-};
-
static int
checktable(const struct scanlist *scan, const struct ieee80211_channel *c)
{
@@ -516,14 +461,61 @@
}
static void
-sta_makescanlist(struct ieee80211_scan_state *ss, struct ieee80211vap *vap)
+sweepchannels(struct ieee80211_scan_state *ss, struct ieee80211vap *vap,
+ const struct scanlist table[])
{
-#define N(a) (sizeof(a)/sizeof(a[0]))
struct ieee80211com *ic = vap->iv_ic;
+ struct ieee80211_channel *c;
+ int i;
+
+ for (i = 0; i < ic->ic_nchans; i++) {
+ if (ss->ss_last >= IEEE80211_SCAN_MAX)
+ break;
+
+ c = &ic->ic_channels[i];
+ /*
+ * Ignore dynamic turbo channels; we scan them
+ * in normal mode (i.e. not boosted). Likewise
+ * for HT channels, they get scanned using
+ * legacy rates.
+ */
+ if (IEEE80211_IS_CHAN_DTURBO(c) || IEEE80211_IS_CHAN_HT(c))
+ continue;
+
+ /*
+ * If a desired mode was specified, scan only
+ * channels that satisfy that constraint.
+ */
+ if (vap->iv_des_mode != IEEE80211_MODE_AUTO &&
+ vap->iv_des_mode != ieee80211_chan2mode(c))
+ continue;
+
+ /*
+ * Skip channels excluded by user request.
+ */
+ if (isexcluded(vap, c))
+ continue;
+
+ /*
+ * Add the channel unless it is listed in the
+ * fixed scan order tables. This insures we
+ * don't sweep back in channels we filtered out
+ * above.
+ */
+ if (checktable(table, c))
+ continue;
+
+ /* Add channel to scanning list. */
+ ss->ss_chans[ss->ss_last++] = c;
+ }
+}
+
+static void
+makescanlist(struct ieee80211_scan_state *ss, struct ieee80211vap *vap,
+ const struct scanlist table[])
+{
const struct scanlist *scan;
enum ieee80211_phymode mode;
- struct ieee80211_channel *c;
- int i;
ss->ss_last = 0;
/*
@@ -531,7 +523,7 @@
* of channels for scanning. Any channels in the ordered
* list not in the master list will be discarded.
*/
- for (scan = staScanTable; scan->list != NULL; scan++) {
+ for (scan = table; scan->list != NULL; scan++) {
mode = scan->mode;
if (vap->iv_des_mode != IEEE80211_MODE_AUTO) {
/*
@@ -574,46 +566,65 @@
/*
* Add the channels from the ic that are not present
- * in the staScanTable.
+ * in the table.
*/
- for (i = 0; i < ic->ic_nchans; i++) {
- if (ss->ss_last >= IEEE80211_SCAN_MAX)
- break;
- c = &ic->ic_channels[i];
- /*
- * Ignore dynamic turbo channels; we scan them
- * in normal mode (i.e. not boosted). Likewise
- * for HT channels, they get scanned using
- * legacy rates.
- */
- if (IEEE80211_IS_CHAN_DTURBO(c) || IEEE80211_IS_CHAN_HT(c))
- continue;
- /*
- * If a desired mode was specified, scan only
- * channels that satisfy that constraint.
- */
- if (vap->iv_des_mode != IEEE80211_MODE_AUTO &&
- vap->iv_des_mode != ieee80211_chan2mode(c))
- continue;
- /*
- * Skip channels excluded by user request.
- */
- if (isexcluded(vap, c))
- continue;
- /*
- * Add the channel unless it is listed in the
- * fixed scan order tables. This insures we
- * don't sweep back in channels we filtered out
- * above.
- */
- if (checktable(staScanTable, c))
- continue;
+ sweepchannels(ss, vap, table);
+}
+
+static const uint16_t rcl1[] = /* 8 FCC channel: 52, 56, 60, 64, 36, 40, 44, 48 */
+{ 5260, 5280, 5300, 5320, 5180, 5200, 5220, 5240 };
+static const uint16_t rcl2[] = /* 4 MKK channels: 34, 38, 42, 46 */
+{ 5170, 5190, 5210, 5230 };
+static const uint16_t rcl3[] = /* 2.4Ghz ch: 1,6,11,7,13 */
+{ 2412, 2437, 2462, 2442, 2472 };
+static const uint16_t rcl4[] = /* 5 FCC channel: 149, 153, 161, 165 */
+{ 5745, 5765, 5785, 5805, 5825 };
+static const uint16_t rcl7[] = /* 11 ETSI channel: 100,104,108,112,116,120,124,128,132,136,140 */
+{ 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700 };
+static const uint16_t rcl8[] = /* 2.4Ghz ch: 2,3,4,5,8,9,10,12 */
+{ 2417, 2422, 2427, 2432, 2447, 2452, 2457, 2467 };
+static const uint16_t rcl9[] = /* 2.4Ghz ch: 14 */
+{ 2484 };
+static const uint16_t rcl10[] = /* Added Korean channels 2312-2372 */
+{ 2312, 2317, 2322, 2327, 2332, 2337, 2342, 2347, 2352, 2357, 2362, 2367, 2372 };
+static const uint16_t rcl11[] = /* Added Japan channels in 4.9/5.0 spectrum */
+{ 5040, 5060, 5080, 4920, 4940, 4960, 4980 };
+#ifdef ATH_TURBO_SCAN
+static const uint16_t rcl5[] = /* 3 static turbo channels */
+{ 5210, 5250, 5290 };
+static const uint16_t rcl6[] = /* 2 static turbo channels */
+{ 5760, 5800 };
+static const uint16_t rcl6x[] = /* 4 FCC3 turbo channels */
+{ 5540, 5580, 5620, 5660 };
+static const uint16_t rcl12[] = /* 2.4Ghz Turbo channel 6 */
+{ 2437 };
+static const uint16_t rcl13[] = /* dynamic Turbo channels */
+{ 5200, 5240, 5280, 5765, 5805 };
+#endif /* ATH_TURBO_SCAN */
+
+#define X(a) .count = sizeof(a)/sizeof(a[0]), .list = a
- /* Add channel to scanning list. */
- ss->ss_chans[ss->ss_last++] = c;
- }
-#undef N
-}
+static const struct scanlist staScanTable[] = {
+ { IEEE80211_MODE_11B, X(rcl3) },
+ { IEEE80211_MODE_11A, X(rcl1) },
+ { IEEE80211_MODE_11A, X(rcl2) },
+ { IEEE80211_MODE_11B, X(rcl8) },
+ { IEEE80211_MODE_11B, X(rcl9) },
+ { IEEE80211_MODE_11A, X(rcl4) },
+#ifdef ATH_TURBO_SCAN
+ { IEEE80211_MODE_STURBO_A, X(rcl5) },
+ { IEEE80211_MODE_STURBO_A, X(rcl6) },
+ { IEEE80211_MODE_TURBO_A, X(rcl6x) },
+ { IEEE80211_MODE_TURBO_A, X(rcl13) },
+#endif /* ATH_TURBO_SCAN */
+ { IEEE80211_MODE_11A, X(rcl7) },
+ { IEEE80211_MODE_11B, X(rcl10) },
+ { IEEE80211_MODE_11A, X(rcl11) },
+#ifdef ATH_TURBO_SCAN
+ { IEEE80211_MODE_TURBO_G, X(rcl12) },
+#endif /* ATH_TURBO_SCAN */
+ { .list = NULL }
+};
/*
* Start a station-mode scan by populating the channel list.
@@ -623,7 +634,7 @@
{
struct sta_table *st = ss->ss_priv;
- sta_makescanlist(ss, vap);
+ makescanlist(ss, vap, staScanTable);
if (ss->ss_mindwell == 0)
ss->ss_mindwell = msecs_to_ticks(20); /* 20ms */
@@ -1269,57 +1280,10 @@
static int
adhoc_start(struct ieee80211_scan_state *ss, struct ieee80211vap *vap)
{
-#define N(a) (sizeof(a)/sizeof(a[0]))
struct sta_table *st = ss->ss_priv;
- const struct scanlist *scan;
- enum ieee80211_phymode mode;
- 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.
- */
- for (scan = adhocScanTable; scan->list != NULL; scan++) {
- mode = scan->mode;
- if (vap->iv_des_mode != IEEE80211_MODE_AUTO) {
- /*
- * If a desired mode was specified, scan only
- * channels that satisfy that constraint.
- */
- if (vap->iv_des_mode != mode) {
- /*
- * The scan table marks 2.4Ghz channels as b
- * so if the desired mode is 11g, then use
- * the 11b channel list but upgrade the mode.
- */
- /* XXX 11n upgrade */
- if (vap->iv_des_mode != IEEE80211_MODE_11G ||
- mode != IEEE80211_MODE_11B)
- continue;
- mode = IEEE80211_MODE_11G; /* upgrade */
- }
- } else {
- /*
- * This lets add_channels upgrade an 11b channel
- * to 11g if available.
- */
- if (mode == IEEE80211_MODE_11B)
- mode = IEEE80211_MODE_AUTO;
- }
-#ifdef IEEE80211_F_XR
- /* XR does not operate on turbo channels */
- if ((vap->iv_flags & IEEE80211_F_XR) &&
- (mode == IEEE80211_MODE_TURBO_A ||
- mode == IEEE80211_MODE_TURBO_G))
- continue;
-#endif
- /*
- * Add the list of the channels; any that are not
- * in the master channel list will be discarded.
- */
- add_channels(vap, ss, mode, scan->list, scan->count);
- }
+ makescanlist(ss, vap, adhocScanTable);
+
if (ss->ss_mindwell == 0)
ss->ss_mindwell = msecs_to_ticks(200); /* 200ms */
if (ss->ss_maxdwell == 0)
@@ -1329,7 +1293,6 @@
st->st_newscan = 1;
return 0;
-#undef N
}
/*
@@ -1513,7 +1476,7 @@
{
struct sta_table *st = ss->ss_priv;
- sta_makescanlist(ss, vap);
+ makescanlist(ss, vap, staScanTable);
if (ss->ss_mindwell == 0)
ss->ss_mindwell = msecs_to_ticks(200); /* 200ms */
More information about the p4-projects
mailing list