iwlwifi: mvm: use mvm_disable_queue instead of sharing logic
authorSara Sharon <sara.sharon@intel.com>
Mon, 7 Nov 2016 13:22:28 +0000 (15:22 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 26 Jan 2017 07:39:02 +0000 (09:39 +0200)
When removing inactive queue - use the central disable queue
function. This is needed due to a000 changes to come, but is
a proper cleanup anyway.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
drivers/net/wireless/intel/iwlwifi/mvm/utils.c

index 4a9cb76..a672aa7 100644 (file)
@@ -1657,8 +1657,8 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
  * Disable a TXQ.
  * Note that in non-DQA mode the %mac80211_queue and %tid params are ignored.
  */
-void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
-                        u8 tid, u8 flags);
+int iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
+                       u8 tid, u8 flags);
 int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq);
 
 /* Return a bitmask with all the hw supported queues, except for the
index cf8222a..40e7fc5 100644 (file)
@@ -454,13 +454,6 @@ static int iwl_mvm_remove_sta_queue_marking(struct iwl_mvm *mvm, int queue)
 
        rcu_read_unlock();
 
-       spin_lock_bh(&mvm->queue_info_lock);
-       /* Unmap MAC queues and TIDs from this queue */
-       mvm->queue_info[queue].hw_queue_to_mac80211 = 0;
-       mvm->queue_info[queue].hw_queue_refcount = 0;
-       mvm->queue_info[queue].tid_bitmap = 0;
-       spin_unlock_bh(&mvm->queue_info_lock);
-
        return disable_agg_tids;
 }
 
@@ -755,28 +748,22 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
         * first
         */
        if (using_inactive_queue) {
-               struct iwl_scd_txq_cfg_cmd cmd = {
-                       .scd_queue = queue,
-                       .action = SCD_CFG_DISABLE_QUEUE,
-               };
-               u8 txq_curr_ac;
-
-               disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue);
+               u8 txq_curr_ac, sta_id;
 
                spin_lock_bh(&mvm->queue_info_lock);
                txq_curr_ac = mvm->queue_info[queue].mac80211_ac;
-               cmd.sta_id = mvm->queue_info[queue].ra_sta_id;
-               cmd.tx_fifo = iwl_mvm_ac_to_tx_fifo[txq_curr_ac];
-               cmd.tid = mvm->queue_info[queue].txq_tid;
+               sta_id = mvm->queue_info[queue].ra_sta_id;
                spin_unlock_bh(&mvm->queue_info_lock);
 
+               disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue);
                /* Disable the queue */
                if (disable_agg_tids)
                        iwl_mvm_invalidate_sta_queue(mvm, queue,
                                                     disable_agg_tids, false);
-               iwl_trans_txq_disable(mvm->trans, queue, false);
-               ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd),
-                                          &cmd);
+
+               ret = iwl_mvm_disable_txq(mvm, queue,
+                                         mvmsta->vif->hw_queue[txq_curr_ac],
+                                         tid, 0);
                if (ret) {
                        IWL_ERR(mvm,
                                "Failed to free inactive queue %d (ret=%d)\n",
@@ -791,7 +778,7 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
                }
 
                /* If TXQ is allocated to another STA, update removal in FW */
-               if (cmd.sta_id != mvmsta->sta_id)
+               if (sta_id != mvmsta->sta_id)
                        iwl_mvm_invalidate_sta_queue(mvm, queue, 0, true);
        }
 
index d04babd..2beea3b 100644 (file)
@@ -706,8 +706,8 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
        }
 }
 
-void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
-                        u8 tid, u8 flags)
+int iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
+                       u8 tid, u8 flags)
 {
        struct iwl_scd_txq_cfg_cmd cmd = {
                .scd_queue = queue,
@@ -720,7 +720,7 @@ void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
 
        if (WARN_ON(mvm->queue_info[queue].hw_queue_refcount == 0)) {
                spin_unlock_bh(&mvm->queue_info_lock);
-               return;
+               return 0;
        }
 
        mvm->queue_info[queue].tid_bitmap &= ~BIT(tid);
@@ -760,7 +760,7 @@ void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
        /* If the queue is still enabled - nothing left to do in this func */
        if (cmd.action == SCD_CFG_ENABLE_QUEUE) {
                spin_unlock_bh(&mvm->queue_info_lock);
-               return;
+               return 0;
        }
 
        cmd.sta_id = mvm->queue_info[queue].ra_sta_id;
@@ -791,6 +791,8 @@ void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
        if (ret)
                IWL_ERR(mvm, "Failed to disable queue %d (ret=%d)\n",
                        queue, ret);
+
+       return ret;
 }
 
 /**