[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]

[Description]
Refactor and sync kernel/wifi from Openwrt
1. wifi release from mt76 openwrt 2022/12/19

[Release-log]
N/A

diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/307-wifi-mac80211-fix-initialization-of-rx-link-and-rx-l.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/307-wifi-mac80211-fix-initialization-of-rx-link-and-rx-l.patch
index 5652c14..857c1c8 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/307-wifi-mac80211-fix-initialization-of-rx-link-and-rx-l.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/307-wifi-mac80211-fix-initialization-of-rx-link-and-rx-l.patch
@@ -20,7 +20,7 @@
 
 --- a/net/mac80211/rx.c
 +++ b/net/mac80211/rx.c
-@@ -4067,6 +4067,55 @@ static void ieee80211_invoke_rx_handlers
+@@ -4067,6 +4067,56 @@ static void ieee80211_invoke_rx_handlers
  #undef CALL_RXH
  }
  
@@ -59,7 +59,8 @@
 +
 +	if (sta) {
 +		rx->local = sta->sdata->local;
-+		rx->sdata = sta->sdata;
++		if (!rx->sdata)
++			rx->sdata = sta->sdata;
 +		rx->link_sta = &sta->deflink;
 +
 +		if (link_id >= 0 &&
@@ -76,7 +77,7 @@
  /*
   * This function makes calls into the RX path, therefore
   * it has to be invoked under RCU read lock.
-@@ -4075,16 +4124,19 @@ void ieee80211_release_reorder_timeout(s
+@@ -4075,16 +4125,19 @@ void ieee80211_release_reorder_timeout(s
  {
  	struct sk_buff_head frames;
  	struct ieee80211_rx_data rx = {
@@ -101,7 +102,7 @@
  
  	tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
  	if (!tid_agg_rx)
-@@ -4104,10 +4156,6 @@ void ieee80211_release_reorder_timeout(s
+@@ -4104,10 +4157,6 @@ void ieee80211_release_reorder_timeout(s
  		};
  		drv_event_callback(rx.local, rx.sdata, &event);
  	}
@@ -112,7 +113,7 @@
  
  	ieee80211_rx_handlers(&rx, &frames);
  }
-@@ -4123,7 +4171,6 @@ void ieee80211_mark_rx_ba_filtered_frame
+@@ -4123,7 +4172,6 @@ void ieee80211_mark_rx_ba_filtered_frame
  		/* This is OK -- must be QoS data frame */
  		.security_idx = tid,
  		.seqno_idx = tid,
@@ -120,7 +121,7 @@
  	};
  	int i, diff;
  
-@@ -4134,10 +4181,8 @@ void ieee80211_mark_rx_ba_filtered_frame
+@@ -4134,10 +4182,8 @@ void ieee80211_mark_rx_ba_filtered_frame
  
  	sta = container_of(pubsta, struct sta_info, sta);
  
@@ -133,7 +134,7 @@
  
  	rcu_read_lock();
  	tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
-@@ -4524,15 +4569,6 @@ void ieee80211_check_fast_rx_iface(struc
+@@ -4524,15 +4570,6 @@ void ieee80211_check_fast_rx_iface(struc
  	mutex_unlock(&local->sta_mtx);
  }
  
@@ -149,7 +150,7 @@
  static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
  			      struct ieee80211_fast_rx *fast_rx,
  			      int orig_len)
-@@ -4643,7 +4679,6 @@ static bool ieee80211_invoke_fast_rx(str
+@@ -4643,7 +4680,6 @@ static bool ieee80211_invoke_fast_rx(str
  	struct sk_buff *skb = rx->skb;
  	struct ieee80211_hdr *hdr = (void *)skb->data;
  	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
@@ -157,7 +158,7 @@
  	int orig_len = skb->len;
  	int hdrlen = ieee80211_hdrlen(hdr->frame_control);
  	int snap_offs = hdrlen;
-@@ -4655,7 +4690,6 @@ static bool ieee80211_invoke_fast_rx(str
+@@ -4655,7 +4691,6 @@ static bool ieee80211_invoke_fast_rx(str
  		u8 da[ETH_ALEN];
  		u8 sa[ETH_ALEN];
  	} addrs __aligned(2);
@@ -165,7 +166,7 @@
  	struct ieee80211_sta_rx_stats *stats;
  
  	/* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write
-@@ -4758,18 +4792,10 @@ static bool ieee80211_invoke_fast_rx(str
+@@ -4758,18 +4793,10 @@ static bool ieee80211_invoke_fast_rx(str
   drop:
  	dev_kfree_skb(skb);
  
@@ -186,15 +187,18 @@
  
  	stats->dropped++;
  	return true;
-@@ -4787,7 +4813,6 @@ static bool ieee80211_prepare_and_rx_han
+@@ -4787,8 +4814,8 @@ static bool ieee80211_prepare_and_rx_han
  	struct ieee80211_local *local = rx->local;
  	struct ieee80211_sub_if_data *sdata = rx->sdata;
  	struct ieee80211_hdr *hdr = (void *)skb->data;
 -	struct link_sta_info *link_sta = NULL;
- 	struct ieee80211_link_data *link;
+-	struct ieee80211_link_data *link;
++	struct link_sta_info *link_sta = rx->link_sta;
++	struct ieee80211_link_data *link = rx->link;
  
  	rx->skb = skb;
-@@ -4810,35 +4835,6 @@ static bool ieee80211_prepare_and_rx_han
+ 
+@@ -4810,35 +4837,6 @@ static bool ieee80211_prepare_and_rx_han
  	if (!ieee80211_accept_frame(rx))
  		return false;
  
@@ -230,7 +234,7 @@
  	if (!consume) {
  		struct skb_shared_hwtstamps *shwt;
  
-@@ -4858,16 +4854,16 @@ static bool ieee80211_prepare_and_rx_han
+@@ -4858,7 +4856,7 @@ static bool ieee80211_prepare_and_rx_han
  		shwt->hwtstamp = skb_hwtstamps(skb)->hwtstamp;
  	}
  
@@ -239,18 +243,7 @@
  		/* translate to MLD addresses */
  		if (ether_addr_equal(link->conf->addr, hdr->addr1))
  			ether_addr_copy(hdr->addr1, rx->sdata->vif.addr);
--		if (ether_addr_equal(link_sta->addr, hdr->addr2))
-+		if (ether_addr_equal(rx->link_sta->addr, hdr->addr2))
- 			ether_addr_copy(hdr->addr2, rx->sta->addr);
- 		/* translate A3 only if it's the BSSID */
- 		if (!ieee80211_has_tods(hdr->frame_control) &&
- 		    !ieee80211_has_fromds(hdr->frame_control)) {
--			if (ether_addr_equal(link_sta->addr, hdr->addr3))
-+			if (ether_addr_equal(rx->link_sta->addr, hdr->addr3))
- 				ether_addr_copy(hdr->addr3, rx->sta->addr);
- 			else if (ether_addr_equal(link->conf->addr, hdr->addr3))
- 				ether_addr_copy(hdr->addr3, rx->sdata->vif.addr);
-@@ -4888,6 +4884,7 @@ static void __ieee80211_rx_handle_8023(s
+@@ -4888,6 +4886,7 @@ static void __ieee80211_rx_handle_8023(s
  	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  	struct ieee80211_fast_rx *fast_rx;
  	struct ieee80211_rx_data rx;
@@ -258,7 +251,7 @@
  
  	memset(&rx, 0, sizeof(rx));
  	rx.skb = skb;
-@@ -4904,12 +4901,8 @@ static void __ieee80211_rx_handle_8023(s
+@@ -4904,12 +4903,8 @@ static void __ieee80211_rx_handle_8023(s
  	if (!pubsta)
  		goto drop;
  
@@ -273,7 +266,7 @@
  
  	/*
  	 * TODO: Should the frame be dropped if the right link_id is not
-@@ -4918,19 +4911,8 @@ static void __ieee80211_rx_handle_8023(s
+@@ -4918,19 +4913,8 @@ static void __ieee80211_rx_handle_8023(s
  	 * link_id is used only for stats purpose and updating the stats on
  	 * the deflink is fine?
  	 */
@@ -295,7 +288,7 @@
  
  	fast_rx = rcu_dereference(rx.sta->fast_rx);
  	if (!fast_rx)
-@@ -4948,6 +4930,8 @@ static bool ieee80211_rx_for_interface(s
+@@ -4948,6 +4932,8 @@ static bool ieee80211_rx_for_interface(s
  {
  	struct link_sta_info *link_sta;
  	struct ieee80211_hdr *hdr = (void *)skb->data;
@@ -304,7 +297,7 @@
  
  	/*
  	 * Look up link station first, in case there's a
-@@ -4957,24 +4941,19 @@ static bool ieee80211_rx_for_interface(s
+@@ -4957,24 +4943,19 @@ static bool ieee80211_rx_for_interface(s
  	 */
  	link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);
  	if (link_sta) {
@@ -337,7 +330,7 @@
  	return ieee80211_prepare_and_rx_handle(rx, skb, consume);
  }
  
-@@ -5033,19 +5012,15 @@ static void __ieee80211_rx_handle_packet
+@@ -5033,19 +5014,15 @@ static void __ieee80211_rx_handle_packet
  
  	if (ieee80211_is_data(fc)) {
  		struct sta_info *sta, *prev_sta;
@@ -362,7 +355,7 @@
  			/*
  			 * In MLO connection, fetch the link_id using addr2
  			 * when the driver does not pass link_id in status.
-@@ -5063,7 +5038,7 @@ static void __ieee80211_rx_handle_packet
+@@ -5063,7 +5040,7 @@ static void __ieee80211_rx_handle_packet
  				if (!link_sta)
  					goto out;
  
@@ -371,7 +364,7 @@
  			}
  
  			if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
-@@ -5079,30 +5054,25 @@ static void __ieee80211_rx_handle_packet
+@@ -5079,30 +5056,25 @@ static void __ieee80211_rx_handle_packet
  				continue;
  			}
  
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/900-mac80211-mtk-do-not-setup-twt-when-twt-responder-is-.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/900-mac80211-mtk-do-not-setup-twt-when-twt-responder-is-.patch
index e9b5544..d016f3c 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/900-mac80211-mtk-do-not-setup-twt-when-twt-responder-is-.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/900-mac80211-mtk-do-not-setup-twt-when-twt-responder-is-.patch
@@ -1,7 +1,7 @@
-From ad3c58a67fd28755ae75ac995ae404eb5c6c21b0 Mon Sep 17 00:00:00 2001
+From 3cd276528e86211747f4628e8d37804facbba749 Mon Sep 17 00:00:00 2001
 From: Peter Chiu <chui-hao.chiu@mediatek.com>
 Date: Tue, 18 Jan 2022 20:29:44 +0800
-Subject: [PATCH 900/908] mac80211: mtk: do not setup twt when twt responder is
+Subject: [PATCH 900/912] mac80211: mtk: do not setup twt when twt responder is
  false
 
 ---
@@ -23,5 +23,5 @@
  		return false;
  
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/901-nl80211-mtk-extend-CAC-time-for-weather-radar-channe.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/901-nl80211-mtk-extend-CAC-time-for-weather-radar-channe.patch
index 57d18b4..ce3c0cc 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/901-nl80211-mtk-extend-CAC-time-for-weather-radar-channe.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/901-nl80211-mtk-extend-CAC-time-for-weather-radar-channe.patch
@@ -1,7 +1,7 @@
-From 7b24c04be43656f0d305473119ba534a5720bc47 Mon Sep 17 00:00:00 2001
+From 12941f847db1f4ee7eb6d82a50eee9568fb532e2 Mon Sep 17 00:00:00 2001
 From: Shayne Chen <shayne.chen@mediatek.com>
 Date: Tue, 29 Mar 2022 16:06:30 +0800
-Subject: [PATCH 901/908] nl80211: mtk: extend CAC time for weather radar
+Subject: [PATCH 901/912] nl80211: mtk: extend CAC time for weather radar
  channels
 
 Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
@@ -28,5 +28,5 @@
  	if (!err) {
  		wdev->links[0].ap.chandef = chandef;
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/902-mac80211-mtk-it-s-invalid-case-when-frag_threshold-i.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/902-mac80211-mtk-it-s-invalid-case-when-frag_threshold-i.patch
index 46a18f7..2a5a1db 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/902-mac80211-mtk-it-s-invalid-case-when-frag_threshold-i.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/902-mac80211-mtk-it-s-invalid-case-when-frag_threshold-i.patch
@@ -1,7 +1,7 @@
-From e66fda08e681b11aa6a10bd7fd750d210cb22745 Mon Sep 17 00:00:00 2001
+From a5ea1addb072fe46a4a0c76c2844dce02ae4f1a6 Mon Sep 17 00:00:00 2001
 From: Bo Jiao <Bo.Jiao@mediatek.com>
 Date: Fri, 1 Apr 2022 09:15:21 +0800
-Subject: [PATCH 902/908] mac80211: mtk: it's invalid case when frag_threshold
+Subject: [PATCH 902/912] mac80211: mtk: it's invalid case when frag_threshold
  is greater than 2346
 
 Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
@@ -24,5 +24,5 @@
  			/*
  			 * Fragments (apart from the last one) are required to
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/903-mac80211-mtk-airtime_flags-depends-on-NL80211_EXT_FE.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/903-mac80211-mtk-airtime_flags-depends-on-NL80211_EXT_FE.patch
index 0f72cb9..f250335 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/903-mac80211-mtk-airtime_flags-depends-on-NL80211_EXT_FE.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/903-mac80211-mtk-airtime_flags-depends-on-NL80211_EXT_FE.patch
@@ -1,7 +1,7 @@
-From 9556fba48d305893fa27e6f0765c1e7985ac734c Mon Sep 17 00:00:00 2001
+From 27c84682bf5a0f935b736e03f1b1e3a6efe86303 Mon Sep 17 00:00:00 2001
 From: Evelyn Tsai <evelyn.tsai@mediatek.com>
 Date: Wed, 19 Oct 2022 13:42:43 +0800
-Subject: [PATCH 903/908] mac80211: mtk: airtime_flags depends on
+Subject: [PATCH 903/912] mac80211: mtk: airtime_flags depends on
  NL80211_EXT_FEATURE
 
 Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
@@ -26,5 +26,5 @@
  	atomic_set(&local->aql_total_pending_airtime, 0);
  
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/904-mac80211-mtk-add-support-for-runtime-set-inband-disc.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/904-mac80211-mtk-add-support-for-runtime-set-inband-disc.patch
index cb7dbde..0ac929b 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/904-mac80211-mtk-add-support-for-runtime-set-inband-disc.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/904-mac80211-mtk-add-support-for-runtime-set-inband-disc.patch
@@ -1,7 +1,7 @@
-From 2b41cfa0a72422f95b4c69be8141bb8579a87450 Mon Sep 17 00:00:00 2001
+From 83e08e8194b7e9d476c72e98a4b05b29329719cb Mon Sep 17 00:00:00 2001
 From: MeiChia Chiu <meichia.chiu@mediatek.com>
 Date: Wed, 19 Oct 2022 13:45:42 +0800
-Subject: [PATCH 904/908] mac80211: mtk: add support for runtime set inband
+Subject: [PATCH 904/912] mac80211: mtk: add support for runtime set inband
  discovery
 
 Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
@@ -178,5 +178,5 @@
  }
  
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/905-mac80211-mtk-remove-timerout-handle-for-ax210-iot-is.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/905-mac80211-mtk-remove-timerout-handle-for-ax210-iot-is.patch
index 86125b4..5a1a077 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/905-mac80211-mtk-remove-timerout-handle-for-ax210-iot-is.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/905-mac80211-mtk-remove-timerout-handle-for-ax210-iot-is.patch
@@ -1,7 +1,7 @@
-From deb128a1f5fba61b131394729373e51a7afd0ec6 Mon Sep 17 00:00:00 2001
+From 81949f8987417079f838e188d621921c70ce0243 Mon Sep 17 00:00:00 2001
 From: Evelyn Tsai <evelyn.tsai@mediatek.com>
 Date: Wed, 19 Oct 2022 13:49:21 +0800
-Subject: [PATCH 905/908] mac80211: mtk: remove timerout handle for ax210 iot
+Subject: [PATCH 905/912] mac80211: mtk: remove timerout handle for ax210 iot
  issue
 
 Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
@@ -31,5 +31,5 @@
  	ht_dbg(sta->sdata, "tx session timer expired on %pM tid %d\n",
  	       sta->sta.addr, tid);
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/906-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-s.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/906-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-s.patch
index f1b0542..ab81250 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/906-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-s.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/906-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-s.patch
@@ -1,7 +1,7 @@
-From e9dbde98d01f963121febafa51f6e7bb68bef135 Mon Sep 17 00:00:00 2001
+From abbf219e25183195fe2ddb675dcb5747d8a53622 Mon Sep 17 00:00:00 2001
 From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
 Date: Thu, 22 Sep 2022 14:27:41 +0800
-Subject: [PATCH 906/908] cfg80211: mtk: implement DFS status show, cac and nop
+Subject: [PATCH 906/912] cfg80211: mtk: implement DFS status show, cac and nop
  skip command via debugfs
 
 Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -455,5 +455,5 @@
  
  #undef TRACE_INCLUDE_PATH
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/907-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/907-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-.patch
index 6f5adfd..31f77c7 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/907-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/907-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-.patch
@@ -1,7 +1,7 @@
-From 4781823ccaaca6cb075013aa8bbb2e733ddffb5f Mon Sep 17 00:00:00 2001
+From 9292503e99db5132eb8ca052e3574b5043f87579 Mon Sep 17 00:00:00 2001
 From: Howard Hsu <howard-yh.hsu@mediatek.com>
 Date: Tue, 4 Oct 2022 10:47:05 +0800
-Subject: [PATCH 907/908] mac80211: mtk: Set TWT Information Frame Disabled bit
+Subject: [PATCH 907/912] mac80211: mtk: Set TWT Information Frame Disabled bit
  as 1.
 
 This modification means that current implementation do not support twt information frame.
@@ -22,5 +22,5 @@
  	/* broadcast TWT not supported yet */
  	if (twt->control & IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST) {
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/908-mac80211-mtk-fix-the-issue-of-AP-and-STA-starting-on.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/908-mac80211-mtk-fix-the-issue-of-AP-and-STA-starting-on.patch
index fdb863e..d9bc05e 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/908-mac80211-mtk-fix-the-issue-of-AP-and-STA-starting-on.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/908-mac80211-mtk-fix-the-issue-of-AP-and-STA-starting-on.patch
@@ -1,7 +1,7 @@
-From 5fcae1d998339e7d0632c8ae5781232f9e6e4b14 Mon Sep 17 00:00:00 2001
+From 4c503f7af8f53b6ad3de3f2df914da5f9ed1858f Mon Sep 17 00:00:00 2001
 From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
 Date: Wed, 5 Oct 2022 19:13:43 +0800
-Subject: [PATCH 908/908] mac80211: mtk: fix the issue of AP and STA starting
+Subject: [PATCH 908/912] mac80211: mtk: fix the issue of AP and STA starting
  on DFS channel concurrently
 
 Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -258,5 +258,5 @@
  
  #undef TRACE_INCLUDE_PATH
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/909-mac80211-mtk-check-the-control-channel-before-downgr.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/909-mac80211-mtk-check-the-control-channel-before-downgr.patch
new file mode 100644
index 0000000..48eb6e9
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/909-mac80211-mtk-check-the-control-channel-before-downgr.patch
@@ -0,0 +1,54 @@
+From 1c406724813497c3a7679d67f53755c102be8f9a Mon Sep 17 00:00:00 2001
+From: Evelyn Tsai <evelyn.tsai@mediatek.com>
+Date: Fri, 16 Dec 2022 03:31:06 +0800
+Subject: [PATCH 909/912] mac80211: mtk: check the control channel before
+ downgrading the bandwidth
+
+---
+ net/mac80211/mlme.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
+index d8484cd..8ab5c52 100644
+--- a/net/mac80211/mlme.c
++++ b/net/mac80211/mlme.c
+@@ -4582,6 +4582,26 @@ ieee80211_verify_sta_he_mcs_support(struct ieee80211_sub_if_data *sdata,
+ 	return false;
+ }
+ 
++static bool ieee80211_check_same_ctrl_channel(struct ieee80211_sub_if_data *sdata,
++					      const struct cfg80211_chan_def *chandef)
++{
++	struct ieee80211_local *local = sdata->local;
++	struct ieee80211_chanctx *ctx;
++
++	mutex_lock(&local->chanctx_mtx);
++	list_for_each_entry(ctx, &local->chanctx_list, list) {
++		if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
++			continue;
++		if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE)
++			continue;
++		if (chandef->chan == ctx->conf.def.chan)
++			return true;
++	}
++
++	mutex_unlock(&local->chanctx_mtx);
++	return false;
++}
++
+ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
+ 				  struct ieee80211_link_data *link,
+ 				  struct cfg80211_bss *cbss,
+@@ -4808,6 +4828,9 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
+ 	    chandef.width == NL80211_CHAN_WIDTH_10)
+ 		goto out;
+ 
++	if (!ret || !ieee80211_check_same_ctrl_channel(sdata, &chandef))
++		goto out;
++
+ 	while (ret && chandef.width != NL80211_CHAN_WIDTH_20_NOHT) {
+ 		*conn_flags |=
+ 			ieee80211_chandef_downgrade(&chandef);
+-- 
+2.36.1
+
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/910-mac80211-mtk-fix-tx-amsdu-aggregation.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/910-mac80211-mtk-fix-tx-amsdu-aggregation.patch
new file mode 100644
index 0000000..aba73e7
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/910-mac80211-mtk-fix-tx-amsdu-aggregation.patch
@@ -0,0 +1,55 @@
+From 63eb14a66a1ed384a0bb952b9b50fe81a859690a Mon Sep 17 00:00:00 2001
+From: TomLiu <tomml.liu@mediatek.com>
+Date: Wed, 14 Dec 2022 00:26:50 -0800
+Subject: [PATCH 910/912] mac80211: mtk: fix tx amsdu aggregation
+
+---
+ include/net/mac80211.h | 7 +++++++
+ net/mac80211/agg-tx.c  | 6 ++++--
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+index 4485cfa..5429de0 100644
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -2851,6 +2851,13 @@ static inline void _ieee80211_hw_set(struct ieee80211_hw *hw,
+ }
+ #define ieee80211_hw_set(hw, flg)	_ieee80211_hw_set(hw, IEEE80211_HW_##flg)
+ 
++static inline void _ieee80211_hw_clear(struct ieee80211_hw *hw,
++				     enum ieee80211_hw_flags flg)
++{
++	return __clear_bit(flg, hw->flags);
++}
++#define ieee80211_hw_clear(hw, flg)	_ieee80211_hw_clear(hw, IEEE80211_HW_##flg)
++
+ /**
+  * struct ieee80211_scan_request - hw scan request
+  *
+diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
+index 1f46561..318c71e 100755
+--- a/net/mac80211/agg-tx.c
++++ b/net/mac80211/agg-tx.c
+@@ -66,7 +66,8 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
+ 	struct ieee80211_local *local = sdata->local;
+ 	struct sk_buff *skb;
+ 	struct ieee80211_mgmt *mgmt;
+-	u16 capab;
++	u16 capab = 0;
++	bool amsdu = ieee80211_hw_check(&local->hw, SUPPORTS_AMSDU_IN_AMPDU);
+ 
+ 	skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
+ 
+@@ -95,7 +96,8 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
+ 	mgmt->u.action.u.addba_req.action_code = WLAN_ACTION_ADDBA_REQ;
+ 
+ 	mgmt->u.action.u.addba_req.dialog_token = dialog_token;
+-	capab = IEEE80211_ADDBA_PARAM_AMSDU_MASK;
++	if (amsdu)
++		capab = IEEE80211_ADDBA_PARAM_AMSDU_MASK;
+ 	capab |= IEEE80211_ADDBA_PARAM_POLICY_MASK;
+ 	capab |= u16_encode_bits(tid, IEEE80211_ADDBA_PARAM_TID_MASK);
+ 	capab |= u16_encode_bits(agg_size, IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK);
+-- 
+2.36.1
+
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99900-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-i.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99900-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-i.patch
index 8ffd6f5..b755139 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99900-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-i.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99900-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-i.patch
@@ -1,4 +1,4 @@
-From 447d620689b705b1e6e382a8bae59930e74e257c Mon Sep 17 00:00:00 2001
+From 2fddf05d7d9786a42466ec504c890f91e1944612 Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
 Date: Wed, 18 May 2022 15:10:22 +0800
 Subject: [PATCH 99900/99901] mac80211: mtk: add fill receive path ops to get
@@ -14,7 +14,7 @@
  mode change 100644 => 100755 net/mac80211/util.c
 
 diff --git a/include/net/mac80211.h b/include/net/mac80211.h
-index 4485cfa..fe686a4 100644
+index 5429de0..dd9e834 100644
 --- a/include/net/mac80211.h
 +++ b/include/net/mac80211.h
 @@ -1354,7 +1354,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
@@ -48,7 +48,7 @@
  /**
   * lockdep_vif_mutex_held - for lockdep checks on link poiners
   * @vif: the interface to check
-@@ -4173,6 +4179,8 @@ struct ieee80211_prep_tx_info {
+@@ -4180,6 +4186,8 @@ struct ieee80211_prep_tx_info {
   *	Note that a sta can also be inserted or removed with valid links,
   *	i.e. passed to @sta_add/@sta_state with sta->valid_links not zero.
   *	In fact, cannot change from having valid_links and not having them.
@@ -57,7 +57,7 @@
   */
  struct ieee80211_ops {
  	void (*tx)(struct ieee80211_hw *hw,
-@@ -4528,6 +4536,9 @@ struct ieee80211_ops {
+@@ -4535,6 +4543,9 @@ struct ieee80211_ops {
  				struct ieee80211_vif *vif,
  				struct ieee80211_sta *sta,
  				u16 old_links, u16 new_links);
@@ -154,5 +154,5 @@
   * Nothing should have been stuffed into the workqueue during
   * the suspend->resume cycle. Since we can't check each caller
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99901-fix-build-failed.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99999-mac80211-mtk-fix-build-error-on-Linux-Kernel-5.4.patch
similarity index 92%
rename from recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99901-fix-build-failed.patch
rename to recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99999-mac80211-mtk-fix-build-error-on-Linux-Kernel-5.4.patch
index 6731827..a7bb3c4 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99901-fix-build-failed.patch
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/99999-mac80211-mtk-fix-build-error-on-Linux-Kernel-5.4.patch
@@ -1,7 +1,7 @@
-From 58619705cdbd28520ddf730eba94c3f5dfca04dc Mon Sep 17 00:00:00 2001
-From: Peter Chiu <chui-hao.chiu@mediatek.com>
-Date: Mon, 12 Dec 2022 15:08:10 +0800
-Subject: [PATCH 99901/99901] fix build failed
+From 4ca1834f804f70ffea6f95720d6145a56cd0414b Mon Sep 17 00:00:00 2001
+From: Evelyn Tsai <evelyn.tsai@mediatek.com>
+Date: Tue, 13 Dec 2022 09:04:49 +0800
+Subject: [PATCH] mac80211: mtk: fix build error on Linux Kernel 5.4
 
 ---
  include/linux/ieee80211.h          | 8 +++-----
@@ -93,5 +93,5 @@
  	.resv_start_op = NL80211_CMD_REMOVE_LINK_STA + 1,
  #endif
 -- 
-2.18.0
+2.36.1
 
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
index 3a7baed..230697b 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
@@ -28,6 +28,8 @@
     file://906-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-s.patch \
     file://907-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-.patch \
     file://908-mac80211-mtk-fix-the-issue-of-AP-and-STA-starting-on.patch \
+    file://909-mac80211-mtk-check-the-control-channel-before-downgr.patch \
+    file://910-mac80211-mtk-fix-tx-amsdu-aggregation.patch \
     file://99900-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-i.patch \
-    file://99901-fix-build-failed.patch \
+    file://99999-mac80211-mtk-fix-build-error-on-Linux-Kernel-5.4.patch \
     "