From owner-p4-projects@FreeBSD.ORG Thu Aug 4 15:56:30 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 EBD9716A422; Thu, 4 Aug 2005 15:56:29 +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 C26FE16A41F for ; Thu, 4 Aug 2005 15:56:29 +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 6354743D45 for ; Thu, 4 Aug 2005 15:56:29 +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 j74FuTRB095352 for ; Thu, 4 Aug 2005 15:56:29 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j74FuTbW095349 for perforce@freebsd.org; Thu, 4 Aug 2005 15:56:29 GMT (envelope-from sam@freebsd.org) Date: Thu, 4 Aug 2005 15:56:29 GMT Message-Id: <200508041556.j74FuTbW095349@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 81450 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: Thu, 04 Aug 2005 15:56:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=81450 Change 81450 by sam@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 */