Date: Fri, 5 Nov 2004 00:29:01 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 64280 for review Message-ID: <200411050029.iA50T1vh046022@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=64280 Change 64280 by sam@sam_ebb on 2004/11/05 00:28:12 Handle forthcoming parts that have few h/w tx queues. When we don't have enough queues to handle all the WME classes we fallback to sticking them all in the same h/w queue. We could do better here if we're more intelligent about managing the queues, like allocating+freeing them based on operation mode changes (since the only issue is when operating in ap or ibss mode). To be revisited. Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#12 edit .. //depot/projects/wifi/sys/dev/ath/if_athvar.h#4 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#12 (text+ko) ==== @@ -249,6 +249,7 @@ struct ath_hal *ah; HAL_STATUS status; int error = 0, i; + u_int32_t numqs; DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid); @@ -376,14 +377,35 @@ error = EIO; goto bad2; } - /* NB: insure BK queue is h/w queue 0 */ - if (!ath_tx_setup(sc, WME_AC_BK, HAL_WME_AC_BK) || - !ath_tx_setup(sc, WME_AC_BE, HAL_WME_AC_BE) || - !ath_tx_setup(sc, WME_AC_VI, HAL_WME_AC_VI) || - !ath_tx_setup(sc, WME_AC_VO, HAL_WME_AC_VO)) { - error = EIO; - goto bad2; + (void) ath_hal_getnumtxqueues(ah, &numqs); + if (numqs < 5) { + int qnum; + /* + * Not enough hardware tx queues to properly do WME; + * just punt and assign them all to the same h/w queue. + * We could do a better job of this if, for example, + * we allocate queues when we switch from station + * to AP mode. + */ + if (!ath_tx_setup(sc, WME_AC_BK, HAL_WME_AC_BK)) { + error = EIO; + goto bad2; + } + qnum = sc->sc_txq[WME_AC_BK].axq_qnum; + sc->sc_ac2q[WME_AC_BE] = &sc->sc_txq[qnum]; + sc->sc_ac2q[WME_AC_VI] = &sc->sc_txq[qnum]; + sc->sc_ac2q[WME_AC_VO] = &sc->sc_txq[qnum]; + } else { + /* NB: insure BK queue is h/w queue 0 */ + if (!ath_tx_setup(sc, WME_AC_BK, HAL_WME_AC_BK) || + !ath_tx_setup(sc, WME_AC_BE, HAL_WME_AC_BE) || + !ath_tx_setup(sc, WME_AC_VI, HAL_WME_AC_VI) || + !ath_tx_setup(sc, WME_AC_VO, HAL_WME_AC_VO)) { + error = EIO; + goto bad2; + } } + /* * Special case certain configurations. */ @@ -511,13 +533,13 @@ ath_announce(sc); return 0; bad2: - if (sc->sc_txq[WME_AC_BK].axq_qnum != (u_int) -1) + if (ATH_TXQ_SETUP(sc, WME_AC_BK)) ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_BK]); - if (sc->sc_txq[WME_AC_BE].axq_qnum != (u_int) -1) + if (ATH_TXQ_SETUP(sc, WME_AC_BE)) ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_BE]); - if (sc->sc_txq[WME_AC_VI].axq_qnum != (u_int) -1) + if (ATH_TXQ_SETUP(sc, WME_AC_VI)) ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_VI]); - if (sc->sc_txq[WME_AC_VO].axq_qnum != (u_int) -1) + if (ATH_TXQ_SETUP(sc, WME_AC_VO)) ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_VO]); ath_desc_free(sc); bad: ==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#4 (text+ko) ==== @@ -400,6 +400,8 @@ (ath_hal_getcapability(_ah, HAL_CAP_DIAG, 0, _pv) == HAL_OK) #define ath_hal_setdiag(_ah, _v) \ ath_hal_setcapability(_ah, HAL_CAP_DIAG, 0, _v, NULL) +#define ath_hal_getnumtxqueues(_ah, _pv) \ + (ath_hal_getcapability(_ah, HAL_CAP_NUM_TXQUEUES, 0, _pv) == HAL_OK) #define ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \ ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq)))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411050029.iA50T1vh046022>
