Blame SOURCES/0082-Revert-iwlwifi-add-support-for-6-7-GHz-channels.patch

deb259
From 74cd2cdf235fbba685e8518b87a1035bc580cb60 Mon Sep 17 00:00:00 2001
deb259
From: Eugene Syromiatnikov <esyr@redhat.com>
deb259
Date: Fri, 6 Sep 2019 01:53:36 +0200
deb259
Subject: [PATCH 5/7] Revert "iwlwifi: add support for 6-7 GHz channels"
deb259
deb259
This reverts commit b15ef67c0e6b51be0f37985261ca53f9b477e816.
deb259
---
deb259
 drivers/net/wireless/intel/iwlwifi/cfg/22000.c     |  2 -
deb259
 drivers/net/wireless/intel/iwlwifi/iwl-config.h    |  4 +-
deb259
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 74 +++++++++-------------
deb259
 3 files changed, 31 insertions(+), 49 deletions(-)
deb259
deb259
Index: src/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
deb259
===================================================================
deb259
--- src.orig/drivers/net/wireless/intel/iwlwifi/cfg/22000.c	2019-06-27 14:54:04.111678603 +0200
deb259
+++ src/drivers/net/wireless/intel/iwlwifi/cfg/22000.c	2019-09-06 01:58:30.872997894 +0200
deb259
@@ -432,14 +432,12 @@
deb259
 const struct iwl_cfg iwlax210_2ax_cfg_so_gf_a0 = {
deb259
 	.name = "Intel(R) Wi-Fi 7 AX211 160MHz",
deb259
 	.fw_name_pre = IWL_22000_SO_A_GF_A_FW_PRE,
deb259
-	.uhb_supported = true,
deb259
 	IWL_DEVICE_AX210,
deb259
 };
deb259
 
deb259
 const struct iwl_cfg iwlax210_2ax_cfg_ty_gf_a0 = {
deb259
 	.name = "Intel(R) Wi-Fi 7 AX210 160MHz",
deb259
 	.fw_name_pre = IWL_22000_TY_A_GF_A_FW_PRE,
deb259
-	.uhb_supported = true,
deb259
 	IWL_DEVICE_AX210,
deb259
 };
deb259
 
deb259
Index: src/drivers/net/wireless/intel/iwlwifi/iwl-config.h
deb259
===================================================================
deb259
--- src.orig/drivers/net/wireless/intel/iwlwifi/iwl-config.h	2019-06-27 14:54:04.127678410 +0200
deb259
+++ src/drivers/net/wireless/intel/iwlwifi/iwl-config.h	2019-09-06 01:58:30.872997894 +0200
deb259
@@ -383,7 +383,6 @@
deb259
  * @bisr_workaround: BISR hardware workaround (for 22260 series devices)
deb259
  * @min_txq_size: minimum number of slots required in a TX queue
deb259
  * @umac_prph_offset: offset to add to UMAC periphery address
deb259
- * @uhb_supported: ultra high band channels supported
deb259
  * @min_256_ba_txq_size: minimum number of slots required in a TX queue which
deb259
  *	supports 256 BA aggregation
deb259
  *
deb259
@@ -436,8 +435,7 @@
deb259
 	    gen2:1,
deb259
 	    cdb:1,
deb259
 	    dbgc_supported:1,
deb259
-	    bisr_workaround:1,
deb259
-	    uhb_supported:1;
deb259
+	    bisr_workaround:1;
deb259
 	u8 valid_tx_ant;
deb259
 	u8 valid_rx_ant;
deb259
 	u8 non_shared_ant;
deb259
Index: src/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
deb259
===================================================================
deb259
--- src.orig/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c	2019-09-06 01:58:30.666000559 +0200
deb259
+++ src/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c	2019-09-06 01:58:30.873997881 +0200
deb259
@@ -130,7 +130,7 @@
deb259
 /*
deb259
  * These are the channel numbers in the order that they are stored in the NVM
deb259
  */
