PERFORCE change 77431 for review

Sam Leffler sam at FreeBSD.org
Wed May 25 00:51:59 GMT 2005


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

Change 77431 by sam at sam_ebb on 2005/05/25 00:51:57

	decrement failure counts on stations each time we complete a
	scan w/o finding a suitable station; this is in addition to
	the other aging used to clear failures

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#13 edit
.. //depot/projects/vap/sys/net80211/ieee80211_proto.c#11 edit
.. //depot/projects/vap/sys/net80211/ieee80211_scan_sta.c#9 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#13 (text+ko) ====

@@ -1791,8 +1791,11 @@
 			if ((vap->iv_caps & IEEE80211_C_BGSCAN) == 0)
 				return EINVAL;
 			vap->iv_flags |= IEEE80211_F_BGSCAN;
-		} else
+		} else {
+			/* XXX racey? */
 			vap->iv_flags &= ~IEEE80211_F_BGSCAN;
+			ieee80211_cancel_scan(vap);	/* anything current */
+		}
 		break;
 	case IEEE80211_IOC_BGSCAN_IDLE:
 		if (ireq->i_val >= IEEE80211_BGSCAN_IDLE_MIN)

==== //depot/projects/vap/sys/net80211/ieee80211_proto.c#11 (text+ko) ====

@@ -1100,7 +1100,8 @@
 	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
 		IEEE80211_DPRINTF(vap,
 			IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
-			"%s\n", "beacon miss");
+			"beacon miss, mode %u state %s\n",
+			vap->iv_opmode, ieee80211_state_name[vap->iv_state]);
 
 		/*
 		 * Our handling is only meaningful for stations that are
@@ -1241,18 +1242,17 @@
 			break;
 		case IEEE80211_S_AUTH:
 		case IEEE80211_S_ASSOC:		/* timeout restart scan */
-			ieee80211_scan_assocfail(ic, vap->iv_bss->ni_macaddr);
-			if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
+			if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
+				ieee80211_scan_assocfail(ic,
+					vap->iv_bss->ni_macaddr);
 				ieee80211_check_scan(vap,
 					IEEE80211_SCAN_ACTIVE | arg,
 					IEEE80211_SCAN_FOREVER);
+			}
 			break;
 		case IEEE80211_S_RUN:		/* beacon miss */
 			ieee80211_sta_leave(ni);
 			vap->iv_flags &= ~IEEE80211_F_SIBSS;	/* XXX */
-#if 0
-			ieee80211_scan_beaconmiss(ic, vap->iv_bss->ni_macaddr);
-#endif
 			if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
 				ieee80211_check_scan(vap,
 					IEEE80211_SCAN_ACTIVE | arg,

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

@@ -649,7 +649,7 @@
 	if ((vap->iv_flags & IEEE80211_F_DESBSSID) &&
 	    !IEEE80211_ADDR_EQ(vap->iv_des_bssid, se->se_bssid))
 		fail |= 0x20;
-	if (se0->se_fails >= STA_FAILS_MAX)
+	if (se0->se_fails > STA_FAILS_MAX)
 		fail |= 0x40;
 	if (se0->se_notseen >= STA_PURGE_SCANS)
 		fail |= 0x80;
@@ -703,6 +703,18 @@
 	mtx_unlock(&st->st_lock);
 }
 
+static void
+sta_dec_fails(struct sta_table *st)
+{
+	struct sta_entry *se;
+
+	mtx_lock(&st->st_lock);
+	TAILQ_FOREACH(se, &st->st_entry, se_list)
+		if (se->se_fails)
+			se->se_fails--;
+	mtx_unlock(&st->st_lock);
+}
+
 /*
  * Pick an ap or ibss network to join or find a channel
  * to use to start an ibss network.
@@ -749,6 +761,14 @@
 			ieee80211_create_ibss(vap, vap->iv_des_chan);
 			return 1;
 		}
+		/*
+		 * If nothing suitable was found decrement
+		 * the failure counts so entries will be
+		 * reconsidered the next time around.  We
+		 * really want to do this only for sta's
+		 * where we've previously had some success.
+		 */
+		sta_dec_fails(st);
 		return 0;			/* restart scan */
 	}
 	selbs = NULL;


More information about the p4-projects mailing list