]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/iwlwifi/mvm/sta.c
iwlwifi: mvm: properly flush the queues for buffering transport
[karo-tx-linux.git] / drivers / net / wireless / iwlwifi / mvm / sta.c
index 50f9288368af169fe4eb5c31b8316f46dfd35c97..9bf512bdbbd6460ec5d61c4827d99199e37b48d2 100644 (file)
@@ -491,8 +491,18 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
 
        if (vif->type == NL80211_IFTYPE_STATION &&
            mvmvif->ap_sta_id == mvm_sta->sta_id) {
+               ret = iwl_mvm_drain_sta(mvm, mvm_sta, true);
+               if (ret)
+                       return ret;
                /* flush its queues here since we are freeing mvm_sta */
                ret = iwl_mvm_flush_tx_path(mvm, mvm_sta->tfd_queue_msk, true);
+               if (ret)
+                       return ret;
+               ret = iwl_trans_wait_tx_queue_empty(mvm->trans,
+                                                   mvm_sta->tfd_queue_msk);
+               if (ret)
+                       return ret;
+               ret = iwl_mvm_drain_sta(mvm, mvm_sta, false);
 
                /* if we are associated - we can't remove the AP STA now */
                if (vif->bss_conf.assoc)
@@ -1120,8 +1130,12 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        spin_unlock_bh(&mvmsta->lock);
 
        if (old_state >= IWL_AGG_ON) {
+               iwl_mvm_drain_sta(mvm, mvmsta, true);
                if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true))
                        IWL_ERR(mvm, "Couldn't flush the AGG queue\n");
+               iwl_trans_wait_tx_queue_empty(mvm->trans,
+                                             mvmsta->tfd_queue_msk);
+               iwl_mvm_drain_sta(mvm, mvmsta, false);
 
                iwl_mvm_sta_tx_agg(mvm, sta, tid, txq_id, false);