iwlwifi: mvm: reconfigure queues during inactivity check
authorJohannes Berg <johannes.berg@intel.com>
Wed, 4 Jul 2018 14:21:03 +0000 (16:21 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Mon, 8 Oct 2018 07:48:15 +0000 (10:48 +0300)
We currently reconfigure the queues after the inactivity check,
but only in one of the two callers. This might leave queues in
a state where the TID owner is wrong, if called when reserving
a queue for a new station.

Clean this up and do the reconfiguration inside the inactivity
check function. This requires changing the locking, but one of
the two places already holds the mvm mutex and the other easily
can.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/sta.c

index a36a631..8a0cf73 100644 (file)
@@ -1383,6 +1383,8 @@ static void iwl_mvm_inactivity_check(struct iwl_mvm *mvm)
        unsigned long now = jiffies;
        int i;
 
+       lockdep_assert_held(&mvm->mutex);
+
        if (iwl_mvm_has_new_tx_api(mvm))
                return;
 
@@ -1461,6 +1463,10 @@ static void iwl_mvm_inactivity_check(struct iwl_mvm *mvm)
 
        rcu_read_unlock();
        spin_unlock_bh(&mvm->queue_info_lock);
+
+       /* Reconfigure queues requiring reconfiguation */
+       for (i = 0; i < ARRAY_SIZE(mvm->queue_info); i++)
+               iwl_mvm_reconfigure_queue(mvm, i);
 }
 
 static inline u8 iwl_mvm_tid_to_ac_queue(int tid)
@@ -1533,19 +1539,9 @@ void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk)
        unsigned long deferred_tid_traffic;
        int sta_id, tid;
 
-       /* Check inactivity of queues */
-       iwl_mvm_inactivity_check(mvm);
-
        mutex_lock(&mvm->mutex);
 
-       /* No queue reconfiguration in TVQM mode */
-       if (!iwl_mvm_has_new_tx_api(mvm)) {
-               int queue;
-
-               /* Reconfigure queues requiring reconfiguation */
-               for (queue = 0; queue < ARRAY_SIZE(mvm->queue_info); queue++)
-                       iwl_mvm_reconfigure_queue(mvm, queue);
-       }
+       iwl_mvm_inactivity_check(mvm);
 
        /* Go over all stations with deferred traffic */
        for_each_set_bit(sta_id, mvm->sta_deferred_frames,