From owner-p4-projects@FreeBSD.ORG Mon May 23 22:38:54 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 170D516A420; Mon, 23 May 2005 22:38:53 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C202A16A41C for ; Mon, 23 May 2005 22:38:52 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 835FF43D48 for ; Mon, 23 May 2005 22:38:52 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j4NMcqMR096561 for ; Mon, 23 May 2005 22:38:52 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j4NMcqV0096558 for perforce@freebsd.org; Mon, 23 May 2005 22:38:52 GMT (envelope-from sam@freebsd.org) Date: Mon, 23 May 2005 22:38:52 GMT Message-Id: <200505232238.j4NMcqV0096558@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 77362 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2005 22:38:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=77362 Change 77362 by sam@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) {