PERFORCE change 77362 for review

Sam Leffler sam at FreeBSD.org
Mon May 23 22:38:54 GMT 2005


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

Change 77362 by sam at sam_ebb on 2005/05/23 22:38:47

	Revamp algorithm for noting when a station was last "seen" so
	that the currently associated ap gets credit for frames received
	while !scanning.  Instead of clearing se_seen at the start of
	each scan reset it on scan complete; this way frames received
	while !scanning cause se_seen to be marked so even if the sta
	isn't found during the scan previous state will keep it from
	being marked "not seen".

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_scan_sta.c#7 edit

Differences ...

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

@@ -275,29 +275,6 @@
 #undef ISPROBE
 }
 
-static void
-sta_clearseen(struct sta_table *st)
-{
-	struct sta_entry *se;
-
-	mtx_lock(&st->st_lock);
-	TAILQ_FOREACH(se, &st->st_entry, se_list)
-		se->se_seen = 0;
-	mtx_unlock(&st->st_lock);
-}
-
-static void
-sta_updateseen(struct sta_table *st)
-{
-	struct sta_entry *se;
-
-	mtx_lock(&st->st_lock);
-	TAILQ_FOREACH(se, &st->st_entry, se_list)
-		if (!se->se_seen)
-			se->se_notseen++;
-	mtx_unlock(&st->st_lock);
-}
-
 static struct ieee80211_channel *
 find11gchannel(struct ieee80211com *ic, int i, int freq)
 {
@@ -491,7 +468,6 @@
 	}
 #endif /* IEEE80211_DEBUG */
 
-	sta_clearseen(st);
 	st->st_newscan = 1;
 
 	return 0;
@@ -506,7 +482,6 @@
 {
 	struct sta_table *st = ss->ss_priv;
 
-	sta_clearseen(st);
 	st->st_newscan = 1;
 	return 0;
 }
@@ -705,6 +680,28 @@
 	return fail;
 }
 
+static void
+sta_update_notseen(struct sta_table *st)
+{
+	struct sta_entry *se;
+
+	mtx_lock(&st->st_lock);
+	TAILQ_FOREACH(se, &st->st_entry, se_list) {
+		/*
+		 * If seen the reset and don't bump the count;
+		 * otherwise bump the ``not seen'' count.  Note
+		 * that this insures that stations for which we
+		 * see frames while not scanning but not during
+		 * this scan will not be penalized.
+		 */
+		if (se->se_seen)
+			se->se_seen = 0;
+		else
+			se->se_notseen++;
+	}
+	mtx_unlock(&st->st_lock);
+}
+
 /*
  * Pick an ap or ibss network to join or find a channel
  * to use to start an ibss network.
@@ -719,7 +716,7 @@
 		("wrong opmode %u", vap->iv_opmode));
 
 	if (st->st_newscan) {
-		sta_updateseen(st);
+		sta_update_notseen(st);
 		st->st_newscan = 0;
 	}
 	if (ss->ss_flags & IEEE80211_SCAN_NOPICK) {


More information about the p4-projects mailing list