PERFORCE change 66078 for review
Sam Leffler
sam at FreeBSD.org
Mon Nov 29 17:09:43 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=66078
Change 66078 by sam at 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) \
More information about the p4-projects
mailing list