From owner-p4-projects@FreeBSD.ORG Wed Dec 1 00:08:50 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F245316A4D0; Wed, 1 Dec 2004 00:08:49 +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 CAA3E16A4CE for ; Wed, 1 Dec 2004 00:08:49 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B659A43D45 for ; Wed, 1 Dec 2004 00:08:49 +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 iB108nJP032123 for ; Wed, 1 Dec 2004 00:08:49 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iB108nPL032120 for perforce@freebsd.org; Wed, 1 Dec 2004 00:08:49 GMT (envelope-from sam@freebsd.org) Date: Wed, 1 Dec 2004 00:08:49 GMT Message-Id: <200412010008.iB108nPL032120@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 66152 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, 01 Dec 2004 00:08:50 -0000 http://perforce.freebsd.org/chv.cgi?CH=66152 Change 66152 by sam@sam_ebb on 2004/12/01 00:08:19 when operating as an ap set default antenna based on recent xmit stats in each beacon interval Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#35 edit .. //depot/projects/wifi/sys/dev/ath/if_athvar.h#14 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#35 (text+ko) ==== @@ -1802,7 +1802,7 @@ struct ath_buf *bf = sc->sc_bcbuf; struct ath_hal *ah = sc->sc_ah; struct mbuf *m; - int ncabq, error; + int ncabq, error, otherant; DPRINTF(sc, ATH_DEBUG_BEACON_PROC, "%s: pending %u\n", __func__, pending); @@ -1873,6 +1873,17 @@ ath_setslottime(sc); /* commit change to h/w */ /* + * Check recent per-antenna transmit statistics and flip + * the default antenna if noticeably more frames went out + * on the non-default antenna. + * XXX assumes 2 anntenae + */ + otherant = sc->sc_defant & 1 ? 2 : 1; + if (sc->sc_ant_tx[otherant] > sc->sc_ant_tx[sc->sc_defant] + 2) + ath_setdefantenna(sc, otherant); + sc->sc_ant_tx[1] = sc->sc_ant_tx[2] = 0; + + /* * Construct tx descriptor. */ ath_beacon_setup(sc, bf); @@ -3330,7 +3341,9 @@ if (ni != NULL) { an = ATH_NODE(ni); if (ds->ds_txstat.ts_status == 0) { - sc->sc_stats.ast_ant_tx[ds->ds_txstat.ts_antenna]++; + u_int8_t txant = ds->ds_txstat.ts_antenna; + sc->sc_stats.ast_ant_tx[txant]++; + sc->sc_ant_tx[txant]++; if (ds->ds_txstat.ts_rate & HAL_TXSTAT_ALTRATE) sc->sc_stats.ast_tx_altrate++; sc->sc_stats.ast_tx_rssi = ==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#14 (text+ko) ==== @@ -217,6 +217,7 @@ u_int sc_bhalq; /* HAL q for outgoing beacons */ u_int sc_bmisscount; /* missed beacon transmits */ + u_int32_t sc_ant_tx[8]; /* recent tx frames/antenna */ struct ath_txq *sc_cabq; /* tx q for cab frames */ struct ath_buf *sc_bcbuf; /* beacon buffer */ struct ath_buf *sc_bufptr; /* allocated buffer ptr */