Blame SOURCES/0022-Revert-iwlwifi-mvm-remove-buggy-and-unnecessary-hw_q.patch

deb259
From d724bb52e36359a8673cf30de2a93caf701743bd Mon Sep 17 00:00:00 2001
deb259
From: Eugene Syromiatnikov <esyr@redhat.com>
deb259
Date: Tue, 30 Jul 2019 14:33:29 +0200
deb259
Subject: [PATCH 6/7] Revert "iwlwifi: mvm: remove buggy and unnecessary
deb259
 hw_queue initialization"
deb259
deb259
This reverts commit 3f7fbc8cc11e2a305247a908bc67bb5f571fbf00.
deb259
---
deb259
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 36 +++++++++++++++++++++--
deb259
 1 file changed, 33 insertions(+), 3 deletions(-)
deb259
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
deb259
index 53c217af13c8..0bd800a278a6 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
deb259
@@ -262,7 +262,9 @@ int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
deb259
 		.preferred_tsf = NUM_TSF_IDS,
deb259
 		.found_vif = false,
deb259
 	};
deb259
-	int ret, i;
deb259
+	u32 ac;
deb259
+	int ret, i, queue_limit;
deb259
+	unsigned long used_hw_queues;
deb259
 
deb259
 	lockdep_assert_held(&mvm->mutex);
deb259
 
deb259
@@ -339,9 +341,37 @@ int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
deb259
 	INIT_LIST_HEAD(&mvmvif->time_event_data.list);
deb259
 	mvmvif->time_event_data.id = TE_MAX;
deb259
 
deb259
-	/* No need to allocate data queues to P2P Device MAC and NAN.*/
deb259
-	if (vif->type == NL80211_IFTYPE_P2P_DEVICE)
deb259
+	/* No need to allocate data queues to P2P Device MAC.*/
deb259
+	if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
deb259
+		for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
deb259
+			vif->hw_queue[ac] = IEEE80211_INVAL_HW_QUEUE;
deb259
+
deb259
 		return 0;
deb259
+	}
deb259
+
deb259
+	/*
deb259
+	 * queues in mac80211 almost entirely independent of
deb259
+	 * the ones here - no real limit
deb259
+	 */
deb259
+	queue_limit = IEEE80211_MAX_QUEUES;
deb259
+
deb259
+	/*
deb259
+	 * Find available queues, and allocate them to the ACs. When in
deb259
+	 * DQA-mode they aren't really used, and this is done only so the
deb259
+	 * mac80211 ieee80211_check_queues() function won't fail
deb259
+	 */
deb259
+	for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
deb259
+		u8 queue = find_first_zero_bit(&used_hw_queues, queue_limit);
deb259
+
deb259
+		if (queue >= queue_limit) {
deb259
+			IWL_ERR(mvm, "Failed to allocate queue\n");
deb259
+			ret = -EIO;
deb259
+			goto exit_fail;
deb259
+		}
deb259
+
deb259
+		__set_bit(queue, &used_hw_queues);
deb259
+		vif->hw_queue[ac] = queue;
deb259
+	}
deb259
 
deb259
 	/* Allocate the CAB queue for softAP and GO interfaces */
deb259
 	if (vif->type == NL80211_IFTYPE_AP ||
deb259
-- 
deb259
2.13.6
deb259