From owner-svn-src-user@FreeBSD.ORG Fri Sep 16 06:33:12 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4E12106566C; Fri, 16 Sep 2011 06:33:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3FB18FC08; Fri, 16 Sep 2011 06:33:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G6XCEg007801; Fri, 16 Sep 2011 06:33:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G6XCKg007798; Fri, 16 Sep 2011 06:33:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109160633.p8G6XCKg007798@svn.freebsd.org> From: Adrian Chadd Date: Fri, 16 Sep 2011 06:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225607 - in user/adrian/if_ath_tx/sys/dev/ath/ath_hal: ar5212 ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 06:33:12 -0000 Author: adrian Date: Fri Sep 16 06:33:12 2011 New Revision: 225607 URL: http://svn.freebsd.org/changeset/base/225607 Log: Tidy up the CAB queue defaults; do the same for AR5212. * add a check to the AR5416 CABQ setup to ensure a minimum cabq time; that way a negative calculated cabq time doesn't annoy things; * Port the AR5416 CABQ setup stuff to AR5212. TODO: still do this in the driver.. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c Fri Sep 16 05:57:01 2011 (r225606) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c Fri Sep 16 06:33:12 2011 (r225607) @@ -263,6 +263,7 @@ ar5212ReleaseTxQueue(struct ath_hal *ah, * Assumes: * phwChannel has been set to point to the current channel */ +#define TU_TO_USEC(_tu) ((_tu) << 10) HAL_BOOL ar5212ResetTxQueue(struct ath_hal *ah, u_int q) { @@ -270,7 +271,7 @@ ar5212ResetTxQueue(struct ath_hal *ah, u HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps; const struct ieee80211_channel *chan = AH_PRIVATE(ah)->ah_curchan; HAL_TX_QUEUE_INFO *qi; - uint32_t cwMin, chanCwMin, value, qmisc, dmisc; + uint32_t cwMin, chanCwMin, qmisc, dmisc; if (q >= pCap->halTotalQueues) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid queue num %u\n", @@ -409,17 +410,40 @@ ar5212ResetTxQueue(struct ath_hal *ah, u | AR_Q_MISC_CBR_INCR_DIS1 | AR_Q_MISC_CBR_INCR_DIS0; - if (!qi->tqi_readyTime) { + if (qi->tqi_readyTime) { + HALDEBUG(ah, HAL_DEBUG_TXQUEUE, + "%s: using tqi_readyTime\n", __func__); + OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), + SM(qi->tqi_readyTime, AR_Q_RDYTIMECFG_INT) | + AR_Q_RDYTIMECFG_ENA); + } else { + int value; /* * NB: don't set default ready time if driver * has explicitly specified something. This is * here solely for backwards compatibility. */ - value = (ahp->ah_beaconInterval + /* + * XXX for now, hard-code a CAB interval of 70% + * XXX of the total beacon interval. + */ + + value = (ahp->ah_beaconInterval * 70 / 100) - (ah->ah_config.ah_sw_beacon_response_time - - ah->ah_config.ah_dma_beacon_response_time) - - ah->ah_config.ah_additional_swba_backoff) * 1024; - OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), value | AR_Q_RDYTIMECFG_ENA); + + ah->ah_config.ah_dma_beacon_response_time) + - ah->ah_config.ah_additional_swba_backoff; + /* + * XXX Ensure it isn't too low - nothing lower + * XXX than 10 TU + */ + if (value < 10) + value = 10; + HALDEBUG(ah, HAL_DEBUG_TXQUEUE, + "%s: defaulting to rdytime = %d uS\n", + __func__, value); + OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), + SM(TU_TO_USEC(value), AR_Q_RDYTIMECFG_INT) | + AR_Q_RDYTIMECFG_ENA); } dmisc |= SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL, AR_D_MISC_ARB_LOCKOUT_CNTRL); @@ -481,6 +505,7 @@ ar5212ResetTxQueue(struct ath_hal *ah, u return AH_TRUE; } +#undef TU_TO_USEC /* * Get the TXDP for the specified queue Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Fri Sep 16 05:57:01 2011 (r225606) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Fri Sep 16 06:33:12 2011 (r225607) @@ -949,7 +949,7 @@ ar5416ResetTxQueue(struct ath_hal *ah, u HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps; const struct ieee80211_channel *chan = AH_PRIVATE(ah)->ah_curchan; HAL_TX_QUEUE_INFO *qi; - uint32_t cwMin, chanCwMin, value, qmisc, dmisc; + uint32_t cwMin, chanCwMin, qmisc, dmisc; if (q >= pCap->halTotalQueues) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid queue num %u\n", @@ -1100,6 +1100,7 @@ ar5416ResetTxQueue(struct ath_hal *ah, u SM(qi->tqi_readyTime, AR_Q_RDYTIMECFG_INT) | AR_Q_RDYTIMECFG_ENA); } else { + int value; /* * NB: don't set default ready time if driver * has explicitly specified something. This is @@ -1108,20 +1109,27 @@ ar5416ResetTxQueue(struct ath_hal *ah, u /* * XXX for now, hard-code a CAB interval of 70% * XXX of the total beacon interval. + * * XXX This keeps Merlin and later based MACs * XXX quite a bit happier (stops stuck beacons, * XXX which I gather is because of such a long * XXX cabq time.) */ - value = TU_TO_USEC((ahp->ah_beaconInterval * 70 / 100) + value = (ahp->ah_beaconInterval * 70 / 100) - (ah->ah_config.ah_sw_beacon_response_time + ah->ah_config.ah_dma_beacon_response_time) - - ah->ah_config.ah_additional_swba_backoff); + - ah->ah_config.ah_additional_swba_backoff; + /* + * XXX Ensure it isn't too low - nothing lower + * XXX than 10 TU + */ + if (value < 10) + value = 10; HALDEBUG(ah, HAL_DEBUG_TXQUEUE, - "%s: defaulting to rdytime = %d\n", + "%s: defaulting to rdytime = %d uS\n", __func__, value); OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), - SM(value, AR_Q_RDYTIMECFG_INT) | + SM(TU_TO_USEC(value), AR_Q_RDYTIMECFG_INT) | AR_Q_RDYTIMECFG_ENA); } dmisc |= SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL,