Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2007 12:59:33 GMT
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 113556 for review
Message-ID:  <200701261259.l0QCxXv8032374@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113556

Change 113556 by sephe@sephe_zealot:sam_wifi on 2007/01/26 12:59:27

	- For ath(4), map HAL's CHANNEL_PUREG to IEEE80211_CHAN_G, since except for
	  AR5211 part, HAL's CHANNEL_PUREG means mixed DSSS and OFDM.
	  Explained-and-OKed-by: sam@
	- After above change, all device's 11g channel flags are IEEE80211_CHAN_G,
	  replace IEEE80211_CHAN_PUREG with IEEE80211_CHAN_G for IEEE80211_MODE_11G.
	
	Above two changes make scanning work on both ath(4) and other 802.11 devices,
	if desired 'mode' is set to 11g.  Before this commit only ath(4) works, mainly
	because ath(4)'s 11g channel flags are IEEE80211_CHAN_PUREG while other 802.11
	devices's 11g channel flags are IEEE80211_CHAN_G.
	
	- In ieee80211_scan_sta.c:add_channels(), move scan list limit check to the
	  beginning of the loop, so channel searching will not be performed if scan
	  list limit is reached.
	- Reorganize bottom half of ieee80211_scan_sta.c:sta_start(),
	  o  Add scan list limit checking.
	  o  Call checktable(), no matter whether desired 'mode' is auto or not, so
	     already added channels will not be added to scan list again if desired
	     'mode' is not auto.
	
	Tested-with: ath(4) (mac 7.{8,9} phy 4.5 radio 5.6)
	             ral(4) (2560 and 2661 parts)
	Reviewed-by: sam@
	Approved-by: sam@

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#130 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#65 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_scan_ap.c#4 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_scan_sta.c#11 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#130 (text+ko) ====

@@ -5489,7 +5489,17 @@
 			if_printf(ifp, "hal channel %u/%x -> %u\n",
 			    c->channel, c->channelFlags, ichan->ic_ieee);
 		ichan->ic_freq = c->channel;
-		ichan->ic_flags = c->channelFlags;
+
+		if (c->channelFlags == CHANNEL_PUREG) {
+			/*
+			 * Except for AR5211, HAL's PUREG means mixed
+			 * DSSS and OFDM.
+			 */
+			ichan->ic_flags = IEEE80211_CHAN_G;
+		} else {
+			ichan->ic_flags = c->channelFlags;
+		}
+
 		if (ath_hal_isgsmsku(ah)) {
 			/* remap to true frequencies */
 			ichan->ic_freq = 922 + (2422 - ichan->ic_freq);

==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#65 (text+ko) ====

@@ -1629,7 +1629,7 @@
 		0,			/* IEEE80211_MODE_AUTO */
 		IEEE80211_CHAN_A,	/* IEEE80211_MODE_11A */
 		IEEE80211_CHAN_B,	/* IEEE80211_MODE_11B */
-		IEEE80211_CHAN_PUREG,	/* IEEE80211_MODE_11G */
+		IEEE80211_CHAN_G,	/* IEEE80211_MODE_11G */
 		IEEE80211_CHAN_FHSS,	/* IEEE80211_MODE_FH */
 		IEEE80211_CHAN_108A,	/* IEEE80211_MODE_TURBO_A */
 		IEEE80211_CHAN_108G,	/* IEEE80211_MODE_TURBO_G */

==== //depot/projects/wifi/sys/net80211/ieee80211_scan_ap.c#4 (text+ko) ====

@@ -167,7 +167,7 @@
 			0,			/* IEEE80211_MODE_AUTO */
 			IEEE80211_CHAN_A,	/* IEEE80211_MODE_11A */
 			IEEE80211_CHAN_B,	/* IEEE80211_MODE_11B */
-			IEEE80211_CHAN_PUREG,	/* IEEE80211_MODE_11G */
+			IEEE80211_CHAN_G,	/* IEEE80211_MODE_11G */
 			IEEE80211_CHAN_FHSS,	/* IEEE80211_MODE_FH */
 			IEEE80211_CHAN_108A,	/* IEEE80211_MODE_TURBO_A */
 			IEEE80211_CHAN_108G,	/* IEEE80211_MODE_TURBO_G */

==== //depot/projects/wifi/sys/net80211/ieee80211_scan_sta.c#11 (text+ko) ====

@@ -341,10 +341,10 @@
 	IEEE80211_CHAN_B,	/* IEEE80211_MODE_AUTO */
 	IEEE80211_CHAN_A,	/* IEEE80211_MODE_11A */
 	IEEE80211_CHAN_B,	/* IEEE80211_MODE_11B */
-	IEEE80211_CHAN_PUREG,	/* IEEE80211_MODE_11G */
+	IEEE80211_CHAN_G,	/* IEEE80211_MODE_11G */
 	IEEE80211_CHAN_FHSS,	/* IEEE80211_MODE_FH */
 	IEEE80211_CHAN_A,	/* IEEE80211_MODE_TURBO_A */ /* for turbo mode look for AP in normal channel */
-	IEEE80211_CHAN_PUREG,	/* IEEE80211_MODE_TURBO_G */
+	IEEE80211_CHAN_G,	/* IEEE80211_MODE_TURBO_G */
 	IEEE80211_CHAN_ST,	/* IEEE80211_MODE_STURBO_A */
 };
 
