[rdkb][Refactor and sync wifi from openwrt]

[Description]
5c19d4f2 [MAC80211][app][Add iwpriv wrapper support for kite]
c8e6d600 [MAC80211][mt76][rebase][fix build failed]
bace4d36 [MAC80211][misc][backport ucode and related packages]
0daf51ff [MAC80211][Rebase Patches][Fix patch fail during WiFi7 build]
7e6109ab [MAC80211][hostapd][Revert set_send_disassoc_frame_timer]
8c8f0e5a [MAC80211][core][Fix kernel warning of check_flush_dependency]
6778e37f [MAC80211][hostapd][Fix 11vmbss using wrong aid pool]
3a85b7b2 [MAC80211][mt76][rework init txpower]
b0234621 [MAC80211][Rebase Patches][Fix WiFi6 build error]
fb51d50c [MAC80211][mt76][Fix txpower issues]
224e6e4b [MAC80211][core][Add support to disable ZWDFS CAC when its channel is overlapped with operating channel]
ea09a4a0 [MAC80211][hostapd][Add support to disable ZWDFS CAC when its channel is overlapped with operating channel]

[Release-log]

Change-Id: I7d7572a642ad3fb4624603369d3c2b2994c5d880
diff --git a/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch b/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch
index 66708ea..38f5d75 100644
--- a/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1025-wifi-mt76-mt7915-add-bf-backoff-limit-table-support.patch
@@ -1,4 +1,4 @@
-From 485b78e6495b46b5f9adbabf99069f63217b37cd Mon Sep 17 00:00:00 2001
+From de4b50e7a8564367603e5de2e967315fd13ffb82 Mon Sep 17 00:00:00 2001
 From: Shayne Chen <shayne.chen@mediatek.com>
 Date: Mon, 5 Dec 2022 18:21:51 +0800
 Subject: [PATCH 1025/1034] wifi: mt76: mt7915: add bf backoff limit table
@@ -7,19 +7,16 @@
 Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
 ---
  debugfs.c        |   2 +-
- eeprom.c         |  38 ++++++++++++--
- mac80211.c       |   2 +-
+ eeprom.c         |  34 +++++++++++-
  mt76.h           |   8 +++
- mt7915/debugfs.c | 121 +++++++++++++++++++++++++++++++++----------
- mt7915/init.c    |   2 +-
- mt7915/main.c    |   3 +-
+ mt7915/debugfs.c |  73 ++++++++++++++++++++++++--
  mt7915/mcu.c     | 132 ++++++++++++++++++++++++++++++++++++-----------
- mt7915/mcu.h     |   8 ++-
+ mt7915/mcu.h     |   6 +++
  mt7915/mt7915.h  |   4 +-
- 10 files changed, 253 insertions(+), 67 deletions(-)
+ 7 files changed, 220 insertions(+), 39 deletions(-)
 
 diff --git a/debugfs.c b/debugfs.c
-index 4a8e186..4bb4679 100644
+index 4a8e1864..4bb46799 100644
 --- a/debugfs.c
 +++ b/debugfs.c
 @@ -95,7 +95,7 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
@@ -32,15 +29,13 @@
  		seq_printf(file, " %2d", val[i]);
  	seq_puts(file, "\n");
 diff --git a/eeprom.c b/eeprom.c
-index 412740f..5cbd56f 100644
+index eb532c77..41895252 100644
 --- a/eeprom.c
 +++ b/eeprom.c
-@@ -311,13 +311,17 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
- 	u32 ru_rates = ARRAY_SIZE(dest->ru[0]);
+@@ -367,12 +367,16 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
  	char band;
  	size_t len;
--	s8 max_power = 0;
-+	s8 max_power = -127;
+ 	s8 max_power = -127;
 +	s8 max_power_backoff = -127;
  	s8 txs_delta;
 +	int n_chains = hweight16(phy->chainmask);
@@ -55,16 +50,7 @@
  
  	if (!IS_ENABLED(CONFIG_OF))
  		return target_power;
