From owner-p4-projects@FreeBSD.ORG Tue Nov 30 01:09:43 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id ECDF916A4D1; Tue, 30 Nov 2004 01:09:42 +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 9679516A4CE for ; Tue, 30 Nov 2004 01:09:42 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77C6C43D31 for ; Tue, 30 Nov 2004 01:09:42 +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 iAU19giH048831 for ; Tue, 30 Nov 2004 01:09:42 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iAU19g9r048828 for perforce@freebsd.org; Tue, 30 Nov 2004 01:09:42 GMT (envelope-from sam@freebsd.org) Date: Tue, 30 Nov 2004 01:09:42 GMT Message-Id: <200411300109.iAU19g9r048828@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 66078 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: Tue, 30 Nov 2004 01:09:43 -0000 http://perforce.freebsd.org/chv.cgi?CH=66078 Change 66078 by sam@sam_ebb on 2004/11/30 01:09:19 o return copies of if_ipacket and if_opackets in ath stats o query the hal for the number of frames still pending on the h/w tx queue for cab q handling o add primitive stuck beacon detection and handling o don't intercept management frames for stations in power save mode; leave it to the 802.11 layer to DTRT Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#30 edit .. //depot/projects/wifi/sys/dev/ath/if_athvar.h#11 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#30 (text+ko) ==== @@ -743,7 +743,10 @@ struct ath_softc *sc = arg; struct ifnet *ifp = &sc->sc_if; - if_printf(ifp, "hardware error; resetting\n"); + if (sc->sc_bmisscount != 0) + if_printf(ifp, "stuck beacon; resetting\n"); + else + if_printf(ifp, "hardware error; resetting\n"); ath_reset(ifp); } @@ -1120,12 +1123,6 @@ * to pass it along. */ ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; - if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && - (m->m_flags & M_PWR_SAV) == 0) { - ieee80211_pwrsave(ic, ni, m); - ni = NULL; /* keep reference */ - goto reclaim; - } m->m_pkthdr.rcvif = NULL; wh = mtod(m, struct ieee80211_frame *); @@ -1807,6 +1804,22 @@ __func__, ic->ic_flags, bf, bf ? bf->bf_m : NULL); return; } + if (ath_hal_numtxpending(ah, sc->sc_bhalq) != 0) { + sc->sc_bmisscount++; + DPRINTF(sc, ATH_DEBUG_BEACON_PROC, + "%s: missed %u consecutive beacons\n", + __func__, sc->sc_bmisscount); + /* XXX reset if too many? */ + if (sc->sc_bmisscount > 3) + taskqueue_enqueue(taskqueue_swi, &sc->sc_fataltask); + return; + } + if (sc->sc_bmisscount != 0) { + DPRINTF(sc, ATH_DEBUG_BEACON, + "%s: resume beacon xmit after %u misses\n", + __func__, sc->sc_bmisscount); + sc->sc_bmisscount = 0; + } /* * Update dynamic beacon contents. If this returns @@ -1815,7 +1828,7 @@ * (probably because of the TIM bitmap). */ m = bf->bf_m; - ncabq = sc->sc_cabq->axq_depth; /* XXX check h/w queue */ + ncabq = ath_hal_numtxpending(ah, sc->sc_cabq->axq_qnum); if (ieee80211_beacon_update(ic, bf->bf_node, &sc->sc_boff, m, ncabq)) { bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); if (ath_beacon_setup(sc, bf, m) != 0) { @@ -1844,7 +1857,7 @@ DPRINTF(sc, ATH_DEBUG_ANY, "%s: beacon queue %u did not stop?\n", __func__, sc->sc_bhalq); - /* NB: the HAL still stops DMA, so proceed */ + /* XXX how to recover? reset? */ } bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, BUS_DMASYNC_PREWRITE); @@ -1999,6 +2012,7 @@ sc->sc_imask |= HAL_INT_SWBA; /* beacon prepare */ } ath_hal_beaconinit(ah, nexttbtt, intval); + sc->sc_bmisscount = 0; ath_hal_intrset(ah, sc->sc_imask); /* * When using a self-linked beacon descriptor in @@ -4157,6 +4171,9 @@ ath_mode_init(sc); break; case SIOCGATHSTATS: + /* 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; sc->sc_stats.ast_rx_rssi = ieee80211_getrssi(ic); ATH_UNLOCK(sc); /* ==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#11 (text+ko) ==== @@ -215,6 +215,7 @@ struct task sc_txtask; /* tx int processing */ u_int sc_bhalq; /* HAL q for outgoing beacons */ + u_int sc_bmisscount; /* missed beacon transmits */ 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 */ @@ -316,6 +317,8 @@ ((*(_ah)->ah_setTxDP)((_ah), (_q), (_bufaddr))) #define ath_hal_gettxbuf(_ah, _q) \ ((*(_ah)->ah_getTxDP)((_ah), (_q))) +#define ath_hal_numtxpending(_ah, _q) \ + ((*(_ah)->ah_numTxPending)((_ah), (_q))) #define ath_hal_getrxbuf(_ah) \ ((*(_ah)->ah_getRxDP)((_ah))) #define ath_hal_txstart(_ah, _q) \