@@ -361,6 +361,9 @@
 	KASSERT(mode < N(chanflags), ("Unexpected mode %u", mode));
 	modeflags = chanflags[mode];
 	for (i = 0; i < nfreq; i++) {
+		if (ss->ss_last >= IEEE80211_SCAN_MAX)
+			break;
+
 		c = ieee80211_find_channel(ic, freq[i], modeflags);
 		if (c == NULL || isexcluded(ic, c))
 			continue;
@@ -373,8 +376,6 @@
 			    (cg = find11gchannel(ic, i, c->ic_freq)) != NULL)
 				c = cg;
 		}
-		if (ss->ss_last >= IEEE80211_SCAN_MAX)
-			break;
 		ss->ss_chans[ss->ss_last++] = c;
 	}
 #undef N
@@ -466,7 +467,7 @@
 	enum ieee80211_phymode mode;
 	struct ieee80211_channel *c;
 	int i;
-	
+
 	ss->ss_last = 0;
 	/*
 	 * Use the table of ordered channels to construct the list
@@ -519,6 +520,9 @@
 	 * in the staScanTable.
 	 */
 	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
@@ -526,29 +530,32 @@
 		 */
 		if (IEEE80211_IS_CHAN_DTURBO(c))
 			continue;
+
 		/*
+		 * If a desired mode was specified, scan only 
+		 * channels that satisfy that constraint.
+		 */
+		if (ic->ic_des_mode != IEEE80211_MODE_AUTO &&
+		    ic->ic_des_mode != ieee80211_chan2mode(c))
+			continue;
+
+		/*
 		 * Skip channels excluded by user request.
 		 */
 		if (isexcluded(ic, c))
 			continue;
-		mode = ieee80211_chan2mode(c);
-		if (ic->ic_des_mode != IEEE80211_MODE_AUTO) {
-			/*
-			 * If a desired mode was specified, scan only 
-			 * channels that satisfy that constraint.
-			 */
-			if (ic->ic_des_mode == mode)
-				ss->ss_chans[ss->ss_last++] = c;
-		} else {
-			/*
-			 * 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))
-				ss->ss_chans[ss->ss_last++] = c;
-		}
+
+		/*
+		 * 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;
+
+		/* Add channel to scanning list. */
+		ss->ss_chans[ss->ss_last++] = c;
 	}
 
 	ss->ss_next = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701261259.l0QCxXv8032374>