[rdkb][common][bsp][Refactor and sync wifi from openwrt]

[Description]
ced8594f [MAC80211][WiFi6][Misc][Fix the MT76 WiFi6 Makefile]
7221999e [MAC80211][WiFi7][Misc][Correct the MAC80211 WiFi7 Makefile.]
9d87794a [MAC80211][WiFi7][Misc][Correct the MT76 WiFi7 Makefile.]
ff24e1b2 [openwrt-24][Mac80211][Fix patch conflict with upstream openwrt]
3a6c13e2 [mac80211][misc][fix patch fail due to openwrt update]
05763faa [MAC80211][WiFi7][misc][fix patch failed of wifi-scripts]
f34fd014 [mac80211][misc][fix patch fail due to openwrt update]
f6796660 [openwrt-24][Release][Fix build fail of Wi-Fi7 MT76]
7076d96c [MAC80211][WiFi7][Misc][Fix release build fail because of mt76 version upgradation]
1f748b17 [mac80211][misc][fix patch fail due to openwrt update]
95ba6722 [mac80211][misc][fix patch fail due to openwrt update]
17680d7f [MAC80211][WiFi7][misc][Rename eeprom of eFEM variants]
b97cefa1 [MAC80211][WiFi7][app][Add Griffin support for atenl/iwpriv]
6de718a4 [MAC80211][WiFi7][misc][fix wifi-scripts patch failed]
9f1ace86 [MAC80211][WiFi7][misc][fix hostapd Makefile patch]
e4d0d28e [MAC80211][Misc][Add MT7990 Firmware OpenWrt config]
f3a8a8f7 [MAC80211][Release][Fix build fail of Wi-Fi6 MT76]
dabe8eae [openwrt-24][common][bsp][Fix line ending]
6d438a9d [openwrt-24][common][bsp][Use zstd to compress rootfs debug symbols for unified autobuild]
c268e47e [openwrt][common][bsp][Change SMC ID of wdt nonrst reg of reset-boot-count to 0x570]
c6819fbc [openwrt-24][Release][Update release note for Filogic 880 alpha release]
6897b4de [openwrt-24][common][bsp][Adjust unified autobuild for internal build detection]
fb9b9762 [MAC80211][WiFi6/7][app][Add ext eeprom write back cmd support]
d42b42a3 [openwrt-24][common][bsp][Add kernel6.6 Filogic880 BE19000/BE14000]
3806f047 [MAC80211][misc][Add Bpi-R4 support]
ddbda753 [MAC80211][WiFi7][Misc][Fix build fail because of mt76 version upgradation]
90959b08 [MAC80211][WiFi6][mt76][Rebase mt76 pathes]
728a3362 [MAC80211][WiFi6][mt76][Refactor Qos Map]
b46277b5 [MAC80211][WiFi6][mt76][Fix add ba issue on tid not equal to zero]
c084ee8b [MAC80211][WiFi7][mt76][split mt76 Makefile patch]
bbaec094 [MAC80211][Release][Update Filogic 830/820/630 firmware]
5ce2eece [MAC80211][wifi6][MT76][Fix build fail]
5ac1121f [MAC80211][wifi6][MT76][Fix mt76 version to 2024-07-13]
485f92b1 [MAC80211][WiFi7][misc][synchronize PP bitmap when association]
84db8818 [MAC80211][WiFi6/7][app][Add ATETXNSS in iwpriv wrapper]
cc5a4605 [MAC80211][WiFi7][mt76][fix patch failed of Makefile]

[Release-log]

