From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:51:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03888106566C; Mon, 27 Oct 2008 17:51:25 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E61E28FC1A; Mon, 27 Oct 2008 17:51:24 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9RHpOa5047352; Mon, 27 Oct 2008 17:51:24 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9RHpOhI047349; Mon, 27 Oct 2008 17:51:24 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200810271751.m9RHpOhI047349@svn.freebsd.org> From: Sam Leffler Date: Mon, 27 Oct 2008 17:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184358 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2008 17:51:25 -0000 Author: sam Date: Mon Oct 27 17:51:24 2008 New Revision: 184358 URL: http://svn.freebsd.org/changeset/base/184358 Log: Fixup statistics: o update tx rssi data only when an ACK was received o return tx rssi from sampled data instead of the last frame o track noise floor o return rx rssi and noise floor (was broken) Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Oct 27 17:43:23 2008 (r184357) +++ head/sys/dev/ath/if_ath.c Mon Oct 27 17:51:24 2008 (r184358) @@ -3978,6 +3978,7 @@ ath_rx_proc(void *arg, int npending) DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending); ngood = 0; nf = ath_hal_getchannoise(ah, &sc->sc_curchan); + sc->sc_stats.ast_rx_noise = nf; tsf = ath_hal_gettsf64(ah); do { bf = STAILQ_FIRST(&sc->sc_rxbuf); @@ -5034,9 +5035,6 @@ ath_tx_processq(struct ath_softc *sc, st sc->sc_ant_tx[txant]++; if (ts->ts_rate & HAL_TXSTAT_ALTRATE) sc->sc_stats.ast_tx_altrate++; - sc->sc_stats.ast_tx_rssi = ts->ts_rssi; - ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi, - ts->ts_rssi); pri = M_WME_GETAC(bf->bf_m); if (pri >= WME_AC_VO) ic->ic_wme.wme_hipri_traffic++; @@ -5062,11 +5060,16 @@ ath_tx_processq(struct ath_softc *sc, st if ((ts->ts_status & HAL_TXERR_FILT) == 0 && (bf->bf_txflags & HAL_TXDESC_NOACK) == 0) { /* - * If frame was ack'd update the last rx time - * used to workaround phantom bmiss interrupts. + * If frame was ack'd update statistics, + * including the last rx time used to + * workaround phantom bmiss interrupts. */ - if (ts->ts_status == 0) + if (ts->ts_status == 0) { nacked++; + sc->sc_stats.ast_tx_rssi = ts->ts_rssi; + ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi, + ts->ts_rssi); + } ath_rate_tx_complete(sc, an, bf); } /* @@ -6372,6 +6375,7 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, struct ath_softc *sc = ifp->if_softc; struct ieee80211com *ic = ifp->if_l2com; struct ifreq *ifr = (struct ifreq *)data; + const HAL_RATE_TABLE *rt; int error = 0; switch (cmd) { @@ -6414,10 +6418,9 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, /* NB: embed these numbers to get a consistent view */ sc->sc_stats.ast_tx_packets = ifp->if_opackets; sc->sc_stats.ast_rx_packets = ifp->if_ipackets; -#if 0 - ieee80211_getsignal(ic, &sc->sc_stats.ast_rx_rssi, - &sc->sc_stats.ast_rx_noise); -#endif + sc->sc_stats.ast_tx_rssi = ATH_RSSI(sc->sc_halstats.ns_avgtxrssi); + sc->sc_stats.ast_rx_rssi = ATH_RSSI(sc->sc_halstats.ns_avgrssi); + rt = sc->sc_currates; sc->sc_stats.ast_tx_rate = sc->sc_hwmap[sc->sc_txrate].ieeerate; return copyout(&sc->sc_stats, ifr->ifr_data, sizeof (sc->sc_stats)); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Oct 27 17:43:23 2008 (r184357) +++ head/sys/dev/ath/if_athvar.h Mon Oct 27 17:51:24 2008 (r184358) @@ -100,6 +100,9 @@ struct ath_node { if ((y) >= -20) \ x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \ } while (0) +#define ATH_EP_RND(x,mul) \ + ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) +#define ATH_RSSI(x) ATH_EP_RND(x, HAL_RSSI_EP_MULTIPLIER) struct ath_buf { STAILQ_ENTRY(ath_buf) bf_list;