Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Sep 2011 06:33:12 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r225607 - in user/adrian/if_ath_tx/sys/dev/ath/ath_hal: ar5212 ar5416
Message-ID:  <201109160633.p8G6XCKg007798@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109160633.p8G6XCKg007798>