-@@ -349,7 +353,7 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
- 	if (!np)
- 		return target_power;
- 
--	txs_delta = mt76_get_txs_delta(np, hweight8(phy->antenna_mask));
-+	txs_delta = mt76_get_txs_delta(np, hweight16(phy->chainmask));
- 
- 	val = mt76_get_of_array(np, "rates-cck", &len, ARRAY_SIZE(dest->cck));
- 	mt76_apply_array_limit(dest->cck, ARRAY_SIZE(dest->cck), val,
-@@ -370,7 +374,33 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
+@@ -425,7 +429,33 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
  				     ARRAY_SIZE(dest->ru), val, len,
  				     target_power, txs_delta, &max_power);
  
@@ -99,21 +85,8 @@
  }
  EXPORT_SYMBOL_GPL(mt76_get_rate_power_limits);
  
-diff --git a/mac80211.c b/mac80211.c
-index ddc13dd..25ec433 100644
---- a/mac80211.c
-+++ b/mac80211.c
-@@ -1456,7 +1456,7 @@ int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- 		     int *dbm)
- {
- 	struct mt76_phy *phy = hw->priv;
--	int n_chains = hweight8(phy->antenna_mask);
-+	int n_chains = hweight16(phy->chainmask);
- 	int delta = mt76_tx_power_nss_delta(n_chains);
- 
- 	*dbm = DIV_ROUND_UP(phy->txpower_cur + delta, 2);
 diff --git a/mt76.h b/mt76.h
-index b4e3429..2f801de 100644
+index b4e34296..2f801de4 100644
 --- a/mt76.h
 +++ b/mt76.h
 @@ -1030,6 +1030,14 @@ struct mt76_power_limits {
@@ -132,21 +105,9 @@
  
  struct mt76_ethtool_worker_info {
 diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index d66d104..19a37b5 100644
+index f1813776..19a37b53 100644
 --- a/mt7915/debugfs.c
 +++ b/mt7915/debugfs.c
-@@ -983,9 +983,9 @@ mt7915_xmit_queues_show(struct seq_file *file, void *data)
- 
- DEFINE_SHOW_ATTRIBUTE(mt7915_xmit_queues);
- 
--#define mt7915_txpower_puts(rate)						\
-+#define mt7915_txpower_puts(rate, _len)						\
- ({										\
--	len += scnprintf(buf + len, sz - len, "%-16s:", #rate " (TMAC)");	\
-+	len += scnprintf(buf + len, sz - len, "%-*s:", _len, #rate " (TMAC)");	\
- 	for (i = 0; i < mt7915_sku_group_len[SKU_##rate]; i++, offs++)		\
- 		len += scnprintf(buf + len, sz - len, " %6d", txpwr[offs]);	\
- 	len += scnprintf(buf + len, sz - len, "\n");				\
 @@ -1019,7 +1019,7 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,
  	if (!buf)
  		return -ENOMEM;
@@ -156,75 +117,7 @@
  	if (ret)
  		goto out;
  
-@@ -1027,43 +1027,47 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,
- 	len += scnprintf(buf + len, sz - len,
- 			 "\nPhy%d Tx power table (channel %d)\n",
- 			 phy != &dev->phy, phy->mt76->chandef.chan->hw_value);
--	len += scnprintf(buf + len, sz - len, "%-16s  %6s %6s %6s %6s\n",
-+	len += scnprintf(buf + len, sz - len, "%-23s  %6s %6s %6s %6s\n",
- 			 " ", "1m", "2m", "5m", "11m");
--	mt7915_txpower_puts(CCK);
-+	mt7915_txpower_puts(CCK, 23);
- 
- 	len += scnprintf(buf + len, sz - len,
--			 "%-16s  %6s %6s %6s %6s %6s %6s %6s %6s\n",
-+			 "%-23s  %6s %6s %6s %6s %6s %6s %6s %6s\n",
- 			 " ", "6m", "9m", "12m", "18m", "24m", "36m", "48m",
- 			 "54m");
--	mt7915_txpower_puts(OFDM);
-+	mt7915_txpower_puts(OFDM, 23);
- 
- 	len += scnprintf(buf + len, sz - len,
--			 "%-16s  %6s %6s %6s %6s %6s %6s %6s %6s\n",
-+			 "%-23s  %6s %6s %6s %6s %6s %6s %6s %6s\n",
- 			 " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4",
- 			 "mcs5", "mcs6", "mcs7");
--	mt7915_txpower_puts(HT_BW20);
-+	mt7915_txpower_puts(HT_BW20, 23);
- 
- 	len += scnprintf(buf + len, sz - len,
--			 "%-16s  %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
-+			 "%-23s  %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
- 			 " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4", "mcs5",
- 			 "mcs6", "mcs7", "mcs32");
--	mt7915_txpower_puts(HT_BW40);
-+	mt7915_txpower_puts(HT_BW40, 23);
- 
- 	len += scnprintf(buf + len, sz - len,
--			 "%-16s  %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
-+			 "%-23s  %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
- 			 " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4", "mcs5",
- 			 "mcs6", "mcs7", "mcs8", "mcs9", "mcs10", "mcs11");
--	mt7915_txpower_puts(VHT_BW20);
--	mt7915_txpower_puts(VHT_BW40);
--	mt7915_txpower_puts(VHT_BW80);
--	mt7915_txpower_puts(VHT_BW160);
--	mt7915_txpower_puts(HE_RU26);
--	mt7915_txpower_puts(HE_RU52);
--	mt7915_txpower_puts(HE_RU106);
--	mt7915_txpower_puts(HE_RU242);
--	mt7915_txpower_puts(HE_RU484);
--	mt7915_txpower_puts(HE_RU996);
--	mt7915_txpower_puts(HE_RU2x996);
-+	mt7915_txpower_puts(VHT_BW20, 23);
-+	mt7915_txpower_puts(VHT_BW40, 23);
-+	mt7915_txpower_puts(VHT_BW80, 23);
-+	mt7915_txpower_puts(VHT_BW160, 23);
-+	mt7915_txpower_puts(HE_RU26, 23);
-+	mt7915_txpower_puts(HE_RU52, 23);
-+	mt7915_txpower_puts(HE_RU106, 23);
-+	len += scnprintf(buf + len, sz - len, "BW20/");
-+	mt7915_txpower_puts(HE_RU242, 18);
-+	len += scnprintf(buf + len, sz - len, "BW40/");
-+	mt7915_txpower_puts(HE_RU484, 18);
-+	len += scnprintf(buf + len, sz - len, "BW80/");
-+	mt7915_txpower_puts(HE_RU996, 18);
-+	len += scnprintf(buf + len, sz - len, "BW160/");
-+	mt7915_txpower_puts(HE_RU2x996, 17);
- 
- 	reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_TPC_CTRL_STAT(band) :
- 	      MT_WF_PHY_TPC_CTRL_STAT_MT7916(band);
-@@ -1129,7 +1133,7 @@ mt7915_rate_txpower_set(struct file *file, const char __user *user_buf,
+@@ -1133,7 +1133,7 @@ mt7915_rate_txpower_set(struct file *file, const char __user *user_buf,
  
  	mutex_lock(&dev->mt76.mutex);
  	ret = mt7915_mcu_get_txpower_sku(phy, req.txpower_sku,
@@ -233,7 +126,7 @@
  	if (ret)
  		goto out;
  
-@@ -1171,7 +1175,7 @@ out:
+@@ -1175,7 +1175,7 @@ out:
  	return ret ? ret : count;
  }
  
@@ -242,7 +135,7 @@
  	.write = mt7915_rate_txpower_set,
  	.read = mt7915_rate_txpower_get,
  	.open = simple_open,
-@@ -1179,6 +1183,69 @@ static const struct file_operations mt7915_rate_txpower_fops = {
+@@ -1183,6 +1183,69 @@ static const struct file_operations mt7915_rate_txpower_fops = {
  	.llseek = default_llseek,
  };
  
@@ -312,7 +205,7 @@
  static int
  mt7915_twt_stats(struct seq_file *s, void *data)
  {
-@@ -1265,7 +1332,9 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
+@@ -1269,7 +1332,9 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
  	debugfs_create_file("implicit_txbf", 0600, dir, dev,
  			    &fops_implicit_txbf);
  	debugfs_create_file("txpower_sku", 0400, dir, phy,
@@ -323,42 +216,8 @@
  	debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
  				    mt7915_twt_stats);
  	debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
-diff --git a/mt7915/init.c b/mt7915/init.c
-index 63c0ecb..2415f1b 100644
---- a/mt7915/init.c
-+++ b/mt7915/init.c
-@@ -281,7 +281,7 @@ static void mt7915_led_set_brightness(struct led_classdev *led_cdev,
- void mt7915_init_txpower(struct mt7915_dev *dev,
- 			 struct ieee80211_supported_band *sband)
- {
--	int i, n_chains = hweight8(dev->mphy.antenna_mask);
-+	int i, n_chains = hweight16(dev->mphy.chainmask);
- 	int nss_delta = mt76_tx_power_nss_delta(n_chains);
- 	int pwr_delta = mt7915_eeprom_get_power_delta(dev, sband->band);
- 	struct mt76_power_limits limits;
-diff --git a/mt7915/main.c b/mt7915/main.c
-index fcd69ea..4833f64 100644
---- a/mt7915/main.c
-+++ b/mt7915/main.c
-@@ -488,7 +488,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
- 		ieee80211_wake_queues(hw);
- 	}
- 
--	if (changed & IEEE80211_CONF_CHANGE_POWER) {
-+	if (changed & (IEEE80211_CONF_CHANGE_POWER | IEEE80211_CONF_CHANGE_CHANNEL)) {
- 		ret = mt7915_mcu_set_txpower_sku(phy);
- 		if (ret)
- 			return ret;
-@@ -1097,6 +1097,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
- 	mt76_set_stream_caps(phy->mt76, true);
- 	mt7915_set_stream_vht_txbf_caps(phy);
- 	mt7915_set_stream_he_caps(phy);
-+	mt7915_mcu_set_txpower_sku(phy);
- 
- 	mutex_unlock(&dev->mt76.mutex);
- 
 diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4aee126..10fade2 100644
+index 4aee1268..10fade27 100644
 --- a/mt7915/mcu.c
 +++ b/mt7915/mcu.c
 @@ -3302,7 +3302,8 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
@@ -554,7 +413,7 @@
  				 MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), &req,
  				 sizeof(req), true);
 diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 3da650c..142bfc1 100644
+index 5fc4e2ef..142bfc1f 100644
 --- a/mt7915/mcu.h
 +++ b/mt7915/mcu.h
 @@ -502,12 +502,18 @@ enum {
@@ -576,17 +435,8 @@
  enum {
  	SPR_ENABLE = 0x1,
  	SPR_ENABLE_SD = 0x3,
-@@ -770,7 +776,7 @@ static inline s8
- mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
- {
- 	struct mt76_phy *mphy = phy->mt76;
--	int n_chains = hweight8(mphy->antenna_mask);
-+	int n_chains = hweight16(mphy->chainmask);
- 
- 	txpower = mt76_get_sar_power(mphy, mphy->chandef.chan, txpower * 2);
- 	txpower -= mt76_tx_power_nss_delta(n_chains);
 diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index bbcdd93..b80c607 100644
+index 851caa99..04cf2dc3 100644
 --- a/mt7915/mt7915.h
 +++ b/mt7915/mt7915.h
 @@ -72,6 +72,7 @@
@@ -597,7 +447,7 @@
  
  #define MT7915_MAX_TWT_AGRT		16
  #define MT7915_MAX_STA_TWT_AGRT		8
-@@ -570,7 +571,8 @@ int mt7915_mcu_set_test_param(struct mt7915_dev *dev, u8 param, bool test_mode,
+@@ -569,7 +570,8 @@ int mt7915_mcu_set_test_param(struct mt7915_dev *dev, u8 param, bool test_mode,
  int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band);
  int mt7915_mcu_set_sku_en(struct mt7915_phy *phy, bool enable);
  int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy);
@@ -608,5 +458,5 @@
  int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
  				 struct ieee80211_vif *vif,
 -- 
-2.18.0
+2.39.2