Date: Thu, 15 Sep 2005 22:50:51 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 83715 for review Message-ID: <200509152250.j8FMopXs028638@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=83715 Change 83715 by sam@sam_ebb on 2005/09/15 22:50:38 o make country code writable o check for state transition between frags o eliminate private tx timer now that we're the sole user of the ifnet timer o fix rssi stats collected for the hal o IFC cts duration fix Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#102 edit .. //depot/projects/wifi/sys/dev/ath/if_athvar.h#42 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#102 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.102 2005/08/10 16:22:29 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.103 2005/08/12 23:11:44 sam Exp $"); /* * Driver for the Atheros Wireless LAN controller. @@ -150,6 +150,7 @@ static int ath_wme_update(struct ieee80211com *); static void ath_tx_cleanupq(struct ath_softc *, struct ath_txq *); static void ath_tx_cleanup(struct ath_softc *); +static void ath_freetx(struct mbuf *); static int ath_tx_start(struct ath_softc *, struct ieee80211_node *, struct ath_buf *, struct mbuf *); static void ath_tx_proc_q0(void *, int); @@ -195,7 +196,7 @@ 0, "extended channel mode"); TUNABLE_INT("hw.ath.xchanmode", &ath_xchanmode); static int ath_countrycode = CTRY_DEFAULT; /* country code */ -SYSCTL_INT(_hw_ath, OID_AUTO, countrycode, CTLFLAG_RD, &ath_countrycode, +SYSCTL_INT(_hw_ath, OID_AUTO, countrycode, CTLFLAG_RW, &ath_countrycode, 0, "country code"); TUNABLE_INT("hw.ath.countrycode", &ath_countrycode); static int ath_regdomain = 0; /* regulatory domain */ @@ -1465,8 +1466,9 @@ */ if (ic->ic_state != IEEE80211_S_RUN) { DPRINTF(sc, ATH_DEBUG_ANY, - "%s: ignore data packet, state %u\n", - __func__, ic->ic_state); + "%s: discard data packet, state %s\n", + __func__, + ieee80211_state_name[ic->ic_state]); sc->sc_stats.ast_tx_discard++; ATH_TXBUF_LOCK(sc); STAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); @@ -1623,6 +1625,18 @@ continue; } if (next != NULL) { + /* + * Beware of state changing between frags. + * XXX check sta power-save state? + */ + if (ic->ic_state != IEEE80211_S_RUN) { + DPRINTF(sc, ATH_DEBUG_ANY, + "%s: flush fragmented packet, state %s\n", + __func__, + ieee80211_state_name[ic->ic_state]); + ath_freetx(next); + goto reclaim; + } m = next; bf = STAILQ_FIRST(&frags); KASSERT(bf != NULL, ("no buf for txfrag")); @@ -1630,8 +1644,7 @@ goto nextfrag; } - sc->sc_tx_timer = 5; - ifp->if_timer = 1; + ifp->if_timer = 5; #if 0 /* * Flush stale frames from the fast-frame staging queue. @@ -2870,9 +2883,6 @@ 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); @@ -3019,7 +3029,7 @@ switch (subtype) { case IEEE80211_FC0_SUBTYPE_BEACON: /* update rssi statistics for use by the hal */ - ATH_RSSI_LPF(ATH_NODE(ni)->an_halstats.ns_avgbrssi, rssi); + ATH_RSSI_LPF(sc->sc_halstats.ns_avgbrssi, rssi); if (sc->sc_syncbeacon && ni == ic->ic_bss && ic->ic_state == IEEE80211_S_RUN) { /* @@ -3306,6 +3316,7 @@ */ an = ATH_NODE(ni); ATH_RSSI_LPF(an->an_avgrssi, ds->ds_rxstat.rs_rssi); + ATH_RSSI_LPF(sc->sc_halstats.ns_avgrssi, ds->ds_rxstat.rs_rssi); /* * Send frame up for processing. */ @@ -3990,14 +4001,14 @@ ctsduration += ath_hal_computetxtime(ah, rt, pktlen, rix, AH_TRUE); if ((flags & HAL_TXDESC_NOACK) == 0) /* SIFS + ACK */ - ctsduration += rt->info[cix].spAckDuration; + ctsduration += rt->info[rix].spAckDuration; } else { if (flags & HAL_TXDESC_RTSENA) /* SIFS + CTS */ ctsduration += rt->info[cix].lpAckDuration; ctsduration += ath_hal_computetxtime(ah, rt, pktlen, rix, AH_FALSE); if ((flags & HAL_TXDESC_NOACK) == 0) /* SIFS + ACK */ - ctsduration += rt->info[cix].lpAckDuration; + ctsduration += rt->info[rix].lpAckDuration; } /* * Must disable multi-rate retry when using RTS/CTS. @@ -4226,7 +4237,7 @@ sc->sc_stats.ast_tx_altrate++; sc->sc_stats.ast_tx_rssi = ds->ds_txstat.ts_rssi; - ATH_RSSI_LPF(an->an_halstats.ns_avgtxrssi, + ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi, ds->ds_txstat.ts_rssi); pri = M_WME_GETAC(bf->bf_m); if (pri >= WME_AC_VO) @@ -4302,7 +4313,7 @@ if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum)) ath_tx_processq(sc, sc->sc_cabq); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->sc_tx_timer = 0; + ifp->if_timer = 0; if (sc->sc_softled) ath_led_event(sc, ATH_LED_TX); @@ -4335,7 +4346,7 @@ ath_tx_processq(sc, sc->sc_cabq); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->sc_tx_timer = 0; + ifp->if_timer = 0; if (sc->sc_softled) ath_led_event(sc, ATH_LED_TX); @@ -4361,7 +4372,7 @@ ath_tx_processq(sc, &sc->sc_txq[i]); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->sc_tx_timer = 0; + ifp->if_timer = 0; if (sc->sc_softled) ath_led_event(sc, ATH_LED_TX); @@ -4450,7 +4461,7 @@ if (ATH_TXQ_SETUP(sc, i)) ath_tx_draintxq(sc, &sc->sc_txq[i]); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->sc_tx_timer = 0; + ifp->if_timer = 0; } /* @@ -5227,17 +5238,11 @@ { struct ath_softc *sc = ifp->if_softc; - ifp->if_timer = 0; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid) - return; - if (sc->sc_tx_timer) { - if (--sc->sc_tx_timer == 0) { - if_printf(ifp, "device timeout\n"); - ath_reset(ifp); - ifp->if_oerrors++; - sc->sc_stats.ast_watchdog++; - } else - ifp->if_timer = 1; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->sc_invalid) { + if_printf(ifp, "device timeout\n"); + ath_reset(ifp); + ifp->if_oerrors++; + sc->sc_stats.ast_watchdog++; } } ==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#42 (text+ko) ==== @@ -84,7 +84,6 @@ u_int8_t an_tx_mgtrate; /* h/w rate for management/ctl frames */ u_int8_t an_tx_mgtratesp;/* short preamble h/w rate for " " */ u_int32_t an_avgrssi; /* average rssi over all rx frames */ - HAL_NODE_STATS an_halstats; /* rssi statistics used by hal */ struct ath_buf *an_ff_buf[WME_NUM_AC]; /* ff staging area */ /* variable-length rate control state follows */ }; @@ -293,7 +292,6 @@ struct ath_descdma sc_txdma; /* TX descriptors */ ath_bufhead sc_txbuf; /* transmit buffer */ struct mtx sc_txbuflock; /* txbuf lock */ - int sc_tx_timer; /* transmit timeout */ u_int sc_txqsetup; /* h/w queues setup */ u_int sc_txintrperiod;/* tx interrupt batching */ struct ath_txq sc_txq[HAL_NUM_TX_QUEUES]; @@ -533,7 +531,7 @@ #define ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \ ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq))) #define ath_hal_rxprocdesc(_ah, _ds, _dspa, _dsnext) \ - ((*(_ah)->ah_procRxDesc)((_ah), (_ds), (_dspa), (_dsnext))) + ((*(_ah)->ah_procRxDesc)((_ah), (_ds), (_dspa), (_dsnext), 0)) #define ath_hal_setuptxdesc(_ah, _ds, _plen, _hlen, _atype, _txpow, \ _txr0, _txtr0, _keyix, _ant, _flags, \ _rtsrate, _rtsdura) \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509152250.j8FMopXs028638>