Change-Id: I06704c04c4b5571af4ffd189d636c1fc9f0567fd
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0099-mtk-mt76-mt7996-support-multi-link-channel-switch.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0099-mtk-mt76-mt7996-support-multi-link-channel-switch.patch
new file mode 100644
index 0000000..a58349a
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0099-mtk-mt76-mt7996-support-multi-link-channel-switch.patch
@@ -0,0 +1,143 @@
+From 70a14f12eef8b505890f654876a7f89432070bbf Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Fri, 19 Jan 2024 14:04:03 +0800
+Subject: [PATCH 099/223] mtk: mt76: mt7996: support multi-link channel switch
+
+mtk: wifi: mt76: mt7996: remove the limitation of radar detect width for mlo
+
+mtk: wifi: mt76: mt7996: start and finalize channel switch on link basis
+
+mtk: wifi: mt76: mt7996: fix DFS RDD init issue
+
+1. Add radar enabled flag in mt76_phy since hw->conf.radar_enabled
+is only used for non-chanctx driver.
+2. Add IEEE80211_CHANCTX_CHANGE_RADAR flag in change_chanctx for RDD
+DFS state update.
+
+mtk: wifi: mt76: mt7996: fix background radar using wrong phy for mld ap
+
+mt7996_hw_phy will be phy0 for 3 link mld ap
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mac80211.c    |  2 +-
+ mt76.h        |  1 +
+ mt7996/main.c | 12 +++++++++---
+ mt7996/mcu.c  | 14 +++++++++++---
+ 4 files changed, 22 insertions(+), 7 deletions(-)
+
+diff --git a/mac80211.c b/mac80211.c
+index a98fe4fb..a2b111c0 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -1801,7 +1801,7 @@ enum mt76_dfs_state mt76_phy_dfs_state(struct mt76_phy *phy)
+ 	    test_bit(MT76_SCANNING, &phy->state))
+ 		return MT_DFS_STATE_DISABLED;
+ 
+-	if (!hw->conf.radar_enabled) {
++	if (!phy->radar_enabled) {
+ 		if ((hw->conf.flags & IEEE80211_CONF_MONITOR) &&
+ 		    (phy->chandef.chan->flags & IEEE80211_CHAN_RADAR))
+ 			return MT_DFS_STATE_ACTIVE;
+diff --git a/mt76.h b/mt76.h
+index b65a6b0a..bc263bd4 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -862,6 +862,7 @@ struct mt76_phy {
+ 
+ 	struct mt76_channel_state *chan_state;
+ 	enum mt76_dfs_state dfs_state;
++	bool radar_enabled;
+ 	ktime_t survey_time;
+ 
+ 	u32 aggr_stats[32];
+diff --git a/mt7996/main.c b/mt7996/main.c
+index fe5bfd72..e3f30b23 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2143,7 +2143,7 @@ static int
+ mt7996_set_radar_background(struct ieee80211_hw *hw,
+ 			    struct cfg80211_chan_def *chandef)
+ {
+-	struct mt7996_phy *phy = mt7996_hw_phy(hw);
++	struct mt7996_phy *phy = mt7996_band_phy(hw, NL80211_BAND_5GHZ);
+ 	struct mt7996_dev *dev = phy->dev;
+ 	int ret = -EINVAL;
+ 	bool running;
+@@ -2358,6 +2358,7 @@ mt7996_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
+ 	}
+ 
+ 	phy->chanctx = ctx;
++	phy->mt76->radar_enabled = conf->radar_enabled;
+ 	mutex_unlock(&phy->dev->mt76.mutex);
+ 
+ 	if (!mt76_testmode_enabled(phy->mt76) && !phy->mt76->test.bf_en) {
+@@ -2385,8 +2386,10 @@ mt7996_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
+ 
+ 	mutex_lock(&phy->dev->mt76.mutex);
+ 	ctx->assigned = false;
+-	if (ctx == phy->chanctx)
++	if (ctx == phy->chanctx) {
+ 		phy->chanctx = NULL;
++		phy->mt76->radar_enabled = false;
++	}
+ 	mutex_unlock(&phy->dev->mt76.mutex);
+ }
+ 
+@@ -2398,8 +2401,10 @@ mt7996_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *co
+ 	struct mt7996_phy *phy = ctx->phy;
+ 
+ 	wiphy_info(hw->wiphy, "%s: change %u, 0x%x\n", __func__, conf->def.chan->hw_value, changed);
+-	if (changed & IEEE80211_CHANCTX_CHANGE_WIDTH) {
++	if (changed & IEEE80211_CHANCTX_CHANGE_WIDTH ||
++	    changed & IEEE80211_CHANCTX_CHANGE_RADAR) {
+ 		ctx->chandef = conf->def;
++		phy->mt76->radar_enabled = conf->radar_enabled;
+ 
+ 		mt7996_set_channel(phy, &ctx->chandef);
+ 	}
+@@ -2497,6 +2502,7 @@ mt7996_switch_vif_chanctx(struct ieee80211_hw *hw,
+ 	mutex_lock(&phy->dev->mt76.mutex);
+ 
+ 	phy->chanctx = new_ctx;
++	phy->mt76->radar_enabled = vifs->new_ctx->radar_enabled;
+ 	new_ctx->assigned = true;
+ 	new_ctx->chandef = vifs->new_ctx->def;
+ 	new_ctx->phy = phy;
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index 9359a251..d897098e 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -362,10 +362,18 @@ int mt7996_mcu_wa_cmd(struct mt7996_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
+ static void
+ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ {
+-	if (!vif->bss_conf.csa_active || vif->type == NL80211_IFTYPE_STATION)
++	struct mt76_phy *mphy = (struct mt76_phy *)priv;
++	struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++	struct ieee80211_bss_conf *link_conf;
++	int link_id, band_idx = mphy->band_idx;
++
++	link_id = mvif->band_to_link[band_idx];
++	link_conf = rcu_dereference(vif->link_conf[link_id]);
++
++	if (!link_conf || !link_conf->csa_active || vif->type == NL80211_IFTYPE_STATION)
+ 		return;
+ 
+-	ieee80211_csa_finish(vif, 0);
++	ieee80211_csa_finish(vif, link_id);
+ }
+ 
+ static void
+@@ -480,7 +488,7 @@ mt7996_mcu_ie_countdown(struct mt7996_dev *dev, struct sk_buff *skb)
+ 		case UNI_EVENT_IE_COUNTDOWN_CSA:
+ 			ieee80211_iterate_active_interfaces_atomic(mphy->hw,
+ 					IEEE80211_IFACE_ITER_RESUME_ALL,
+-					mt7996_mcu_csa_finish, mphy->hw);
++					mt7996_mcu_csa_finish, mphy);
+ 			break;
+ 		case UNI_EVENT_IE_COUNTDOWN_BCC:
+ 			ieee80211_iterate_active_interfaces_atomic(mphy->hw,
+-- 
+2.45.2
+