deb259
-static const u16 iwl_nvm_channels[] = {
deb259
+static const u8 iwl_nvm_channels[] = {
deb259
 	/* 2.4 GHz */
deb259
 	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
deb259
 	/* 5 GHz */
deb259
@@ -139,7 +139,7 @@
deb259
 	149, 153, 157, 161, 165
deb259
 };
deb259
 
deb259
-static const u16 iwl_ext_nvm_channels[] = {
deb259
+static const u8 iwl_ext_nvm_channels[] = {
deb259
 	/* 2.4 GHz */
deb259
 	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
deb259
 	/* 5 GHz */
deb259
@@ -148,27 +148,14 @@
deb259
 	149, 153, 157, 161, 165, 169, 173, 177, 181
deb259
 };
deb259
 
deb259
-static const u16 iwl_uhb_nvm_channels[] = {
deb259
-	/* 2.4 GHz */
deb259
-	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
deb259
-	/* 5 GHz */
deb259
-	36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92,
deb259
-	96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144,
deb259
-	149, 153, 157, 161, 165, 169, 173, 177, 181,
deb259
-	/* 6-7 GHz */
deb259
-	189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241,
deb259
-	245, 249, 253, 257, 261, 265, 269, 273, 277, 281, 285, 289, 293, 297,
deb259
-	301, 305, 309, 313, 317, 321, 325, 329, 333, 337, 341, 345, 349, 353,
deb259
-	357, 361, 365, 369, 373, 377, 381, 385, 389, 393, 397, 401, 405, 409,
deb259
-	413, 417, 421
deb259
-};
deb259
-
deb259
 #define IWL_NVM_NUM_CHANNELS		ARRAY_SIZE(iwl_nvm_channels)
deb259
 #define IWL_NVM_NUM_CHANNELS_EXT	ARRAY_SIZE(iwl_ext_nvm_channels)
deb259
-#define IWL_NVM_NUM_CHANNELS_UHB	ARRAY_SIZE(iwl_uhb_nvm_channels)
deb259
 #define NUM_2GHZ_CHANNELS		14
deb259
+#define NUM_2GHZ_CHANNELS_EXT	14
deb259
 #define FIRST_2GHZ_HT_MINUS		5
deb259
 #define LAST_2GHZ_HT_PLUS		9
deb259
+#define LAST_5GHZ_HT			165
deb259
+#define LAST_5GHZ_HT_FAMILY_8000	181
deb259
 #define N_HW_ADDR_MASK			0xF
deb259
 
deb259
 /* rate data (static) */
deb259
@@ -260,13 +247,17 @@
deb259
 				 u16 nvm_flags, const struct iwl_cfg *cfg)
deb259
 {
deb259
 	u32 flags = IEEE80211_CHAN_NO_HT40;
deb259
+	u32 last_5ghz_ht = LAST_5GHZ_HT;
deb259
+
deb259
+	if (cfg->nvm_type == IWL_NVM_EXT)
deb259
+		last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000;
deb259
 
deb259
 	if (!is_5ghz && (nvm_flags & NVM_CHANNEL_40MHZ)) {
deb259
 		if (ch_num <= LAST_2GHZ_HT_PLUS)
deb259
 			flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
deb259
 		if (ch_num >= FIRST_2GHZ_HT_MINUS)
deb259
 			flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
deb259
-	} else if (nvm_flags & NVM_CHANNEL_40MHZ) {
deb259
+	} else if (ch_num <= last_5ghz_ht && (nvm_flags & NVM_CHANNEL_40MHZ)) {
deb259
 		if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0)
deb259
 			flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
deb259
 		else
deb259
@@ -308,18 +299,17 @@
deb259
 	int n_channels = 0;
deb259
 	struct ieee80211_channel *channel;
deb259
 	u16 ch_flags;
deb259
-	int num_of_ch, num_2ghz_channels = NUM_2GHZ_CHANNELS;
deb259
-	const u16 *nvm_chan;
deb259
+	int num_of_ch, num_2ghz_channels;
deb259
+	const u8 *nvm_chan;
deb259
 
deb259
-	if (cfg->uhb_supported) {
deb259
-		num_of_ch = IWL_NVM_NUM_CHANNELS_UHB;
deb259
-		nvm_chan = iwl_uhb_nvm_channels;
deb259
-	} else if (cfg->nvm_type == IWL_NVM_EXT) {
deb259
-		num_of_ch = IWL_NVM_NUM_CHANNELS_EXT;
deb259
-		nvm_chan = iwl_ext_nvm_channels;
deb259
-	} else {
deb259
+	if (cfg->nvm_type != IWL_NVM_EXT) {
deb259
 		num_of_ch = IWL_NVM_NUM_CHANNELS;
deb259
-		nvm_chan = iwl_nvm_channels;
deb259
+		nvm_chan = &iwl_nvm_channels[0];
deb259
+		num_2ghz_channels = NUM_2GHZ_CHANNELS;
deb259
+	} else {
deb259
+		num_of_ch = IWL_NVM_NUM_CHANNELS_EXT;
deb259
+		nvm_chan = &iwl_ext_nvm_channels[0];
deb259
+		num_2ghz_channels = NUM_2GHZ_CHANNELS_EXT;
deb259
 	}
deb259
 
deb259
 	for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) {
deb259
@@ -825,11 +815,15 @@
deb259
 }
deb259
 IWL_EXPORT_SYMBOL(iwl_parse_nvm_data);
deb259
 
deb259
-static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
deb259
+static u32 iwl_nvm_get_regdom_bw_flags(const u8 *nvm_chan,
deb259
 				       int ch_idx, u16 nvm_flags,
deb259
 				       const struct iwl_cfg *cfg)
deb259
 {
deb259
 	u32 flags = NL80211_RRF_NO_HT40;
deb259
+	u32 last_5ghz_ht = LAST_5GHZ_HT;
deb259
+
deb259
+	if (cfg->nvm_type == IWL_NVM_EXT)
deb259
+		last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000;
deb259
 
deb259
 	if (ch_idx < NUM_2GHZ_CHANNELS &&
deb259
 	    (nvm_flags & NVM_CHANNEL_40MHZ)) {
deb259
@@ -837,7 +831,8 @@
deb259
 			flags &= ~NL80211_RRF_NO_HT40PLUS;
deb259
 		if (nvm_chan[ch_idx] >= FIRST_2GHZ_HT_MINUS)
deb259
 			flags &= ~NL80211_RRF_NO_HT40MINUS;
deb259
-	} else if (nvm_flags & NVM_CHANNEL_40MHZ) {
deb259
+	} else if (nvm_chan[ch_idx] <= last_5ghz_ht &&
deb259
+		   (nvm_flags & NVM_CHANNEL_40MHZ)) {
deb259
 		if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0)
deb259
 			flags &= ~NL80211_RRF_NO_HT40PLUS;
deb259
 		else
deb259
@@ -881,7 +876,8 @@
deb259
 	int ch_idx;
deb259
 	u16 ch_flags;
deb259
 	u32 reg_rule_flags, prev_reg_rule_flags = 0;
deb259
-	const u16 *nvm_chan;
deb259
+	const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ?
deb259
+			     iwl_ext_nvm_channels : iwl_nvm_channels;
deb259
 	struct ieee80211_regdomain *regd, *copy_rd;
deb259
 	int size_of_regd, regd_to_copy;
deb259
 	struct ieee80211_reg_rule *rule;
deb259
@@ -890,18 +886,8 @@
deb259
 	int center_freq, prev_center_freq = 0;
deb259
 	int valid_rules = 0;
deb259
 	bool new_rule;
deb259
-	int max_num_ch;
deb259
-
deb259
-	if (cfg->uhb_supported) {
deb259
-		max_num_ch = IWL_NVM_NUM_CHANNELS_UHB;
deb259
-		nvm_chan = iwl_uhb_nvm_channels;
deb259
-	} else if (cfg->nvm_type == IWL_NVM_EXT) {
deb259
-		max_num_ch = IWL_NVM_NUM_CHANNELS_EXT;
deb259
-		nvm_chan = iwl_ext_nvm_channels;
deb259
-	} else {
deb259
-		max_num_ch = IWL_NVM_NUM_CHANNELS;
deb259
-		nvm_chan = iwl_nvm_channels;
deb259
-	}
deb259
+	int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ?
deb259
+			 IWL_NVM_NUM_CHANNELS_EXT : IWL_NVM_NUM_CHANNELS;
deb259
 
deb259
 	if (WARN_ON(num_of_ch > max_num_ch))
deb259
 		num_of_ch = max_num_ch;