From 256796db581d0ddf6884e8b1c8365f65b8514086 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Tue, 2 Mar 2010 12:59:42 +0000 Subject: [PATCH] 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 --- sys/dev/ath/ath_hal/ah_internal.h | 2 -- sys/dev/ath/ath_hal/ar5212/ar5212.h | 3 +++ sys/dev/ath/ath_hal/ar5212/ar5212_attach.c | 6 +++--- sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c | 7 +++---- sys/dev/ath/ath_hal/ar5416/ar5416_reset.c | 3 ++- sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c | 3 +-- sys/dev/ath/ath_hal/ar5416/ar9285_attach.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h index d284dfdf860..8f7ba65cb0c 100644 --- a/sys/dev/ath/ath_hal/ah_internal.h +++ b/sys/dev/ath/ath_hal/ah_internal.h @@ -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. diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212.h b/sys/dev/ath/ath_hal/ar5212/ar5212.h index 4f60c3bcb18..6590eb4a202 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212.h +++ b/sys/dev/ath/ath_hal/ar5212/ar5212.h @@ -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)) diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c index 67fe36092b8..78571227f6b 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c @@ -149,9 +149,6 @@ static const struct ath_hal_private ar5212hal = {{ .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, uint16_t devid, HAL_SOFTC sc, 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 } diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c b/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c index 45404cf89cb..ed9de14d00a 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c @@ -48,8 +48,7 @@ ar5212UpdateTxTrigLevel(struct ath_hal *ah, HAL_BOOL bIncTrigLevel) 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 *ah, HAL_BOOL bIncTrigLevel) 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 *ah, HAL_BOOL bIncTrigLevel) 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); diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c index 2950817ed60..d506a6aaf0a 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c @@ -436,6 +436,7 @@ ar5416ChannelChange(struct ath_hal *ah, const structu ieee80211_channel *chan) 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 diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c index 98059350309..47277a18b4e 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c @@ -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; diff --git a/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c b/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c index 6d4f25ec69c..946133a396f 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c +++ b/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c @@ -122,7 +122,7 @@ ar9285Attach(uint16_t devid, HAL_SOFTC sc, 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 */ -- 2.45.2