From f3ee419dbcd1095359f87096f1c7bd833f30b9eb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 21 Oct 2014 16:30:01 +0000 Subject: ath9k: merge a fix for queue start/stop handling (fixes #18164, #18130) Signed-off-by: Felix Fietkau SVN-Revision: 43011 --- ...th9k-Enable-HW-queue-control-only-for-MCC.patch | 145 +++++++++++++++++++++ .../mac80211/patches/501-ath9k_ahb_init.patch | 2 +- .../mac80211/patches/521-ath9k_cur_txpower.patch | 2 +- .../mac80211/patches/530-ath9k_extra_leds.patch | 2 +- .../patches/543-ath9k_entropy_from_adc.patch | 4 +- 5 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 package/kernel/mac80211/patches/336-ath9k-Enable-HW-queue-control-only-for-MCC.patch diff --git a/package/kernel/mac80211/patches/336-ath9k-Enable-HW-queue-control-only-for-MCC.patch b/package/kernel/mac80211/patches/336-ath9k-Enable-HW-queue-control-only-for-MCC.patch new file mode 100644 index 0000000000..e721f36bad --- /dev/null +++ b/package/kernel/mac80211/patches/336-ath9k-Enable-HW-queue-control-only-for-MCC.patch @@ -0,0 +1,145 @@ +From: Sujith Manoharan +Date: Tue, 21 Oct 2014 19:23:02 +0530 +Subject: [PATCH] ath9k: Enable HW queue control only for MCC + +Enabling HW queue control for normal (non-mcc) mode +causes problems with queue management, resulting +in traffic stall. Since it is mainly required for +fairness in MCC mode, disable it for the general case. + +Bug: https://dev.openwrt.org/ticket/18164 + +Cc: Felix Fietkau +Signed-off-by: Sujith Manoharan +--- + +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -741,6 +741,32 @@ static const struct ieee80211_iface_comb + #endif + }; + ++#ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT ++static void ath9k_set_mcc_capab(struct ath_softc *sc, struct ieee80211_hw *hw) ++{ ++ struct ath_hw *ah = sc->sc_ah; ++ struct ath_common *common = ath9k_hw_common(ah); ++ ++ if (!ath9k_is_chanctx_enabled()) ++ return; ++ ++ hw->flags |= IEEE80211_HW_QUEUE_CONTROL; ++ hw->queues = ATH9K_NUM_TX_QUEUES; ++ hw->offchannel_tx_hw_queue = hw->queues - 1; ++ hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS); ++ hw->wiphy->iface_combinations = if_comb_multi; ++ hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi); ++ hw->wiphy->max_scan_ssids = 255; ++ hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; ++ hw->wiphy->max_remain_on_channel_duration = 10000; ++ hw->chanctx_data_size = sizeof(void *); ++ hw->extra_beacon_tailroom = ++ sizeof(struct ieee80211_p2p_noa_attr) + 9; ++ ++ ath_dbg(common, CHAN_CTX, "Use channel contexts\n"); ++} ++#endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */ ++ + static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) + { + struct ath_hw *ah = sc->sc_ah; +@@ -753,7 +779,6 @@ static void ath9k_set_hw_capab(struct at + IEEE80211_HW_SPECTRUM_MGMT | + IEEE80211_HW_REPORTS_TX_ACK_STATUS | + IEEE80211_HW_SUPPORTS_RC_TABLE | +- IEEE80211_HW_QUEUE_CONTROL | + IEEE80211_HW_SUPPORTS_HT_CCK_RATES; + + if (ath9k_ps_enable) +@@ -788,24 +813,6 @@ static void ath9k_set_hw_capab(struct at + hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); + } + +-#ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT +- +- if (ath9k_is_chanctx_enabled()) { +- hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS); +- hw->wiphy->iface_combinations = if_comb_multi; +- hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi); +- hw->wiphy->max_scan_ssids = 255; +- hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; +- hw->wiphy->max_remain_on_channel_duration = 10000; +- hw->chanctx_data_size = sizeof(void *); +- hw->extra_beacon_tailroom = +- sizeof(struct ieee80211_p2p_noa_attr) + 9; +- +- ath_dbg(common, CHAN_CTX, "Use channel contexts\n"); +- } +- +-#endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */ +- + hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; + + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; +@@ -815,12 +822,7 @@ static void ath9k_set_hw_capab(struct at + hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; + hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; + +- /* allow 4 queues per channel context + +- * 1 cab queue + 1 offchannel tx queue +- */ +- hw->queues = ATH9K_NUM_TX_QUEUES; +- /* last queue for offchannel */ +- hw->offchannel_tx_hw_queue = hw->queues - 1; ++ hw->queues = 4; + hw->max_rates = 4; + hw->max_listen_interval = 10; + hw->max_rate_tries = 10; +@@ -844,6 +846,9 @@ static void ath9k_set_hw_capab(struct at + hw->wiphy->bands[IEEE80211_BAND_5GHZ] = + &common->sbands[IEEE80211_BAND_5GHZ]; + ++#ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT ++ ath9k_set_mcc_capab(sc, hw); ++#endif + ath9k_init_wow(hw); + ath9k_cmn_reload_chainmask(ah); + +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1181,6 +1181,9 @@ static void ath9k_assign_hw_queues(struc + { + int i; + ++ if (!ath9k_is_chanctx_enabled()) ++ return; ++ + for (i = 0; i < IEEE80211_NUM_ACS; i++) + vif->hw_queue[i] = i; + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -169,7 +169,10 @@ static void ath_txq_skb_done(struct ath_ + + if (txq->stopped && + txq->pending_frames < sc->tx.txq_max_pending[q]) { +- ieee80211_wake_queue(sc->hw, info->hw_queue); ++ if (ath9k_is_chanctx_enabled()) ++ ieee80211_wake_queue(sc->hw, info->hw_queue); ++ else ++ ieee80211_wake_queue(sc->hw, q); + txq->stopped = false; + } + } +@@ -2247,7 +2250,10 @@ int ath_tx_start(struct ieee80211_hw *hw + fi->txq = q; + if (++txq->pending_frames > sc->tx.txq_max_pending[q] && + !txq->stopped) { +- ieee80211_stop_queue(sc->hw, info->hw_queue); ++ if (ath9k_is_chanctx_enabled()) ++ ieee80211_stop_queue(sc->hw, info->hw_queue); ++ else ++ ieee80211_stop_queue(sc->hw, q); + txq->stopped = true; + } + } diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch index c59e8c975c..a32c4bbc0a 100644 --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -981,23 +981,23 @@ static int __init ath9k_init(void) +@@ -986,23 +986,23 @@ static int __init ath9k_init(void) { int error; diff --git a/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch b/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch index 2ec64ac5e2..638e774664 100644 --- a/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch +++ b/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch @@ -14,7 +14,7 @@ out: spin_unlock_bh(&sc->sc_pcu_lock); -@@ -1470,6 +1474,7 @@ static int ath9k_config(struct ieee80211 +@@ -1473,6 +1477,7 @@ static int ath9k_config(struct ieee80211 sc->cur_chan->txpower = 2 * conf->power_level; ath9k_cmn_update_txpow(ah, sc->curtxpow, sc->cur_chan->txpower, &sc->curtxpow); diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch index c8e23d5243..d13a23b50d 100644 --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch @@ -162,7 +162,7 @@ void ath_fill_led_pin(struct ath_softc *sc) --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -894,7 +894,7 @@ int ath9k_init_device(u16 devid, struct +@@ -899,7 +899,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch index 53d56a9c98..18cc86c2e8 100644 --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -851,6 +852,18 @@ static void ath9k_set_hw_capab(struct at +@@ -856,6 +857,18 @@ static void ath9k_set_hw_capab(struct at SET_IEEE80211_PERM_ADDR(hw, common->macaddr); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -899,6 +912,8 @@ int ath9k_init_device(u16 devid, struct +@@ -904,6 +917,8 @@ int ath9k_init_device(u16 devid, struct ARRAY_SIZE(ath9k_tpt_blink)); #endif -- cgit v1.2.3