From 470731a179f6dda63a23f4f7dcb7075c53ea969f Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 31 Aug 2011 06:34:53 +0000 Subject: [PATCH] ath9k: merge a pending fix for 5 ghz rx latency git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28137 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../mac80211/patches/300-pending_work.patch | 23 ++++++++++++- .../510-ath9k_intr_mitigation_tweak.patch | 2 +- .../patches/513-ath9k_channelbw_debugfs.patch | 2 +- .../570-ath9k_fix_ack_cts_timeout.patch | 4 +-- .../580-ath9k_remove_common_chainmask.patch | 4 +-- .../patches/581-ath9k_use_reset_work.patch | 33 ++++++++++++++++--- .../582-ath9k_merge_reset_functions.patch | 30 +++++++++-------- .../patches/593-ath9k_ar9280_cold_reset.patch | 2 +- 8 files changed, 74 insertions(+), 26 deletions(-) diff --git a/package/mac80211/patches/300-pending_work.patch b/package/mac80211/patches/300-pending_work.patch index 01df8f745..ce766af82 100644 --- a/package/mac80211/patches/300-pending_work.patch +++ b/package/mac80211/patches/300-pending_work.patch @@ -258,7 +258,28 @@ if (AR_SREV_9340(ah) && !ah->is_clk_25mhz) --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -997,8 +997,14 @@ void ath9k_hw_init_global_settings(struc +@@ -975,7 +975,10 @@ void ath9k_hw_init_global_settings(struc + if (ah->misc_mode != 0) + REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode); + +- rx_lat = 37; ++ if (IS_CHAN_A_FAST_CLOCK(ah, chan)) ++ rx_lat = 41; ++ else ++ rx_lat = 37; + tx_lat = 54; + + if (IS_CHAN_HALF_RATE(chan)) { +@@ -989,7 +992,7 @@ void ath9k_hw_init_global_settings(struc + sifstime = 32; + } else if (IS_CHAN_QUARTER_RATE(chan)) { + eifs = 340; +- rx_lat *= 4; ++ rx_lat = (rx_lat * 4) - 1; + tx_lat *= 4; + if (IS_CHAN_A_FAST_CLOCK(ah, chan)) + tx_lat += 22; +@@ -997,8 +1000,14 @@ void ath9k_hw_init_global_settings(struc slottime = 21; sifstime = 64; } else { diff --git a/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch index e2bfde443..6c29e9cbc 100644 --- a/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch +++ b/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1671,8 +1671,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -1674,8 +1674,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st REG_WRITE(ah, AR_OBS, 8); if (ah->config.rx_intr_mitigation) { diff --git a/package/mac80211/patches/513-ath9k_channelbw_debugfs.patch b/package/mac80211/patches/513-ath9k_channelbw_debugfs.patch index fedd17f51..b144af454 100644 --- a/package/mac80211/patches/513-ath9k_channelbw_debugfs.patch +++ b/package/mac80211/patches/513-ath9k_channelbw_debugfs.patch @@ -61,7 +61,7 @@ return -EINVAL; --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1504,6 +1504,10 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -1507,6 +1507,10 @@ int ath9k_hw_reset(struct ath_hw *ah, st } ah->noise = ath9k_hw_getchan_noise(ah, chan); diff --git a/package/mac80211/patches/570-ath9k_fix_ack_cts_timeout.patch b/package/mac80211/patches/570-ath9k_fix_ack_cts_timeout.patch index 27055582c..ed955b4ae 100644 --- a/package/mac80211/patches/570-ath9k_fix_ack_cts_timeout.patch +++ b/package/mac80211/patches/570-ath9k_fix_ack_cts_timeout.patch @@ -9,7 +9,7 @@ int slottime; int sifstime; int rx_lat = 0, tx_lat = 0, eifs = 0; -@@ -1026,6 +1026,7 @@ void ath9k_hw_init_global_settings(struc +@@ -1029,6 +1029,7 @@ void ath9k_hw_init_global_settings(struc /* As defined by IEEE 802.11-2007 17.3.8.6 */ acktimeout = slottime + sifstime + 3 * ah->coverage_class; @@ -17,7 +17,7 @@ /* * Workaround for early ACK timeouts, add an offset to match the -@@ -1040,7 +1041,7 @@ void ath9k_hw_init_global_settings(struc +@@ -1043,7 +1044,7 @@ void ath9k_hw_init_global_settings(struc ath9k_hw_set_sifs_time(ah, sifstime); ath9k_hw_setslottime(ah, slottime); ath9k_hw_set_ack_timeout(ah, acktimeout); diff --git a/package/mac80211/patches/580-ath9k_remove_common_chainmask.patch b/package/mac80211/patches/580-ath9k_remove_common_chainmask.patch index 9ef623b91..58d972cb0 100644 --- a/package/mac80211/patches/580-ath9k_remove_common_chainmask.patch +++ b/package/mac80211/patches/580-ath9k_remove_common_chainmask.patch @@ -69,7 +69,7 @@ ath9k_ps_restore(sc); --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1485,9 +1485,6 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -1488,9 +1488,6 @@ int ath9k_hw_reset(struct ath_hw *ah, st u64 tsf = 0; int i, r; @@ -79,7 +79,7 @@ if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) return -EIO; -@@ -2105,6 +2102,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw +@@ -2108,6 +2105,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask); pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask); diff --git a/package/mac80211/patches/581-ath9k_use_reset_work.patch b/package/mac80211/patches/581-ath9k_use_reset_work.patch index b9dce8a1a..7836718bb 100644 --- a/package/mac80211/patches/581-ath9k_use_reset_work.patch +++ b/package/mac80211/patches/581-ath9k_use_reset_work.patch @@ -57,7 +57,15 @@ INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -595,74 +595,6 @@ static void ath_node_detach(struct ath_s +@@ -236,6 +236,7 @@ static int ath_set_channel(struct ath_so + del_timer_sync(&common->ani.timer); + cancel_work_sync(&sc->paprd_work); + cancel_work_sync(&sc->hw_check_work); ++ cancel_work_sync(&sc->hw_reset_work); + cancel_delayed_work_sync(&sc->tx_complete_work); + cancel_delayed_work_sync(&sc->hw_pll_work); + +@@ -595,74 +596,6 @@ static void ath_node_detach(struct ath_s ath_tx_node_cleanup(sc, an); } @@ -132,7 +140,7 @@ void ath9k_tasklet(unsigned long data) { -@@ -675,9 +607,7 @@ void ath9k_tasklet(unsigned long data) +@@ -675,9 +608,7 @@ void ath9k_tasklet(unsigned long data) if ((status & ATH9K_INT_FATAL) || (status & ATH9K_INT_BB_WATCHDOG)) { @@ -143,7 +151,7 @@ return; } -@@ -968,13 +898,14 @@ void ath_radio_disable(struct ath_softc +@@ -968,13 +899,14 @@ void ath_radio_disable(struct ath_softc ath9k_ps_restore(sc); } @@ -159,7 +167,7 @@ sc->hw_busy_count = 0; /* Stop ANI */ -@@ -1035,6 +966,84 @@ int ath_reset(struct ath_softc *sc, bool +@@ -1035,6 +967,84 @@ int ath_reset(struct ath_softc *sc, bool return r; } @@ -244,6 +252,14 @@ /**********************/ /* mac80211 callbacks */ /**********************/ +@@ -1227,6 +1237,7 @@ static void ath9k_stop(struct ieee80211_ + cancel_delayed_work_sync(&sc->hw_pll_work); + cancel_work_sync(&sc->paprd_work); + cancel_work_sync(&sc->hw_check_work); ++ cancel_work_sync(&sc->hw_reset_work); + + if (sc->sc_flags & SC_OP_INVALID) { + ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -603,8 +603,10 @@ static void ath_tx_complete_aggr(struct @@ -259,6 +275,15 @@ } static bool ath_lookup_legacy(struct ath_buf *bf) +@@ -1357,7 +1359,7 @@ void ath_txq_schedule(struct ath_softc * + struct ath_atx_ac *ac, *ac_tmp, *last_ac; + struct ath_atx_tid *tid, *last_tid; + +- if (list_empty(&txq->axq_acq) || ++ if ((sc->sc_flags & SC_OP_HW_RESET) || list_empty(&txq->axq_acq) || + txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) + return; + @@ -2184,6 +2186,9 @@ static void ath_tx_processq(struct ath_s spin_lock_bh(&txq->axq_lock); diff --git a/package/mac80211/patches/582-ath9k_merge_reset_functions.patch b/package/mac80211/patches/582-ath9k_merge_reset_functions.patch index 8d22d8f79..ff491a4a9 100644 --- a/package/mac80211/patches/582-ath9k_merge_reset_functions.patch +++ b/package/mac80211/patches/582-ath9k_merge_reset_functions.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -212,83 +212,57 @@ static int ath_update_survey_stats(struc +@@ -212,84 +212,57 @@ static int ath_update_survey_stats(struc return ret; } @@ -29,6 +29,7 @@ - del_timer_sync(&common->ani.timer); cancel_work_sync(&sc->paprd_work); cancel_work_sync(&sc->hw_check_work); +- cancel_work_sync(&sc->hw_reset_work); cancel_delayed_work_sync(&sc->tx_complete_work); cancel_delayed_work_sync(&sc->hw_pll_work); +} @@ -117,7 +118,7 @@ } ath9k_cmn_update_txpow(ah, sc->curtxpow, -@@ -296,21 +270,95 @@ static int ath_set_channel(struct ath_so +@@ -297,21 +270,95 @@ static int ath_set_channel(struct ath_so ath9k_hw_set_interrupts(ah, ah->imask); ath9k_hw_enable_interrupts(ah); @@ -216,7 +217,7 @@ return r; } -@@ -823,28 +871,13 @@ static void ath_radio_enable(struct ath_ +@@ -824,28 +871,13 @@ static void ath_radio_enable(struct ath_ channel->center_freq, r); } @@ -246,7 +247,7 @@ spin_unlock_bh(&sc->sc_pcu_lock); ath9k_ps_restore(sc); -@@ -857,11 +890,10 @@ void ath_radio_disable(struct ath_softc +@@ -858,11 +890,10 @@ void ath_radio_disable(struct ath_softc int r; ath9k_ps_wakeup(sc); @@ -260,7 +261,7 @@ /* * Keep the LED on when the radio is disabled -@@ -872,13 +904,7 @@ void ath_radio_disable(struct ath_softc +@@ -873,13 +904,7 @@ void ath_radio_disable(struct ath_softc ath9k_hw_cfg_gpio_input(ah, ah->led_pin); } @@ -275,7 +276,7 @@ if (!ah->curchan) ah->curchan = ath9k_cmn_get_curchannel(hw, ah); -@@ -900,49 +926,11 @@ void ath_radio_disable(struct ath_softc +@@ -901,49 +926,11 @@ void ath_radio_disable(struct ath_softc static int ath_reset(struct ath_softc *sc, bool retry_tx) { @@ -326,7 +327,7 @@ if (retry_tx) { int i; -@@ -955,12 +943,6 @@ static int ath_reset(struct ath_softc *s +@@ -956,12 +943,6 @@ static int ath_reset(struct ath_softc *s } } @@ -339,7 +340,7 @@ ath9k_ps_restore(sc); return r; -@@ -970,9 +952,7 @@ void ath_reset_work(struct work_struct * +@@ -971,9 +952,7 @@ void ath_reset_work(struct work_struct * { struct ath_softc *sc = container_of(work, struct ath_softc, hw_check_work); @@ -349,7 +350,7 @@ } void ath_hw_check(struct work_struct *work) -@@ -993,11 +973,8 @@ void ath_hw_check(struct work_struct *wo +@@ -994,11 +973,8 @@ void ath_hw_check(struct work_struct *wo ath_dbg(common, ATH_DBG_RESET, "Possible baseband hang, " "busy=%d (try %d)\n", busy, sc->hw_busy_count + 1); if (busy >= 99) { @@ -363,7 +364,7 @@ } else if (busy >= 0) sc->hw_busy_count = 0; -@@ -1017,9 +994,7 @@ static void ath_hw_pll_rx_hang_check(str +@@ -1018,9 +994,7 @@ static void ath_hw_pll_rx_hang_check(str /* Rx is hung for more than 500ms. Reset it */ ath_dbg(common, ATH_DBG_RESET, "Possible RX hang, resetting"); @@ -374,7 +375,7 @@ count = 0; } } else -@@ -1090,28 +1065,6 @@ static int ath9k_start(struct ieee80211_ +@@ -1091,28 +1065,6 @@ static int ath9k_start(struct ieee80211_ goto mutex_unlock; } @@ -403,7 +404,7 @@ /* Setup our intr mask. */ ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN | ATH9K_INT_FATAL | -@@ -1134,12 +1087,14 @@ static int ath9k_start(struct ieee80211_ +@@ -1135,12 +1087,14 @@ static int ath9k_start(struct ieee80211_ /* Disable BMISS interrupt when we're not associated */ ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); @@ -422,7 +423,7 @@ if ((ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) && !ah->btcoex_hw.enabled) { -@@ -1232,10 +1187,7 @@ static void ath9k_stop(struct ieee80211_ +@@ -1233,11 +1187,7 @@ static void ath9k_stop(struct ieee80211_ mutex_lock(&sc->mutex); @@ -430,11 +431,12 @@ - cancel_delayed_work_sync(&sc->hw_pll_work); - cancel_work_sync(&sc->paprd_work); - cancel_work_sync(&sc->hw_check_work); +- cancel_work_sync(&sc->hw_reset_work); + ath_cancel_work(sc); if (sc->sc_flags & SC_OP_INVALID) { ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); -@@ -2352,9 +2304,11 @@ static void ath9k_flush(struct ieee80211 +@@ -2354,9 +2304,11 @@ static void ath9k_flush(struct ieee80211 ath9k_ps_wakeup(sc); spin_lock_bh(&sc->sc_pcu_lock); drain_txq = ath_drain_all_txq(sc, false); diff --git a/package/mac80211/patches/593-ath9k_ar9280_cold_reset.patch b/package/mac80211/patches/593-ath9k_ar9280_cold_reset.patch index 0f770fc04..bbc462077 100644 --- a/package/mac80211/patches/593-ath9k_ar9280_cold_reset.patch +++ b/package/mac80211/patches/593-ath9k_ar9280_cold_reset.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1368,10 +1368,16 @@ static bool ath9k_hw_set_reset_reg(struc +@@ -1371,10 +1371,16 @@ static bool ath9k_hw_set_reset_reg(struc static bool ath9k_hw_chip_reset(struct ath_hw *ah, struct ath9k_channel *chan) {