PERFORCE change 77185 for review

Sam Leffler sam at FreeBSD.org
Thu May 19 09:06:52 PDT 2005


http://perforce.freebsd.org/chv.cgi?CH=77185

Change 77185 by sam at sam_ebb on 2005/05/19 16:06:25

	o correct handling of scan code's pwr sav state bit
	o return on-channel on scan complete before calling the scan
	  policy module's pick routine; otherwise it may be on the wrong
	  channel when it tries to contact the ap it selected
	o remove channel change logic from sta policy code now that the
	  core scan code does the change

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_scan.c#4 edit
.. //depot/projects/vap/sys/net80211/ieee80211_scan_sta.c#5 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_scan.c#4 (text+ko) ====

@@ -450,8 +450,10 @@
 			change_channel(ic, ss->ss_savchan);
 		ic->ic_scan_end(ic);		/* notify driver */
 		/* XXX ieee80211_end_scan or otherwise notify? */
-		if (ss->ss_flags & IEEE80211_SCAN_PWRSAV)
+		if (ss->ss_flags & IEEE80211_SCAN_PWRSAV) {
 			ieee80211_sta_pwrsave(vap, 0);
+			ss->ss_flags &= ~IEEE80211_SCAN_PWRSAV;
+		}
 		/* clear ephemeral state bits */
 		ss->ss_flags &= ~(IEEE80211_SCAN_MINDWELL |
 			IEEE80211_SCAN_BGSCAN | IEEE80211_SCAN_ONCE);
@@ -550,16 +552,17 @@
 		 * to end the scan before we invoke the callback method
 		 * to avoid having rx frames alter the scan candidate
 		 * list (maybe we could use a flag to have them discarded?).
-		 *
-		 * NB: don't blindly restore channel state;
-		 *     ss_scan_end may decide differently.
 		 */
 		ic->ic_scan_end(ic);		/* notify driver */
 		if (scandone)			/* record scan complete time */
 			ic->ic_lastscan = ticks;
+		/* return to the original channel */
+		if (ss->ss_savchan != ic->ic_curchan)
+			change_channel(ic, ss->ss_savchan);
 		/* clear mindwell lock and initial channel change flush */
 		ss->ss_flags &=
 			~(IEEE80211_SCAN_MINDWELL | IEEE80211_SCAN_DISCARD);
+
 		if (!ss->ss_ops->scan_end(ss, vap) &&
 		    (ss->ss_flags & IEEE80211_SCAN_ONCE) == 0 &&
 		    time_before(ticks + ss->ss_mindwell, ss->ss_scanend)) {
@@ -587,9 +590,6 @@
 			    __func__, scandone ? "done" : "stopped",
 			    ticks, ss->ss_mindwell, ss->ss_scanend);
 
-			/* return to the original channel */
-			if (ss->ss_savchan != ic->ic_curchan)
-				change_channel(ic, ss->ss_savchan);
 			/*
 			 * Drop out of power save mode when a scan has
 			 * completed.  If this scan was prematurely terminated
@@ -599,8 +599,11 @@
 			 * save mode because the beacon indicates we have frames
 			 * waiting for us.
 			 */
-			if (scandone && (ss->ss_flags & IEEE80211_SCAN_PWRSAV))
+			if (scandone &&
+			    (ss->ss_flags & IEEE80211_SCAN_PWRSAV)) {
 				ieee80211_sta_pwrsave(vap, 0);
+				ss->ss_flags &= ~IEEE80211_SCAN_PWRSAV;
+			}
 			ic->ic_flags &= ~IEEE80211_F_SCAN;
 			/* NB: suppress notification during bg scan */
 			if (scandone)

==== //depot/projects/vap/sys/net80211/ieee80211_scan_sta.c#5 (text+ko) ====

@@ -690,7 +690,6 @@
 static int
 sta_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap)
 {
-	struct ieee80211com *ic = vap->iv_ic;
 	struct sta_table *st = ss->ss_priv;
 	struct sta_entry *se, *selbs;
 
@@ -704,8 +703,6 @@
 		 * handle notification that this has completed.
 		 */
 		ss->ss_flags &= ~IEEE80211_SCAN_NOPICK;
-		ic->ic_curchan = ss->ss_savchan;
-		ic->ic_set_channel(ic);
 		return 1;
 	}
 	/*


More information about the p4-projects mailing list