PERFORCE change 81450 for review

Sam Leffler sam at FreeBSD.org
Thu Aug 4 15:56:30 GMT 2005


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

Change 81450 by sam at sam_ebb on 2005/08/04 15:56:06

	o don't roam if bgscan is disabled; need to decide what
	  the right semantics are
	o pass debug mask into match_bss so we get msgs only when desired

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_scan_sta.c#3 edit

Differences ...

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

@@ -108,7 +108,7 @@
 
 static void sta_flush_table(struct sta_table *);
 static int match_bss(struct ieee80211com *,
-	const struct ieee80211_scan_state *, const struct sta_entry *);
+	const struct ieee80211_scan_state *, const struct sta_entry *, int);
 
 /* number of references from net80211 layer */
 static	int nrefs = 0;
@@ -289,7 +289,7 @@
 	 * If looking for a quick choice and nothing's
 	 * been found check here.
 	 */
-	if (PICK1ST(ss) && match_bss(ic, ss, se) == 0)
+	if (PICK1ST(ss) && match_bss(ic, ss, se, IEEE80211_MSG_SCAN) == 0)
 		ss->ss_flags |= IEEE80211_SCAN_GOTPICK;
 
 	return 1;
@@ -702,7 +702,8 @@
  */
 static int
 match_bss(struct ieee80211com *ic,
-	const struct ieee80211_scan_state *ss, const struct sta_entry *se0)
+	const struct ieee80211_scan_state *ss, const struct sta_entry *se0,
+	int debug)
 {
 	const struct ieee80211_scan_entry *se = &se0->base;
         u_int8_t rate;
@@ -753,7 +754,7 @@
 	if (se->se_rssi < STA_RSSI_MIN)
 		fail |= 0x100;
 #ifdef IEEE80211_DEBUG
-	if (ieee80211_msg(ic, IEEE80211_MSG_SCAN | IEEE80211_MSG_ROAM)) {
+	if (ieee80211_msg(ic, debug)) {
 		printf(" %c %s",
 		    fail & 0x40 ? '=' : fail & 0x80 ? '^' : fail ? '-' : '+',
 		    ether_sprintf(se->se_macaddr));
@@ -815,16 +816,16 @@
 }
 
 static struct sta_entry *
-select_bss(struct ieee80211_scan_state *ss, struct ieee80211com *ic)
+select_bss(struct ieee80211_scan_state *ss, struct ieee80211com *ic, int debug)
 {
 	struct sta_table *st = ss->ss_priv;
 	struct sta_entry *se, *selbs = NULL;
 
-	IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN | IEEE80211_MSG_ROAM, " %s\n",
+	IEEE80211_DPRINTF(ic, debug, " %s\n",
 	    "macaddr          bssid         chan  rssi  rate flag  wep  essid");
 	mtx_lock(&st->st_lock);
 	TAILQ_FOREACH(se, &st->st_entry, se_list) {
-		if (match_bss(ic, ss, se) == 0) {
+		if (match_bss(ic, ss, se, debug) == 0) {
 			if (selbs == NULL)
 				selbs = se;
 			else if (sta_compare(se, selbs) > 0)
@@ -882,7 +883,7 @@
 		st->st_newscan = 1;
 		return 0;			/* restart scan */
 	}
-	selbs = select_bss(ss, ic);
+	selbs = select_bss(ss, ic, IEEE80211_MSG_SCAN);
 	if (selbs == NULL || !ieee80211_sta_join(ic, &selbs->base))
 		goto notfound;
 	return 1;				/* terminate scan */
@@ -943,12 +944,11 @@
 		    "%s: currssi %d currate %u roamrssi %d roamrate %u\n",
 		    __func__, curRssi, curRate, roamRssi, roamRate);
 	} else {
-		curRate = roamRate;		/* NB: insure compare below fails */
+		curRate = roamRate;	/* NB: insure compare below fails */
 		IEEE80211_DPRINTF(ic, IEEE80211_MSG_ROAM,
 		    "%s: currssi %d roamrssi %d\n", __func__, curRssi, roamRssi);
 	}
-	if ((ic->ic_flags & IEEE80211_F_BGSCAN) &&
-	    time_after(ticks, ic->ic_lastscan + ic->ic_scanvalid)) {
+	if (time_after(ticks, ic->ic_lastscan + ic->ic_scanvalid)) {
 		/*
 		 * Scan cache contents is too old; check about updating it.
 		 */
@@ -974,9 +974,15 @@
 		 */
 		if (curRate < roamRate || curRssi < roamRssi) {
 			se->base.se_rssi = curRssi;
-			selbs = select_bss(ss, ic);
-			if (selbs != NULL && selbs != se)
+			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);
+			}
 		}
 	}
 }
@@ -1008,10 +1014,12 @@
 	 * in sta mode and automatic roaming is set.
 	 * XXX defer if busy
 	 * XXX repeater station
+	 * XXX do when !bgscan?
 	 */
 	KASSERT(ic->ic_opmode == IEEE80211_M_STA,
 		("wrong mode %u", ic->ic_opmode));
 	if (ic->ic_roaming == IEEE80211_ROAMING_AUTO &&
+	    (ic->ic_flags & IEEE80211_F_BGSCAN) &&
 	    ic->ic_state >= IEEE80211_S_RUN)
 		/* XXX vap is implicit */
 		sta_roam_check(ss, ic);
@@ -1296,7 +1304,7 @@
 		st->st_newscan = 1;
 		return 0;			/* restart scan */
 	}
-	selbs = select_bss(ss, ic);
+	selbs = select_bss(ss, ic, IEEE80211_MSG_SCAN);
 	if (selbs == NULL || !ieee80211_sta_join(ic, &selbs->base))
 		goto notfound;
 	return 1;				/* terminate scan */


More information about the p4-projects mailing list