From 1f4a550847316d9c238e631b6164381b8b07394a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 11 Jul 2010 03:50:46 +0000 Subject: [PATCH] ath9k: add another batch of stability updates and misc fixes git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22123 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../520-ath9k_ar9285_diversity_fix.patch | 77 +++++++++++++++++++ .../patches/521-ath9k_iqcal_fix.patch | 11 +++ .../patches/522-ath9k_pwrcal_fix.patch | 11 +++ .../523-ath9k_channel_change_fix.patch | 15 ++++ .../524-ath9k_aggr_status_validate.patch | 51 ++++++++++++ .../patches/525-ath9k_handle_keymiss.patch | 23 ++++++ 6 files changed, 188 insertions(+) create mode 100644 package/mac80211/patches/520-ath9k_ar9285_diversity_fix.patch create mode 100644 package/mac80211/patches/521-ath9k_iqcal_fix.patch create mode 100644 package/mac80211/patches/522-ath9k_pwrcal_fix.patch create mode 100644 package/mac80211/patches/523-ath9k_channel_change_fix.patch create mode 100644 package/mac80211/patches/524-ath9k_aggr_status_validate.patch create mode 100644 package/mac80211/patches/525-ath9k_handle_keymiss.patch diff --git a/package/mac80211/patches/520-ath9k_ar9285_diversity_fix.patch b/package/mac80211/patches/520-ath9k_ar9285_diversity_fix.patch new file mode 100644 index 0000000000..a79667421d --- /dev/null +++ b/package/mac80211/patches/520-ath9k_ar9285_diversity_fix.patch @@ -0,0 +1,77 @@ +--- a/drivers/net/wireless/ath/ath9k/eeprom.h ++++ b/drivers/net/wireless/ath/ath9k/eeprom.h +@@ -670,7 +670,7 @@ struct eeprom_ops { + int (*get_eeprom_ver)(struct ath_hw *hw); + int (*get_eeprom_rev)(struct ath_hw *hw); + u8 (*get_num_ant_config)(struct ath_hw *hw, enum ieee80211_band band); +- u16 (*get_eeprom_antenna_cfg)(struct ath_hw *hw, ++ u32 (*get_eeprom_antenna_cfg)(struct ath_hw *hw, + struct ath9k_channel *chan); + void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); + void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); +--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c +@@ -1130,13 +1130,13 @@ static u8 ath9k_hw_ar9287_get_num_ant_co + return 1; + } + +-static u16 ath9k_hw_ar9287_get_eeprom_antenna_cfg(struct ath_hw *ah, ++static u32 ath9k_hw_ar9287_get_eeprom_antenna_cfg(struct ath_hw *ah, + struct ath9k_channel *chan) + { + struct ar9287_eeprom *eep = &ah->eeprom.map9287; + struct modal_eep_ar9287_header *pModal = &eep->modalHeader; + +- return pModal->antCtrlCommon & 0xFFFF; ++ return pModal->antCtrlCommon; + } + + static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw *ah, +--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c +@@ -1438,14 +1438,14 @@ static u8 ath9k_hw_def_get_num_ant_confi + return num_ant_config; + } + +-static u16 ath9k_hw_def_get_eeprom_antenna_cfg(struct ath_hw *ah, ++static u32 ath9k_hw_def_get_eeprom_antenna_cfg(struct ath_hw *ah, + struct ath9k_channel *chan) + { + struct ar5416_eeprom_def *eep = &ah->eeprom.def; + struct modal_eep_header *pModal = + &(eep->modalHeader[IS_CHAN_2GHZ(chan)]); + +- return pModal->antCtrlCommon & 0xFFFF; ++ return pModal->antCtrlCommon; + } + + static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz) +--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c +@@ -1150,13 +1150,13 @@ static void ath9k_hw_4k_set_board_values + } + } + +-static u16 ath9k_hw_4k_get_eeprom_antenna_cfg(struct ath_hw *ah, ++static u32 ath9k_hw_4k_get_eeprom_antenna_cfg(struct ath_hw *ah, + struct ath9k_channel *chan) + { + struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k; + struct modal_eep_4k_header *pModal = &eep->modalHeader; + +- return pModal->antCtrlCommon & 0xFFFF; ++ return pModal->antCtrlCommon; + } + + static u8 ath9k_hw_4k_get_num_ant_config(struct ath_hw *ah, +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +@@ -951,7 +951,7 @@ static u8 ath9k_hw_ar9300_get_num_ant_co + return 1; + } + +-static u16 ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw *ah, ++static u32 ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw *ah, + struct ath9k_channel *chan) + { + return -EINVAL; diff --git a/package/mac80211/patches/521-ath9k_iqcal_fix.patch b/package/mac80211/patches/521-ath9k_iqcal_fix.patch new file mode 100644 index 0000000000..1efd6ccccc --- /dev/null +++ b/package/mac80211/patches/521-ath9k_iqcal_fix.patch @@ -0,0 +1,11 @@ +--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c +@@ -239,7 +239,7 @@ static void ar9002_hw_iqcalibrate(struct + if (qCoff > 15) + qCoff = 15; + else if (qCoff <= -16) +- qCoff = 16; ++ qCoff = -16; + + ath_print(common, ATH_DBG_CALIBRATE, + "Chn %d : iCoff = 0x%x qCoff = 0x%x\n", diff --git a/package/mac80211/patches/522-ath9k_pwrcal_fix.patch b/package/mac80211/patches/522-ath9k_pwrcal_fix.patch new file mode 100644 index 0000000000..6a41c9f88b --- /dev/null +++ b/package/mac80211/patches/522-ath9k_pwrcal_fix.patch @@ -0,0 +1,11 @@ +--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c +@@ -730,7 +730,7 @@ static void ath9k_hw_get_def_gain_bounda + vpdTableI[i][sizeCurrVpdTable - 2]); + vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep); + +- if (tgtIndex > maxIndex) { ++ if (tgtIndex >= maxIndex) { + while ((ss <= tgtIndex) && + (k < (AR5416_NUM_PDADC_VALUES - 1))) { + tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] + diff --git a/package/mac80211/patches/523-ath9k_channel_change_fix.patch b/package/mac80211/patches/523-ath9k_channel_change_fix.patch new file mode 100644 index 0000000000..0f10cb38da --- /dev/null +++ b/package/mac80211/patches/523-ath9k_channel_change_fix.patch @@ -0,0 +1,15 @@ +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -1244,9 +1244,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st + + if (!ah->chip_fullsleep) { + ath9k_hw_abortpcurecv(ah); +- if (!ath9k_hw_stopdmarecv(ah)) ++ if (!ath9k_hw_stopdmarecv(ah)) { + ath_print(common, ATH_DBG_XMIT, + "Failed to stop receive dma\n"); ++ bChannelChange = false; ++ } + } + + if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) diff --git a/package/mac80211/patches/524-ath9k_aggr_status_validate.patch b/package/mac80211/patches/524-ath9k_aggr_status_validate.patch new file mode 100644 index 0000000000..e6ea97e97e --- /dev/null +++ b/package/mac80211/patches/524-ath9k_aggr_status_validate.patch @@ -0,0 +1,51 @@ +--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c +@@ -287,6 +287,7 @@ static int ar9002_hw_proc_txdesc(struct + ts->ts_shortretry = MS(ads->ds_txstatus1, AR_RTSFailCnt); + ts->ts_longretry = MS(ads->ds_txstatus1, AR_DataFailCnt); + ts->ts_virtcol = MS(ads->ds_txstatus1, AR_VirtRetryCnt); ++ ts->tid = MS(ads->ds_txstatus9, AR_TxTid); + ts->ts_antenna = 0; + + return 0; +--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.h ++++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.h +@@ -33,9 +33,6 @@ + #define AR_TxDescId_S 16 + #define AR_TxPtrChkSum 0x0000ffff + +-#define AR_TxTid 0xf0000000 +-#define AR_TxTid_S 28 +- + #define AR_LowRxChain 0x00004000 + + #define AR_Not_Sounding 0x20000000 +--- a/drivers/net/wireless/ath/ath9k/mac.h ++++ b/drivers/net/wireless/ath/ath9k/mac.h +@@ -485,6 +485,9 @@ struct ar5416_desc { + #define AR_TxRSSICombined 0xff000000 + #define AR_TxRSSICombined_S 24 + ++#define AR_TxTid 0xf0000000 ++#define AR_TxTid_S 28 ++ + #define AR_TxEVM0 ds_txstatus5 + #define AR_TxEVM1 ds_txstatus6 + #define AR_TxEVM2 ds_txstatus7 +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -355,6 +355,14 @@ static void ath_tx_complete_aggr(struct + an = (struct ath_node *)sta->drv_priv; + tid = ATH_AN_2_TID(an, bf->bf_tidno); + ++ /* ++ * The hardware occasionally sends a tx status for the wrong TID. ++ * In this case, the BA status cannot be considered valid and all ++ * subframes need to be retransmitted ++ */ ++ if (bf->bf_tidno != ts->tid) ++ txok = false; ++ + isaggr = bf_isaggr(bf); + memset(ba, 0, WME_BA_BMP_SIZE >> 3); + diff --git a/package/mac80211/patches/525-ath9k_handle_keymiss.patch b/package/mac80211/patches/525-ath9k_handle_keymiss.patch new file mode 100644 index 0000000000..a2031cf468 --- /dev/null +++ b/package/mac80211/patches/525-ath9k_handle_keymiss.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/wireless/ath/ath9k/mac.c ++++ b/drivers/net/wireless/ath/ath9k/mac.c +@@ -701,6 +701,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a + rs->rs_flags |= ATH9K_RX_DELIM_CRC_POST; + if (ads.ds_rxstatus8 & AR_DecryptBusyErr) + rs->rs_flags |= ATH9K_RX_DECRYPT_BUSY; ++ if (ads.ds_rxstatus8 & AR_KeyMiss) ++ rs->rs_keyix = ATH9K_RXKEYIX_INVALID; + + if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) { + if (ads.ds_rxstatus8 & AR_CRCErr) +--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c ++++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c +@@ -578,6 +578,9 @@ int ath9k_hw_process_rxdesc_edma(struct + if (rxsp->status11 & AR_DecryptBusyErr) + rxs->rs_flags |= ATH9K_RX_DECRYPT_BUSY; + ++ if (rxsp->status11 & AR_KeyMiss) ++ rxs->rs_keyix = ATH9K_RXKEYIX_INVALID; ++ + if ((rxsp->status11 & AR_RxFrameOK) == 0) { + if (rxsp->status11 & AR_CRCErr) { + rxs->rs_status |= ATH9K_RXERR_CRC;