svn commit: r204579 - in head/sys/dev/ath/ath_hal: . ar5212 ar5416

Rui Paulo rpaulo at FreeBSD.org
Tue Mar 2 12:59:43 UTC 2010


Author: rpaulo
Date: Tue Mar  2 12:59:42 2010
New Revision: 204579
URL: http://svn.freebsd.org/changeset/base/204579

Log:
  Couple of suggestions from Sam regarding latest commit:
  o rename the new variables to comply with the naming scheme
  o move the new variables to an AR5212 specific struct
  o use ahp when available
  o revert to previous ts_flags check

Modified:
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
  head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h	Tue Mar  2 12:51:39 2010	(r204578)
+++ head/sys/dev/ath/ath_hal/ah_internal.h	Tue Mar  2 12:59:42 2010	(r204579)
@@ -281,8 +281,6 @@ struct ath_hal_private {
 	uint16_t	ah_maxPowerLevel;	/* calculated max tx power */
 	u_int		ah_tpScale;		/* tx power scale factor */
 	uint32_t	ah_11nCompat;		/* 11n compat controls */
-	uint8_t		ah_txtrig_level;	/* current Tx trigger level */
-	uint8_t		ah_max_txtrig_level;	/* max tx trigger level */
 
 	/*
 	 * State for regulatory domain handling.

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212.h	Tue Mar  2 12:51:39 2010	(r204578)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h	Tue Mar  2 12:59:42 2010	(r204579)
@@ -327,6 +327,9 @@ struct ath_hal_5212 {
 	uint16_t	*ah_pcdacTable;
 	u_int		ah_pcdacTableSize;
 	uint16_t	ah_ratesArray[16];
+
+	uint8_t		ah_txTrigLev;		/* current Tx trigger level */
+	uint8_t		ah_maxTxTrigLev;	/* max tx trigger level */
 };
 #define	AH5212(_ah)	((struct ath_hal_5212 *)(_ah))
 

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Tue Mar  2 12:51:39 2010	(r204578)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Tue Mar  2 12:59:42 2010	(r204579)
@@ -149,9 +149,6 @@ static const struct ath_hal_private ar52
 	.ah_getInterrupts		= ar5212GetInterrupts,
 	.ah_setInterrupts		= ar5212SetInterrupts },
 
-	.ah_txtrig_level		= INIT_TX_FIFO_THRESHOLD,
-	.ah_max_txtrig_level		= MAX_TX_FIFO_THRESHOLD,
-
 	.ah_getChannelEdges		= ar5212GetChannelEdges,
 	.ah_getWirelessModes		= ar5212GetWirelessModes,
 	.ah_eepromRead			= ar5212EepromRead,
@@ -251,6 +248,9 @@ ar5212InitState(struct ath_hal_5212 *ahp
 	ahp->ah_acktimeout = (u_int) -1;
 	ahp->ah_ctstimeout = (u_int) -1;
 	ahp->ah_sifstime = (u_int) -1;
+	ahp->ah_txTrigLev = INIT_TX_FIFO_THRESHOLD,
+	ahp->ah_maxTxTrigLev = MAX_TX_FIFO_THRESHOLD,
+
 	OS_MEMCPY(&ahp->ah_bssidmask, defbssidmask, IEEE80211_ADDR_LEN);
 #undef N
 }

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c	Tue Mar  2 12:51:39 2010	(r204578)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c	Tue Mar  2 12:59:42 2010	(r204579)
@@ -48,8 +48,7 @@ ar5212UpdateTxTrigLevel(struct ath_hal *
 	uint32_t txcfg, curLevel, newLevel;
 	HAL_INT omask;
 
-	if (AH_PRIVATE(ah)->ah_txtrig_level >=
-	    AH_PRIVATE(ah)->ah_max_txtrig_level)
+	if (ahp->ah_txTrigLev >= ahp->ah_maxTxTrigLev)
 		return AH_FALSE;
 
 	/*
@@ -61,7 +60,7 @@ ar5212UpdateTxTrigLevel(struct ath_hal *
 	curLevel = MS(txcfg, AR_FTRIG);
 	newLevel = curLevel;
 	if (bIncTrigLevel) {		/* increase the trigger level */
-		if (curLevel < AH_PRIVATE(ah)->ah_max_txtrig_level)
+		if (curLevel < ahp->ah_maxTxTrigLev)
 			newLevel++;
 	} else if (curLevel > MIN_TX_FIFO_THRESHOLD)
 		newLevel--;
@@ -70,7 +69,7 @@ ar5212UpdateTxTrigLevel(struct ath_hal *
 		OS_REG_WRITE(ah, AR_TXCFG,
 			(txcfg &~ AR_FTRIG) | SM(newLevel, AR_FTRIG));
 
-	AH_PRIVATE(ah)->ah_txtrig_level = newLevel;
+	ahp->ah_txTrigLev = newLevel;
 
 	/* re-enable chip interrupts */
 	ah->ah_setInterrupts(ah, omask);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Tue Mar  2 12:51:39 2010	(r204578)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Tue Mar  2 12:59:42 2010	(r204579)
@@ -436,6 +436,7 @@ ar5416ChannelChange(struct ath_hal *ah, 
 static void
 ar5416InitDMA(struct ath_hal *ah)
 {
+	struct ath_hal_5212 *ahp = AH5212(ah);
 
 	/*
 	 * set AHB_MODE not to do cacheline prefetches
@@ -457,7 +458,7 @@ ar5416InitDMA(struct ath_hal *ah)
 	/* restore TX trigger level */
 	OS_REG_WRITE(ah, AR_TXCFG,
 		(OS_REG_READ(ah, AR_TXCFG) &~ AR_FTRIG) |
-		    SM(AH_PRIVATE(ah)->ah_txtrig_level, AR_FTRIG));
+		    SM(ahp->ah_txTrigLev, AR_FTRIG));
 
 	/*
 	 * Setup receive FIFO threshold to hold off TX activities

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Tue Mar  2 12:51:39 2010	(r204578)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Tue Mar  2 12:59:42 2010	(r204579)
@@ -568,8 +568,7 @@ ar5416ProcTxDesc(struct ath_hal *ah,
 
 	/* handle tx trigger level changes internally */
 	if ((ts->ts_status & HAL_TXERR_FIFO) ||
-	    (ts->ts_flags & HAL_TX_DATA_UNDERRUN) ||
-	    (ts->ts_flags & HAL_TX_DELIM_UNDERRUN))
+	    (ts->ts_flags & (HAL_TX_DATA_UNDERRUN | HAL_TX_DELIM_UNDERRUN)))
 		ar5212UpdateTxTrigLevel(ah, AH_TRUE);
 
 	return HAL_OK;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c	Tue Mar  2 12:51:39 2010	(r204578)
+++ head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c	Tue Mar  2 12:59:42 2010	(r204579)
@@ -122,7 +122,7 @@ ar9285Attach(uint16_t devid, HAL_SOFTC s
 	AH5416(ah)->ah_rx_chainmask	= AR9285_DEFAULT_RXCHAINMASK;
 	AH5416(ah)->ah_tx_chainmask	= AR9285_DEFAULT_TXCHAINMASK;
 	
-	AH_PRIVATE(ah)->ah_max_txtrig_level = MAX_TX_FIFO_THRESHOLD >> 1;
+	ahp->ah_maxTxTrigLev		= MAX_TX_FIFO_THRESHOLD >> 1;
 
 	if (!ar5416SetResetReg(ah, HAL_RESET_POWER_ON)) {
 		/* reset chip */


More information about the svn-src-head mailing list