From owner-p4-projects@FreeBSD.ORG Wed Nov 10 18:48:01 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 84F0416A4D0; Wed, 10 Nov 2004 18:48:01 +0000 (GMT) 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 6037C16A4CE for ; Wed, 10 Nov 2004 18:48:01 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5331343D45 for ; Wed, 10 Nov 2004 18:48:01 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iAAIm1HZ037351 for ; Wed, 10 Nov 2004 18:48:01 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iAAIm1tR037348 for perforce@freebsd.org; Wed, 10 Nov 2004 18:48:01 GMT (envelope-from sam@freebsd.org) Date: Wed, 10 Nov 2004 18:48:01 GMT Message-Id: <200411101848.iAAIm1tR037348@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 Subject: PERFORCE change 64831 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2004 18:48:02 -0000 http://perforce.freebsd.org/chv.cgi?CH=64831 Change 64831 by sam@sam_ebb on 2004/11/10 18:47:23 correct initial recv rssi handling; fixes scanning problem where we selected the wrong station based on rssi Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#17 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#17 (text+ko) ==== @@ -2076,6 +2076,10 @@ /* XXX stat+msg */ return NULL; } + an->an_avgrssi = ATH_RSSI_DUMMY_MARKER; + an->an_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER; + an->an_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER; + an->an_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER; ath_rate_node_init(sc, an); DPRINTF(sc, ATH_DEBUG_NODE, "%s: an %p\n", __func__, an); @@ -2131,8 +2135,13 @@ u_int32_t avgrssi = ATH_NODE_CONST(ni)->an_avgrssi; int32_t rssi; - rssi = HAL_EP_RND(avgrssi, HAL_RSSI_EP_MULTIPLIER); - if (rssi == 0) + /* + * When only one frame is received there will be no state in + * avgrssi so fallback on the value recorded by the 802.11 layer. + */ + if (avgrssi != ATH_RSSI_DUMMY_MARKER) + rssi = HAL_EP_RND(avgrssi, HAL_RSSI_EP_MULTIPLIER); + else rssi = ni->ni_rssi; /* NB: theoretically we shouldn't need this, but be paranoid */ return rssi < 0 ? 0 : rssi > 127 ? 127 : rssi;