]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ath10k: add waiting htt tx complete before wow enable
authorWen Gong <wgong@codeaurora.org>
Tue, 28 Aug 2018 16:48:42 +0000 (19:48 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 3 Sep 2018 16:57:03 +0000 (19:57 +0300)
If there are some tx packets pending in firmware, and then system
enters suspend, firmware will fail for wow enable. This will trigger
mac80211 to stop ath10k and download firmware again, then it is
non-wow suspend.

After add the waiting htt tx complete, then firmware will have some
time window to send or flush the pending tx packets.

Tested with QCA6174 PCI with firmware
WLAN.RM.4.4.1-00109-QCARMSWPZ-1, but this will also affect QCA9377 PCI.
It's not a regression with new firmware releases.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/mac.h
drivers/net/wireless/ath/ath10k/wow.c

index 496772d95d116d74e07d6bdd5bf5a463a9f3a5c9..078058eef648c97d793400d6541f90e2eae4cb6c 100644 (file)
@@ -6769,23 +6769,17 @@ static int ath10k_mac_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
        return -EOPNOTSUPP;
 }
 
-static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-                        u32 queues, bool drop)
+void ath10k_mac_wait_tx_complete(struct ath10k *ar)
 {
-       struct ath10k *ar = hw->priv;
        bool skip;
        long time_left;
 
        /* mac80211 doesn't care if we really xmit queued frames or not
         * we'll collect those frames either way if we stop/delete vdevs
         */
-       if (drop)
-               return;
-
-       mutex_lock(&ar->conf_mutex);
 
        if (ar->state == ATH10K_STATE_WEDGED)
-               goto skip;
+               return;
 
        time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({
                        bool empty;
@@ -6804,8 +6798,18 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        if (time_left == 0 || skip)
                ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %ld\n",
                            skip, ar->state, time_left);
+}
 
-skip:
+static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                        u32 queues, bool drop)
+{
+       struct ath10k *ar = hw->priv;
+
+       if (drop)
+               return;
+
+       mutex_lock(&ar->conf_mutex);
+       ath10k_mac_wait_tx_complete(ar);
        mutex_unlock(&ar->conf_mutex);
 }
 
index 81f8d6c0af353274ee87d49eb7e74052f2b830b0..570493d2d648b962b00543adb923e825d3f7a9de 100644 (file)
@@ -82,6 +82,7 @@ struct ieee80211_txq *ath10k_mac_txq_lookup(struct ath10k *ar,
                                            u16 peer_id,
                                            u8 tid);
 int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val);
+void ath10k_mac_wait_tx_complete(struct ath10k *ar);
 
 static inline void ath10k_tx_h_seq_no(struct ieee80211_vif *vif,
                                      struct sk_buff *skb)
index a6b179f88d36343f9fdd5b61fe08c9d8638567f7..af444dfecae9840e04f55653b674ada2e1950ea6 100644 (file)
@@ -374,6 +374,8 @@ int ath10k_wow_op_suspend(struct ieee80211_hw *hw,
                goto cleanup;
        }
 
+       ath10k_mac_wait_tx_complete(ar);
+
        ret = ath10k_wow_enable(ar);
        if (ret) {
                ath10k_warn(ar, "failed to start wow: %d\n", ret);