From owner-p4-projects@FreeBSD.ORG Fri Nov 5 00:29:02 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 77AE616A4D0; Fri, 5 Nov 2004 00:29:02 +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 3BC0416A4CE for ; Fri, 5 Nov 2004 00:29:02 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 20AF843D64 for ; Fri, 5 Nov 2004 00:29:02 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iA50T1iw046025 for ; Fri, 5 Nov 2004 00:29:01 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iA50T1vh046022 for perforce@freebsd.org; Fri, 5 Nov 2004 00:29:01 GMT (envelope-from sam@freebsd.org) Date: Fri, 5 Nov 2004 00:29:01 GMT Message-Id: <200411050029.iA50T1vh046022@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 64280 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: Fri, 05 Nov 2004 00:29:02 -0000 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)))