From 534f8ec8b2fd42ea9708dbfbecfbe9d2d3ca7fb6 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sat, 19 Mar 2011 03:15:28 +0000 Subject: [PATCH] Make sure that the AR_MISC_MODE value from the initvals are properly respected. This commit really is "fix the OFDM duration calculation to match reality when running in 802.11g mode." The AR5212 init vals set AR_MISC_MODE to 0x0 and all the bits that can be set are set through code. The AR5416 and later initvals set AR_MISC_MODE to various other values (with the AR5212 AR_MISC_MODE options cleared), which include AR_PCU_CCK_SIFS_MODE . This adds 6uS to SIFS on non-CCK frames when transmitting. This fixes the issue where _DATA_ 802.11g OFDM frames were being TX'ed with the ACK duration set to 38uS, not 44uS as on the AR5212 (and other devices.) The AR5212 TX pathway obeys the software-programmed duration field in the packet, but the 11n TX pathway overrides that with a hardware-calculated duration. This was getting it wrong because of the above AR_MISC_MODE setting. I've verified that 11g data OFDM frames are now being TXed with the correct ACK+SIFS duration programmed in. --- sys/dev/ath/ath_hal/ar5212/ar5212_misc.c | 2 +- sys/dev/ath/ath_hal/ar5212/ar5212_recv.c | 2 +- sys/dev/ath/ath_hal/ar5416/ar5416_attach.c | 2 +- sys/dev/ath/ath_hal/ar5416/ar5416_reset.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c index 4e3553056791..15f38644869f 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c @@ -934,7 +934,7 @@ ar5212SetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, else ahp->ah_miscMode |= AR_MISC_MODE_MIC_NEW_LOC_ENABLE; /* NB: write here so keys can be setup w/o a reset */ - OS_REG_WRITE(ah, AR_MISC_MODE, ahp->ah_miscMode); + OS_REG_WRITE(ah, AR_MISC_MODE, OS_REG_READ(ah, AR_MISC_MODE) | ahp->ah_miscMode); return AH_TRUE; case HAL_CAP_DIVERSITY: if (ahp->ah_phyPowerOn) { diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c b/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c index eee18b037c22..3488fc386b6d 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c @@ -199,7 +199,7 @@ ar5212SetRxFilter(struct ath_hal *ah, uint32_t bits) ahp->ah_miscMode |= AR_MISC_MODE_BSSID_MATCH_FORCE; else ahp->ah_miscMode &= ~AR_MISC_MODE_BSSID_MATCH_FORCE; - OS_REG_WRITE(ah, AR_MISC_MODE, ahp->ah_miscMode); + OS_REG_WRITE(ah, AR_MISC_MODE, OS_REG_READ(ah, AR_MISC_MODE) | ahp->ah_miscMode); } } diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c index a38352bd14ac..99ca2a145028 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c @@ -372,7 +372,7 @@ ar5416Attach(uint16_t devid, HAL_SOFTC sc, * placed into hardware. */ if (ahp->ah_miscMode != 0) - OS_REG_WRITE(ah, AR_MISC_MODE, ahp->ah_miscMode); + OS_REG_WRITE(ah, AR_MISC_MODE, OS_REG_READ(ah, AR_MISC_MODE) | ahp->ah_miscMode); rfStatus = ar2133RfAttach(ah, &ecode); if (!rfStatus) { diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c index b12211731812..00decc0c91d3 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c @@ -581,7 +581,7 @@ ar5416InitUserSettings(struct ath_hal *ah) /* Restore user-specified settings */ if (ahp->ah_miscMode != 0) - OS_REG_WRITE(ah, AR_MISC_MODE, ahp->ah_miscMode); + OS_REG_WRITE(ah, AR_MISC_MODE, OS_REG_READ(ah, AR_MISC_MODE) | ahp->ah_miscMode); if (ahp->ah_sifstime != (u_int) -1) ar5212SetSifsTime(ah, ahp->ah_sifstime); if (ahp->ah_slottime != (u_int) -1)