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

[Description]
47ae7bda [MAC80211][WiFi7][misc][using 'mld_assoc_phy' to limit STA's scan list]
909d791e [MAC80211][hnat][Separate the patch that binding when there is no ARP from the common part]
50dfac90 [MAC80211][WiFi6][core][Add cfg80211_is_wiphy_oper_chan check before clearing dfs state]
e88bf323 [mac80211][mt76][csi][update connac2 csi]
932e5b7e [MAC80211][hnat][Fix TCP flow teardown and UDP timeout depending on ct state]
7afb9df8 [MAC80211][misc][Add relayd package by default]
2d383a4f [MAC80211][WiFi7][Fix mld configuration when reboot]
b72c214b [MAC80211][WiFi7][app][Add cert sigma cmd single mld support]
a033e932 [MAC80211][WiFi6][Misc][Fix build fail because of mt76 version upgradation]
d4c0b6b1 [MAC80211][WiFi7][Fix mld address config under default bin mode]
b765e536 [MAC80211][mt76][Fix null pointer access]
793020c2 [MAC80211][misc][Add default wifi-mld config]
5e43f5e3 [MAC80211][WiFi7][misc][Extender: add support for channel switch]
f8c41e9c [MAC80211][WiFi7][misc][change the place to sleep to prevent race STA's condition]
e51edc3e [MAC80211][misc][Fix git am issue in WiFi6]
28b06c10 [MAC80211][wed][Fix mtk_wed_add_hw call trace]
06cf786c [MAC80211][Rebase Patch][Fix mtk_wed_add_hw call trace]
e1357208 [MAC80211][WiFi7][misc][Add EMLSR option in mac80211.sh]
eb9a4021 [MAC80211][WiFi7][misc][do not re-initialize psk & vlan files when setup MLD non-primary links]
49cf64a9 [MAC80211][WiFi7][misc][remove sleep for each phy when teardown]
15fbc4fc [MAC80211][misc][Fix wrongly format of afcd patch]
30491894 [MAC80211][Release][Add commit revision for Filogic 830/820/630/615 release]
26f78b39 [MAC80211][misc][Add Bpi-R4 image support]

[Release-log]

Change-Id: I3d0bb83dca7a148472292c718b3de5719e5dfe82
diff --git a/recipes-wifi/linux-mt76/files/patches/1047-wifi-mt76-mt7915-add-SER-overlap-handle.patch b/recipes-wifi/linux-mt76/files/patches/1047-wifi-mt76-mt7915-add-SER-overlap-handle.patch
new file mode 100644
index 0000000..b8314fd
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/1047-wifi-mt76-mt7915-add-SER-overlap-handle.patch
@@ -0,0 +1,138 @@
+From 0f8d644d9c7ab28e9e4da56151987a3e4be1f55f Mon Sep 17 00:00:00 2001
+From: Bo Jiao <Bo.Jiao@mediatek.com>
+Date: Tue, 6 Feb 2024 14:46:59 +0800
+Subject: [PATCH 1047/1051] wifi: mt76: mt7915: add SER overlap handle
+
+CR-ID: WCNCR00355921
+Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
+---
+ dma.c        |  3 ++-
+ mcu.c        |  7 +++++--
+ mt76.h       |  9 +++++++++
+ mt7915/mac.c | 11 +++++++++++
+ mt7915/mcu.c |  7 +++++++
+ 5 files changed, 34 insertions(+), 3 deletions(-)
+
+diff --git a/dma.c b/dma.c
+index 133a50d..100d2af 100644
+--- a/dma.c
++++ b/dma.c
+@@ -506,7 +506,8 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
+ 	dma_addr_t addr;
+ 	int ret = -ENOMEM;
+ 
+-	if (test_bit(MT76_MCU_RESET, &dev->phy.state)) {
++	if (test_bit(MT76_MCU_RESET, &dev->phy.state) ||
++	    dev->recovery_state == MT76_RECOVERY_TRIGGERED) {
+ 		ret = -EAGAIN;
+ 		goto error;
+ 	}
+diff --git a/mcu.c b/mcu.c
+index de185cc..1bc94e8 100644
+--- a/mcu.c
++++ b/mcu.c
+@@ -42,7 +42,9 @@ struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev,
+ 	timeout = expires - jiffies;
+ 	wait_event_timeout(dev->mcu.wait,
+ 			   (!skb_queue_empty(&dev->mcu.res_q) ||
+-			    test_bit(MT76_MCU_RESET, &dev->phy.state)),
++			    test_bit(MT76_MCU_RESET, &dev->phy.state) ||
++			    dev->recovery_state == MT76_RECOVERY_TRIGGERED ||
++			    dev->recovery_state == MT76_RECOVERY_OVERLAP_TRIGGERED),
+ 			   timeout);
+ 	return skb_dequeue(&dev->mcu.res_q);
+ }
+@@ -92,7 +94,8 @@ int mt76_mcu_skb_send_and_get_msg(struct mt76_dev *dev, struct sk_buff *skb,
+ 			goto out;
+ 
+ 		if (retry && retry_cnt < MT76_MSG_MAX_RETRY_CNT) {
+-			if (test_bit(MT76_MCU_RESET, &dev->phy.state))
++			if (test_bit(MT76_MCU_RESET, &dev->phy.state) ||
++			    dev->recovery_state == MT76_RECOVERY_TRIGGERED)
+ 				usleep_range(200000, 500000);
+ 			dev_err(dev->dev, "send message %08x timeout, try again(%d).\n",
+ 				cmd, (MT76_MSG_MAX_RETRY_CNT - retry_cnt));
+diff --git a/mt76.h b/mt76.h
+index a7a8ece..e6482e5 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -478,6 +478,14 @@ enum {
+ 	MT76_STATE_WED_RESET,
+ };
+ 
++enum {
++	MT76_RECOVERY_INIT,
++	MT76_RECOVERY_TRIGGERED,
++	MT76_RECOVERY_OVERLAP_TRIGGERED,
++	MT76_RECOVERY_PROCESS,
++	MT76_RECOVERY_DONE = MT76_RECOVERY_INIT,
++};
++
+ struct mt76_hw_cap {
+ 	bool has_2ghz;
+ 	bool has_5ghz;
+@@ -944,6 +952,7 @@ struct mt76_dev {
+ 	wait_queue_head_t tx_wait;
+ 	/* spinclock used to protect wcid pktid linked list */
+ 	spinlock_t status_lock;
++	u16 recovery_state;
+ 
+ 	u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
+ 	u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
+diff --git a/mt7915/mac.c b/mt7915/mac.c
+index b3c9163..c84b957 100644
+--- a/mt7915/mac.c
++++ b/mt7915/mac.c
+@@ -1538,6 +1538,7 @@ void mt7915_mac_reset_work(struct work_struct *work)
+ 	if (!(READ_ONCE(dev->recovery.state) & MT_MCU_CMD_STOP_DMA))
+ 		return;
+ 
++	dev->mt76.recovery_state = MT76_RECOVERY_PROCESS;
+ 	dev_info(dev->mt76.dev,"\n%s L1 SER recovery start.",
+ 		 wiphy_name(dev->mt76.hw->wiphy));
+ 
+@@ -1604,6 +1605,7 @@ void mt7915_mac_reset_work(struct work_struct *work)
+ 
+ 	mt7915_update_beacons(dev);
+ 
++	dev->mt76.recovery_state = MT76_RECOVERY_DONE;
+ 	dev_info(dev->mt76.dev,"\n%s L1 SER recovery completed.",
+ 		 wiphy_name(dev->mt76.hw->wiphy));
+ }
+@@ -1742,6 +1744,15 @@ void mt7915_reset(struct mt7915_dev *dev)
+ 		return;
+ 	}
+ 
++	if ((READ_ONCE(dev->recovery.state) & MT_MCU_CMD_STOP_DMA)) {
++		if (dev->mt76.recovery_state != MT76_RECOVERY_DONE)
++			dev->mt76.recovery_state = MT76_RECOVERY_OVERLAP_TRIGGERED;
++		else
++			dev->mt76.recovery_state = MT76_RECOVERY_TRIGGERED;
++
++		wake_up(&dev->mt76.mcu.wait);
++	}
++
+ 	queue_work(dev->mt76.wq, &dev->reset_work);
+ 	wake_up(&dev->reset_wait);
+ }
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index cb78961..f890063 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -198,6 +198,13 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
+ 	enum mt76_mcuq_id qid;
+ 	int ret;
+ 
++	if (mdev->recovery_state == MT76_RECOVERY_OVERLAP_TRIGGERED) {
++		dev_info(dev->mt76.dev,"\n%s L1 SER recovery overlap, drop message %08x.",
++			 wiphy_name(dev->mt76.hw->wiphy), cmd);
++		dev_kfree_skb(skb);
++		return -EPERM;
++	}
++
+ 	ret = mt76_connac2_mcu_fill_message(mdev, skb, cmd, wait_seq);
+ 
+ 	if (ret)
+-- 
+2.18.0
+