PERFORCE change 87406 for review

Sam Leffler sam at FreeBSD.org
Tue Nov 29 01:57:55 GMT 2005


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

Change 87406 by sam at sam_ebb on 2005/11/29 01:57:06

	Fixup roaming a bit; decouple roaming-induced bg scans from
	normal bg scan work--only kick off a bg scan if we want to
	roam, previously we did it in case the scan cache was cold
	which caused bg scan activity to be periodic according to
	ic_scanvalid (typically overriding whatever ic_bgscanintvl
	was set to).  This has the downside that we must typically
	do a scan before we can look for a roaming candidate as the
	scan cache is likely cold.  There's also the problem that
	when roaming is desired we scan with period ic_scanvalid
	which may be too aggressive if trying to conserve power.
	In that case the user will probably want to manually disable
	bgscan which also turns off roaming.
	
	With the above we can restore a reasonable default to
	ic_scanvalid.  Also enforce a minimum to avoid scanning
	too frequently 'cuz of roaming.

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#53 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_scan.c#7 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_scan_sta.c#7 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_var.h#39 edit

Differences ...

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

@@ -1897,7 +1897,10 @@
 			error = EINVAL;
 		break;
 	case IEEE80211_IOC_SCANVALID:
-		ic->ic_scanvalid = ireq->i_val*hz;
+		if (ireq->i_val >= IEEE80211_SCAN_VALID_MIN)
+			ic->ic_scanvalid = ireq->i_val*hz;
+		else
+			error = EINVAL;
 		break;
 	case IEEE80211_IOC_ROAM_RSSI_11A:
 		ic->ic_roam.rssi11a = ireq->i_val;

==== //depot/projects/wifi/sys/net80211/ieee80211_scan.c#7 (text+ko) ====

@@ -110,7 +110,7 @@
 
 	ic->ic_bgscanidle = (IEEE80211_BGSCAN_IDLE_DEFAULT*1000)/hz;
 	ic->ic_bgscanintvl = IEEE80211_BGSCAN_INTVAL_DEFAULT*hz;
-	ic->ic_scanvalid = ic->ic_bgscanintvl;
+	ic->ic_scanvalid = IEEE80211_SCAN_VALID_DEFAULT*hz;
 	ic->ic_roam.rssi11a = ROAM_RSSI_11A_DEFAULT;
 	ic->ic_roam.rssi11b = ROAM_RSSI_11B_DEFAULT;
 	ic->ic_roam.rssi11bOnly = ROAM_RSSI_11BONLY_DEFAULT;

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

@@ -980,41 +980,34 @@
 		IEEE80211_DPRINTF(ic, IEEE80211_MSG_ROAM,
 		    "%s: currssi %d roamrssi %d\n", __func__, curRssi, roamRssi);
 	}
-	if (time_after(ticks, ic->ic_lastscan + ic->ic_scanvalid)) {
-		/*
-		 * Scan cache contents is too old; check about updating it.
-		 */
-		if (curRate < roamRate || curRssi < roamRssi) {
+	/*
+	 * Check if a new ap should be used and switch.
+	 * XXX deauth current ap
+	 */
+	if (curRate < roamRate || curRssi < roamRssi) {
+		if (time_after(ticks, ic->ic_lastscan + ic->ic_scanvalid)) {
 			/*
-			 * Thresholds exceeded, force a scan now so we
-			 * have current state to make a decision with.
+			 * Scan cache contents are too old; force a scan now
+			 * if possible so we have current state to make a
+			 * decision with.  We don't kick off a bg scan if
+			 * we're using dynamic turbo and boosted or if the
+			 * channel is busy.
+			 * XXX force immediate switch on scan complete
 			 */
-			ieee80211_bg_scan(ic);
-		} else if (time_after(ticks,
-				ic->ic_lastdata + ic->ic_bgscanidle)) {
-			/*
-			 * We're not in need of a new ap, but idle;
-			 * kick off a bg scan to replenish the cache.
-			 */
-			ieee80211_bg_scan(ic);
+			if (!IEEE80211_IS_CHAN_DTURBO(ic->ic_curchan) &&
+			    time_after(ticks, ic->ic_lastdata + ic->ic_bgscanidle))
+				ieee80211_bg_scan(ic);
+			return;
 		}
-	} else {
-		/*
-		 * Scan cache contents are warm enough to use;
-		 * check if a new ap should be used and switch.
-		 * XXX deauth current ap
-		 */
-		if (curRate < roamRate || curRssi < roamRssi) {
-			se->base.se_rssi = curRssi;
-			selbs = select_bss(ss, ic, IEEE80211_MSG_ROAM);
-			if (selbs != NULL && selbs != se) {
-				IEEE80211_DPRINTF(ic,
-				    IEEE80211_MSG_ROAM | IEEE80211_MSG_DEBUG,
-				    "%s: ROAM: curRate %u, roamRate %u, "
-				    "curRssi %d, roamRssi %d\n", __func__,
-				    curRate, roamRate, curRssi, roamRssi);
-				ieee80211_sta_join(ic, &selbs->base);
-			}
+		se->base.se_rssi = curRssi;
+		selbs = select_bss(ss, ic, IEEE80211_MSG_ROAM);
+		if (selbs != NULL && selbs != se) {
+			IEEE80211_DPRINTF(ic,
+			    IEEE80211_MSG_ROAM | IEEE80211_MSG_DEBUG,
+			    "%s: ROAM: curRate %u, roamRate %u, "
+			    "curRssi %d, roamRssi %d\n", __func__,
+			    curRate, roamRate, curRssi, roamRssi);
+			ieee80211_sta_join(ic, &selbs->base);
 		}
 	}
 }

==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#39 (text+ko) ====

@@ -81,6 +81,9 @@
 #define	IEEE80211_BGSCAN_IDLE_MIN	100	/* min idle time (ms) */
 #define	IEEE80211_BGSCAN_IDLE_DEFAULT	250	/* default idle time (ms) */
 
+#define	IEEE80211_SCAN_VALID_MIN	10	/* min scan valid time (secs) */
+#define	IEEE80211_SCAN_VALID_DEFAULT	60	/* default scan valid time */
+
 #define	IEEE80211_PS_SLEEP	0x1	/* STA is in power saving mode */
 #define	IEEE80211_PS_MAX_QUEUE	50	/* maximum saved packets */
 


More information about the p4-projects mailing list