ath10k: fix tx performance regression on older chipsets
[librecmc/librecmc.git] / package / kernel / mac80211 / patches / 311-ath10k-disable-wake_tx_queue-for-older-devices.patch
1 From: Michal Kazior <michal.kazior@tieto.com>
2 Date: Tue, 17 May 2016 14:47:01 +0200
3 Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
4
5 Some setups suffer performance regressions with
6 current wake_tx_queue implementation.
7
8 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
9 ---
10
11 --- a/drivers/net/wireless/ath/ath10k/core.h
12 +++ b/drivers/net/wireless/ath/ath10k/core.h
13 @@ -667,6 +667,7 @@ struct ath10k_fw_components {
14  struct ath10k {
15         struct ath_common ath_common;
16         struct ieee80211_hw *hw;
17 +       struct ieee80211_ops *ops;
18         struct device *dev;
19         u8 mac_addr[ETH_ALEN];
20  
21 --- a/drivers/net/wireless/ath/ath10k/mac.c
22 +++ b/drivers/net/wireless/ath/ath10k/mac.c
23 @@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
24  struct ath10k *ath10k_mac_create(size_t priv_size)
25  {
26         struct ieee80211_hw *hw;
27 +       struct ieee80211_ops *ops;
28         struct ath10k *ar;
29  
30 -       hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
31 -       if (!hw)
32 +       ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
33 +       if (!ops)
34 +               return NULL;
35 +
36 +       hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
37 +       if (!hw) {
38 +               kfree(ops);
39                 return NULL;
40 +       }
41  
42         ar = hw->priv;
43         ar->hw = hw;
44 +       ar->ops = ops;
45  
46         return ar;
47  }
48  
49  void ath10k_mac_destroy(struct ath10k *ar)
50  {
51 +       struct ieee80211_ops *ops = ar->ops;
52 +
53         ieee80211_free_hw(ar->hw);
54 +       kfree(ops);
55  }
56  
57  static const struct ieee80211_iface_limit ath10k_if_limits[] = {
58 @@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
59                         ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
60         }
61  
62 +       /* Current wake_tx_queue implementation imposes a significant
63 +        * performance penalty in some setups. The tx scheduling code needs
64 +        * more work anyway so disable the wake_tx_queue unless firmware
65 +        * supports the pull-push mechanism.
66 +        */
67 +       if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
68 +                     ar->running_fw->fw_file.fw_features))
69 +               ar->ops->wake_tx_queue = NULL;
70 +
71         ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
72                             ath10k_reg_notifier);
73         if (ret) {