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

[Description]
Refactor and sync kernel/wifi from Openwrt

[Release-log]
N/A

diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/343-wifi-mac80211-fix-decap-offload-for-stations-on-AP_V.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/343-wifi-mac80211-fix-decap-offload-for-stations-on-AP_V.patch
new file mode 100644
index 0000000..0feb408
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/343-wifi-mac80211-fix-decap-offload-for-stations-on-AP_V.patch
@@ -0,0 +1,37 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 28 Sep 2022 13:50:34 +0200
+Subject: [PATCH] wifi: mac80211: fix decap offload for stations on AP_VLAN
+ interfaces
+
+Since AP_VLAN interfaces are not passed to the driver, check offload_flags
+on the bss vif instead.
+
+Reported-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+Fixes: 80a915ec4427 ("mac80211: add rx decapsulation offload support")
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -4265,6 +4265,7 @@ void ieee80211_check_fast_rx(struct sta_
+ 		.vif_type = sdata->vif.type,
+ 		.control_port_protocol = sdata->control_port_protocol,
+ 	}, *old, *new = NULL;
++	u32 offload_flags;
+ 	bool set_offload = false;
+ 	bool assign = false;
+ 	bool offload;
+@@ -4380,10 +4381,10 @@ void ieee80211_check_fast_rx(struct sta_
+ 	if (assign)
+ 		new = kmemdup(&fastrx, sizeof(fastrx), GFP_KERNEL);
+ 
+-	offload = assign &&
+-		  (sdata->vif.offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED);
++	offload_flags = get_bss_sdata(sdata)->vif.offload_flags;
++	offload = offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED;
+ 
+-	if (offload)
++	if (assign && offload)
+ 		set_offload = !test_and_set_sta_flag(sta, WLAN_STA_DECAP_OFFLOAD);
+ 	else
+ 		set_offload = test_and_clear_sta_flag(sta, WLAN_STA_DECAP_OFFLOAD);
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/344-wifi-cfg80211-fix-ieee80211_data_to_8023_exthdr-hand.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/344-wifi-cfg80211-fix-ieee80211_data_to_8023_exthdr-hand.patch
new file mode 100644
index 0000000..161c7d6
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/344-wifi-cfg80211-fix-ieee80211_data_to_8023_exthdr-hand.patch
@@ -0,0 +1,99 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Fri, 7 Oct 2022 10:54:47 +0200
+Subject: [PATCH] wifi: cfg80211: fix ieee80211_data_to_8023_exthdr
+ handling of small packets
+
+STP topology change notification packets only have a payload of 7 bytes,
+so they get dropped due to the skb->len < hdrlen + 8 check.
+Fix this by removing skb->len based checks and instead check the return code
+on the skb_copy_bits calls.
+
+Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
+Reported-by: Chad Monroe <chad.monroe@smartrg.com>
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -557,7 +557,7 @@ int ieee80211_data_to_8023_exthdr(struct
+ 		return -1;
+ 
+ 	hdrlen = ieee80211_hdrlen(hdr->frame_control) + data_offset;
+-	if (skb->len < hdrlen + 8)
++	if (skb->len < hdrlen)
+ 		return -1;
+ 
+ 	/* convert IEEE 802.11 header + possible LLC headers into Ethernet
+@@ -572,8 +572,9 @@ int ieee80211_data_to_8023_exthdr(struct
+ 	memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
+ 	memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
+ 
+-	if (iftype == NL80211_IFTYPE_MESH_POINT)
+-		skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
++	if (iftype == NL80211_IFTYPE_MESH_POINT &&
++	    skb_copy_bits(skb, hdrlen, &mesh_flags, 1) < 0)
++		return -1;
+ 
+ 	mesh_flags &= MESH_FLAGS_AE;
+ 
+@@ -593,11 +594,12 @@ int ieee80211_data_to_8023_exthdr(struct
+ 		if (iftype == NL80211_IFTYPE_MESH_POINT) {
+ 			if (mesh_flags == MESH_FLAGS_AE_A4)
+ 				return -1;
+-			if (mesh_flags == MESH_FLAGS_AE_A5_A6) {
+-				skb_copy_bits(skb, hdrlen +
+-					offsetof(struct ieee80211s_hdr, eaddr1),
+-					tmp.h_dest, 2 * ETH_ALEN);
+-			}
++			if (mesh_flags == MESH_FLAGS_AE_A5_A6 &&
++			    skb_copy_bits(skb, hdrlen +
++					  offsetof(struct ieee80211s_hdr, eaddr1),
++					  tmp.h_dest, 2 * ETH_ALEN) < 0)
++				return -1;
++
+ 			hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
+ 		}
+ 		break;
+@@ -611,10 +613,11 @@ int ieee80211_data_to_8023_exthdr(struct
+ 		if (iftype == NL80211_IFTYPE_MESH_POINT) {
+ 			if (mesh_flags == MESH_FLAGS_AE_A5_A6)
+ 				return -1;
+-			if (mesh_flags == MESH_FLAGS_AE_A4)
+-				skb_copy_bits(skb, hdrlen +
+-					offsetof(struct ieee80211s_hdr, eaddr1),
+-					tmp.h_source, ETH_ALEN);
++			if (mesh_flags == MESH_FLAGS_AE_A4 &&
++			    skb_copy_bits(skb, hdrlen +
++					  offsetof(struct ieee80211s_hdr, eaddr1),
++					  tmp.h_source, ETH_ALEN) < 0)
++				return -1;
+ 			hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
+ 		}
+ 		break;
+@@ -626,18 +629,18 @@ int ieee80211_data_to_8023_exthdr(struct
+ 		break;
+ 	}
+ 
+-	skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
+-	tmp.h_proto = payload.proto;
+-
+-	if (likely((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) &&
+-		    tmp.h_proto != htons(ETH_P_AARP) &&
+-		    tmp.h_proto != htons(ETH_P_IPX)) ||
+-		   ether_addr_equal(payload.hdr, bridge_tunnel_header)))
++	if (likely(skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 &&
++	           ((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) &&
++		     payload.proto != htons(ETH_P_AARP) &&
++		     payload.proto != htons(ETH_P_IPX)) ||
++		    ether_addr_equal(payload.hdr, bridge_tunnel_header)))) {
+ 		/* remove RFC1042 or Bridge-Tunnel encapsulation and
+ 		 * replace EtherType */
+ 		hdrlen += ETH_ALEN + 2;
+-	else
++		tmp.h_proto = payload.proto;
++	} else {
+ 		tmp.h_proto = htons(skb->len - hdrlen);
++	}
+ 
+ 	pskb_pull(skb, hdrlen);
+ 
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/345-wifi-mac80211-do-not-drop-packets-smaller-than-the-L.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/345-wifi-mac80211-do-not-drop-packets-smaller-than-the-L.patch
new file mode 100644
index 0000000..16cafc4
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/345-wifi-mac80211-do-not-drop-packets-smaller-than-the-L.patch
@@ -0,0 +1,25 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Fri, 7 Oct 2022 10:58:26 +0200
+Subject: [PATCH] wifi: mac80211: do not drop packets smaller than the
+ LLC-SNAP header on fast-rx
+
+Since STP TCN frames are only 7 bytes, the pskb_may_pull call returns an error.
+Instead of dropping those packets, bump them back to the slow path for proper
+processing.
+
+Fixes: 49ddf8e6e234 ("mac80211: add fast-rx path")
+Reported-by: Chad Monroe <chad.monroe@smartrg.com>
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -4601,7 +4601,7 @@ static bool ieee80211_invoke_fast_rx(str
+ 
+ 	if (!(status->rx_flags & IEEE80211_RX_AMSDU)) {
+ 		if (!pskb_may_pull(skb, snap_offs + sizeof(*payload)))
+-			goto drop;
++			return false;
+ 
+ 		payload = (void *)(skb->data + snap_offs);
+ 
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch
new file mode 100644
index 0000000..e7da94c
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch
@@ -0,0 +1,33 @@
+From 313d8c18385f10957402b475f9b0c209ceab6c5a Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Fri, 8 Oct 2021 00:25:19 +0200
+Subject: [PATCH] mac80211: mask nested A-MSDU support for mesh
+
+mac80211 incorrectly processes A-MSDUs contained in A-MPDU frames. This
+results in dropped packets and severely impacted throughput.
+
+As a workaround, don't indicate support for A-MSDUs contained in
+A-MPDUs. This improves throughput over mesh links by factor 10.
+
+Ref: https://github.com/openwrt/mt76/issues/450
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+ net/mac80211/agg-rx.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/net/mac80211/agg-rx.c
++++ b/net/mac80211/agg-rx.c
+@@ -251,7 +251,11 @@ static void ieee80211_send_addba_resp(st
+ 	mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP;
+ 	mgmt->u.action.u.addba_resp.dialog_token = dialog_token;
+ 
+-	capab = u16_encode_bits(amsdu, IEEE80211_ADDBA_PARAM_AMSDU_MASK);
++	capab = 0;
++#ifdef CONFIG_MAC80211_MESH
++	if (!sta->mesh)
++#endif
++		capab = u16_encode_bits(amsdu, IEEE80211_ADDBA_PARAM_AMSDU_MASK);
+ 	capab |= u16_encode_bits(policy, IEEE80211_ADDBA_PARAM_POLICY_MASK);
+ 	capab |= u16_encode_bits(tid, IEEE80211_ADDBA_PARAM_TID_MASK);
+ 	capab |= u16_encode_bits(buf_size, IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK);
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/900-mac80211-mtk-export-del-all-station-for-ampdu-amsdu-on-off-function.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/900-mac80211-mtk-export-del-all-station-for-ampdu-amsdu-on-off-function.patch
new file mode 100755
index 0000000..ada8e31
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/900-mac80211-mtk-export-del-all-station-for-ampdu-amsdu-on-off-function.patch
@@ -0,0 +1,63 @@
+--- b/include/net/mac80211.h	2021-09-22 21:10:45.803721216 +0800
++++ a/include/net/mac80211.h	2021-09-22 21:19:40.494744637 +0800
+@@ -2639,6 +2639,13 @@
+ }
+ #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
+  *
+@@ -4989,6 +4996,12 @@
+ void ieee80211_csa_finish(struct ieee80211_vif *vif);
+ 
+ /**
++ * ieee80211_del_all_station - request mac80211 to delete all stations
++ * @hw: pointer obtained from ieee80211_alloc_hw().
++ */
++void ieee80211_del_all_station(struct ieee80211_hw *hw);
++
++/**
+  * ieee80211_beacon_cntdwn_is_complete - find out if countdown reached 1
+  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+  *
+--- b/net/mac80211/cfg.c	2021-09-22 21:10:45.675720709 +0800
++++ a/net/mac80211/cfg.c	2021-09-22 21:11:23.456352549 +0800
+@@ -1718,6 +1718,19 @@
+ 	return 0;
+ }
+ 
++void ieee80211_del_all_station(struct ieee80211_hw *hw)
++{
++	struct ieee80211_local *local = hw_to_local(hw);
++	struct sta_info *sta, *tmp;
++
++	mutex_lock(&local->sta_mtx);
++	list_for_each_entry_safe(sta, tmp, &local->sta_list, list) {
++		WARN_ON(__sta_info_destroy(sta));
++	}
++	mutex_unlock(&local->sta_mtx);
++}
++EXPORT_SYMBOL(ieee80211_del_all_station);
++
+ static int ieee80211_change_station(struct wiphy *wiphy,
+ 				    struct net_device *dev, const u8 *mac,
+ 				    struct station_parameters *params)
+--- b/net/mac80211/sta_info.c	2021-09-22 21:10:45.599720409 +0800
++++ a/net/mac80211/sta_info.c	2021-09-22 20:50:39.158775251 +0800
+@@ -683,7 +683,8 @@
+ 	}
+ 
+ 	/* accept BA sessions now */
+-	clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
++	if (ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION))
++		clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
+ 
+ 	ieee80211_sta_debugfs_add(sta);
+ 	rate_control_add_sta_debugfs(sta);
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/901-mac80211-check-twt-responder-when-setu-twt.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/901-mac80211-mtk-check-twt-responder-when-setu-twt.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/901-mac80211-check-twt-responder-when-setu-twt.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/901-mac80211-mtk-check-twt-responder-when-setu-twt.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/902-nl80211-internal-extend-CAC-time-for-weather-radar-c.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/902-nl80211-mtk-internal-extend-CAC-time-for-weather-radar-c.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/902-nl80211-internal-extend-CAC-time-for-weather-radar-c.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/902-nl80211-mtk-internal-extend-CAC-time-for-weather-radar-c.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/903-mac80211-it-s-invalid-case-when-frag_threshold-is-gr.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/903-mac80211-mtk-it-s-invalid-case-when-frag_threshold-is-gr.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/903-mac80211-it-s-invalid-case-when-frag_threshold-is-gr.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/903-mac80211-mtk-it-s-invalid-case-when-frag_threshold-is-gr.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/904-mac80211-correct-legacy-rates-check-in-ieee80211_cal.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/904-mac80211-mtk-correct-legacy-rates-check-in-ieee80211_cal.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/904-mac80211-correct-legacy-rates-check-in-ieee80211_cal.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/904-mac80211-mtk-correct-legacy-rates-check-in-ieee80211_cal.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/905-mac80211-airtime_flags-depends-on-NL80211_EXT_FEATUR.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/905-mac80211-mtk-airtime_flags-depends-on-NL80211_EXT_FEATUR.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/905-mac80211-airtime_flags-depends-on-NL80211_EXT_FEATUR.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/905-mac80211-mtk-airtime_flags-depends-on-NL80211_EXT_FEATUR.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-add-support-for-runtime-set-inband-discovery.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-mtk-add-support-for-runtime-set-inband-discovery.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-add-support-for-runtime-set-inband-discovery.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-mtk-add-support-for-runtime-set-inband-discovery.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/908-mac80211-add-s1g-category-to-_ieee80211_is_robust_mg.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/908-mac80211-mtk-add-s1g-category-to-_ieee80211_is_robust_mg.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/908-mac80211-add-s1g-category-to-_ieee80211_is_robust_mg.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/908-mac80211-mtk-add-s1g-category-to-_ieee80211_is_robust_mg.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/910-mac80211-offload.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/910-mac80211-mtk-offload.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/910-mac80211-offload.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/910-mac80211-mtk-offload.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/911-add-fill-receive-path-ops-to-get-wed-idx-v2.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/911-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-idx-v2.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/911-add-fill-receive-path-ops-to-get-wed-idx-v2.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/911-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-idx-v2.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/912-mac80211-make-4addr-null-frames-using-min-rate-for-WDS.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/912-mac80211-mtk-make-4addr-null-frames-using-min-rate-for-WDS.patch
similarity index 100%
rename from recipes-kernel/linux-mac80211/files/patches/subsys/912-mac80211-make-4addr-null-frames-using-min-rate-for-WDS.patch
rename to recipes-kernel/linux-mac80211/files/patches/subsys/912-mac80211-mtk-make-4addr-null-frames-using-min-rate-for-WDS.patch
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/913-mac80211-mtk-remove-timerout-handle-for-ax210-iot-issue.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/913-mac80211-mtk-remove-timerout-handle-for-ax210-iot-issue.patch
new file mode 100755
index 0000000..4d3b674
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/913-mac80211-mtk-remove-timerout-handle-for-ax210-iot-issue.patch
@@ -0,0 +1,20 @@
+diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
+index 1deb3d8..c30f02d 100755
+--- a/net/mac80211/agg-tx.c
++++ b/net/mac80211/agg-tx.c
+@@ -568,10 +568,9 @@ static void sta_tx_agg_session_timer_expired(struct timer_list *t)
+ 	}
+
+ 	timeout = tid_tx->last_tx + TU_TO_JIFFIES(tid_tx->timeout);
+-	if (time_is_after_jiffies(timeout)) {
+-		mod_timer(&tid_tx->session_timer, timeout);
+-		return;
+-	}
++	/* remove timerout handle for ax210 iot issue */
++	mod_timer(&tid_tx->session_timer, timeout);
++	return;
+
+ 	ht_dbg(sta->sdata, "tx session timer expired on %pM tid %d\n",
+ 	       sta->sta.addr, tid);
+-- 
+2.18.0
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/914-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-skip-command.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/914-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-skip-command.patch
new file mode 100644
index 0000000..2aaf114
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/914-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-skip-command.patch
@@ -0,0 +1,256 @@
+From eca521242b94855825f085d1bca67a5958420baa 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] cfg80211: implement DFS status show, cac and nop skip command
+ via debugfs
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ net/wireless/debugfs.c | 228 +++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 221 insertions(+), 7 deletions(-)
+
+diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
+index aab4346..19c3091 100644
+--- a/net/wireless/debugfs.c
++++ b/net/wireless/debugfs.c
+@@ -95,16 +95,230 @@ static const struct file_operations ht40allow_map_ops = {
+ 	.llseek = default_llseek,
+ };
+ 
+-#define DEBUGFS_ADD(name)						\
+-	debugfs_create_file(#name, 0444, phyd, &rdev->wiphy, &name## _ops)
++static int dfs_print_chan(struct ieee80211_channel *chan, int remain_time,
++			  char *buf, int buf_size, int offset)
++{
++	if (WARN_ON(offset > buf_size))
++		return 0;
++
++	if (chan->dfs_state == NL80211_DFS_UNAVAILABLE) {
++		offset += scnprintf(buf + offset, buf_size - offset,
++				    "	Channel = %d, DFS_state = Unavailable",
++				    chan->hw_value);
++		if (remain_time > 0)
++			offset += scnprintf(buf + offset, buf_size - offset,
++					    ", Non-occupancy Remain Time = %d [sec]\n",
++					    remain_time);
++		else
++			offset += scnprintf(buf + offset, buf_size - offset,
++					    ", Changing state...\n");
++	} else if (chan->dfs_state == NL80211_DFS_USABLE) {
++		offset += scnprintf(buf + offset, buf_size - offset,
++				    "	Channel = %d, DFS_state = Usable",
++				    chan->hw_value);
++		if (remain_time > 0)
++			offset += scnprintf(buf + offset, buf_size - offset,
++					    ", CAC Remain Time = %d [sec]\n",
++					    remain_time);
++		else
++			offset += scnprintf(buf + offset, buf_size - offset,
++					    "\n");
++	} else if (chan->dfs_state == NL80211_DFS_AVAILABLE) {
++		offset += scnprintf(buf + offset, buf_size - offset,
++				    "	Channel = %d, DFS_state = Available\n",
++				    chan->hw_value);
++	} else {
++		offset += scnprintf(buf + offset, buf_size - offset,
++				    "	Channel = %d, DFS_state = Unknown\n",
++				    chan->hw_value);
++	}
++
++	return offset;
++}
++
++static int dfs_status_read_wdev(struct wiphy *wiphy, struct wireless_dev *wdev, char *buf,
++				unsigned int buf_size, unsigned int offset)
++{
++	struct cfg80211_chan_def *chandef;
++	enum nl80211_band band;
++	struct ieee80211_supported_band *sband;
++	struct ieee80211_channel *chan;
++	unsigned long jiffies_passed;
++	int i, remain_time = 0;
++
++	offset += scnprintf(buf + offset, buf_size - offset, "DFS Channel:\n");
++
++	for (band = 0; band < NUM_NL80211_BANDS; band++) {
++		sband = wiphy->bands[band];
++		if (!sband)
++			continue;
++		for (i = 0; i < sband->n_channels; i++) {
++			chan = &sband->channels[i];
++
++			if (!(chan->flags & IEEE80211_CHAN_RADAR))
++				continue;
++
++			if (chan->dfs_state == NL80211_DFS_UNAVAILABLE) {
++				jiffies_passed = jiffies - chan->dfs_state_entered;
++				remain_time = (IEEE80211_DFS_MIN_NOP_TIME_MS -
++					       jiffies_to_msecs(jiffies_passed));
++				if (remain_time > IEEE80211_DFS_MIN_NOP_TIME_MS)
++					remain_time = 0;
++			} else if (chan->dfs_state == NL80211_DFS_USABLE) {
++				chandef = &wdev->chandef;
++				if (wdev->cac_started && cfg80211_is_sub_chan(chandef, chan)) {
++					jiffies_passed = jiffies - wdev->cac_start_time;
++					remain_time = (wdev->cac_time_ms -
++							jiffies_to_msecs(jiffies_passed));
++				}
++				if (remain_time > wdev->cac_time_ms)
++					remain_time = 0;
++			}
++			offset = dfs_print_chan(chan, remain_time / 1000, buf, buf_size, offset);
++			remain_time = 0;
++		}
++	}
++
++	return offset;
++}
++
++static ssize_t dfs_status_read(struct file *file, char __user *user_buf,
++			       size_t count, loff_t *ppos)
++{
++	struct wiphy *wiphy = file->private_data;
++	struct wireless_dev *wdev;
++	char *buf;
++	unsigned int offset = 0, buf_size = PAGE_SIZE, r;
++	const char * const iftype_str[] = {
++		[NL80211_IFTYPE_UNSPECIFIED] = "unspecified",
++		[NL80211_IFTYPE_ADHOC] = "adhoc",
++		[NL80211_IFTYPE_STATION] = "station",
++		[NL80211_IFTYPE_AP] = "ap",
++		[NL80211_IFTYPE_AP_VLAN] = "ap vlan",
++		[NL80211_IFTYPE_WDS] = "wds",
++		[NL80211_IFTYPE_MONITOR] = "monitor",
++		[NL80211_IFTYPE_MESH_POINT] = "mesh point",
++		[NL80211_IFTYPE_P2P_CLIENT] = "p2p client",
++		[NL80211_IFTYPE_P2P_GO] = "p2p go",
++		[NL80211_IFTYPE_P2P_DEVICE] = "p2p device",
++		[NL80211_IFTYPE_OCB] = "ocb",
++		[NL80211_IFTYPE_NAN] = "nan",
++	};
++
++	buf = kzalloc(buf_size, GFP_KERNEL);
++	if (!buf)
++		return -ENOMEM;
++
++	list_for_each_entry(wdev, &wiphy->wdev_list, list) {
++		offset += scnprintf(buf + offset, buf_size - offset,
++				    "wdev 0x%x\n"
++				    "interface type %s\n",
++				    wdev->identifier, iftype_str[wdev->iftype]);
++		offset = dfs_status_read_wdev(wiphy, wdev, buf, buf_size, offset);
++	}
++
++	r = simple_read_from_buffer(user_buf, count, ppos, buf, offset);
++
++	kfree(buf);
++
++	return r;
++}
++
++static const struct file_operations dfs_status_ops = {
++	.read = dfs_status_read,
++	.open = simple_open,
++	.llseek = default_llseek,
++};
++
++static int
++dfs_nop_skip(void *data, u64 val)
++{
++	struct wiphy *wiphy = data;
++	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
++	bool en = !!val;
++	enum nl80211_band band;
++	struct ieee80211_supported_band *sband;
++	struct ieee80211_channel *chan;
++	u32 nop_time = IEEE80211_DFS_MIN_NOP_TIME_MS;
++	int i;
++
++	if (!en)
++		return 0;
++
++	for (band = 0; band < NUM_NL80211_BANDS; band++) {
++		sband = wiphy->bands[band];
++		if (!sband)
++			continue;
++		for (i = 0; i < sband->n_channels; i++) {
++			chan = &sband->channels[i];
++
++			if (!(chan->flags & IEEE80211_CHAN_RADAR))
++				continue;
++
++			if (chan->dfs_state == NL80211_DFS_UNAVAILABLE) {
++				// Let current jiffies > dfs_state_entered_jiffies + NOP time
++				chan->dfs_state_entered = jiffies -
++						       msecs_to_jiffies(nop_time + 1);
++			}
++		}
++	}
++
++	cfg80211_sched_dfs_chan_update(rdev);
++
++	return 0;
++}
++
++DEFINE_DEBUGFS_ATTRIBUTE(dfs_skip_nop_ops, NULL,
++			 dfs_nop_skip, "0x%08llx\n");
++
++static int
++dfs_cac_skip(void *data, u64 val)
++{
++	struct wiphy *wiphy = data;
++	struct wireless_dev *wdev;
++	struct cfg80211_chan_def *chandef;
++	bool en = !!val;
++	struct ieee80211_channel *chan;
++
++	if (!en)
++		return 0;
++
++	list_for_each_entry(wdev, &wiphy->wdev_list, list) {
++		chandef = &wdev->chandef;
++		if (chandef->chan) {
++			chan = chandef->chan;
++			if (!(chan->flags & IEEE80211_CHAN_RADAR))
++				continue;
++
++			if (chan->dfs_state == NL80211_DFS_USABLE && wdev->cac_started) {
++				// Let current jiffies > dfs_state_entered_jiffies + CAC time
++				wdev->cac_start_time = jiffies -
++						       msecs_to_jiffies(wdev->cac_time_ms + 1);
++				cfg80211_cac_event(wdev->netdev, chandef,
++						   NL80211_RADAR_CAC_FINISHED, GFP_KERNEL);
++			}
++		}
++	}
++
++	return 0;
++}
++
++DEFINE_DEBUGFS_ATTRIBUTE(dfs_skip_cac_ops, NULL,
++			 dfs_cac_skip, "0x%08llx\n");
++
++#define DEBUGFS_ADD(name, chmod)						\
++	debugfs_create_file(#name, chmod, phyd, &rdev->wiphy, &name## _ops)
+ 
+ void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev)
+ {
+ 	struct dentry *phyd = rdev->wiphy.debugfsdir;
+ 
+-	DEBUGFS_ADD(rts_threshold);
+-	DEBUGFS_ADD(fragmentation_threshold);
+-	DEBUGFS_ADD(short_retry_limit);
+-	DEBUGFS_ADD(long_retry_limit);
+-	DEBUGFS_ADD(ht40allow_map);
++	DEBUGFS_ADD(rts_threshold, 0444);
++	DEBUGFS_ADD(fragmentation_threshold, 0444);
++	DEBUGFS_ADD(short_retry_limit, 0444);
++	DEBUGFS_ADD(long_retry_limit, 0444);
++	DEBUGFS_ADD(ht40allow_map, 0444);
++	DEBUGFS_ADD(dfs_status, 0444);
++	DEBUGFS_ADD(dfs_skip_nop, 0600);
++	DEBUGFS_ADD(dfs_skip_cac, 0600);
+ }
+-- 
+2.18.0
+
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/915-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-as-1.-This-mo.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/915-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-as-1.-This-mo.patch
new file mode 100644
index 0000000..a9c78aa
--- /dev/null
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/915-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-as-1.-This-mo.patch
@@ -0,0 +1,26 @@
+From 9fc161afbc474cdcc3acaf42d93295d5272afbb4 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] Set TWT Information Frame Disabled bit as 1. This
+ modification means that current implementation do not support twt information
+ frame.
+
+---
+ net/mac80211/s1g.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/mac80211/s1g.c b/net/mac80211/s1g.c
+index 4141bc8..82da404 100644
+--- a/net/mac80211/s1g.c
++++ b/net/mac80211/s1g.c
+@@ -101,6 +101,7 @@ ieee80211_s1g_rx_twt_setup(struct ieee80211_sub_if_data *sdata,
+ 	struct ieee80211_twt_params *twt_agrt = (void *)twt->params;
+ 
+ 	twt_agrt->req_type &= cpu_to_le16(~IEEE80211_TWT_REQTYPE_REQUEST);
++	twt->control |= IEEE80211_TWT_CONTROL_RX_DISABLED;
+ 
+ 	/* broadcast TWT not supported yet */
+ 	if (twt->control & IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST) {
+-- 
+2.18.0
+
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc b/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc
index 2a053de..8ca4824 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/subsys.inc
@@ -38,6 +38,9 @@
     file://340-wifi-mac80211-do-not-abuse-fq.lock-in-ieee80211_do_s.patch \
     file://341-mac80211-Fix-deadlock-Don-t-start-TX-while-holding-f.patch \
     file://342-mac80211-Ensure-vif-queues-are-operational-after-sta.patch \
+    file://343-wifi-mac80211-fix-decap-offload-for-stations-on-AP_V.patch \
+    file://344-wifi-cfg80211-fix-ieee80211_data_to_8023_exthdr-hand.patch \
+    file://345-wifi-mac80211-do-not-drop-packets-smaller-than-the-L.patch \
     file://350-bss-color-collision.patch \
     file://360-mac80211-fix-a-memory-leak-where-sta_info-is-not-fre.patch \
     file://361-wifi-mac80211-Don-t-finalize-CSA-in-IBSS-mode-if-sta.patch \
@@ -46,14 +49,19 @@
     file://500-mac80211_configure_antenna_gain.patch \
     file://782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch \
     file://783-sync-nl80211.patch \
-    file://901-mac80211-check-twt-responder-when-setu-twt.patch \
-    file://902-nl80211-internal-extend-CAC-time-for-weather-radar-c.patch \
-    file://903-mac80211-it-s-invalid-case-when-frag_threshold-is-gr.patch \
-    file://904-mac80211-correct-legacy-rates-check-in-ieee80211_cal.patch \
-    file://905-mac80211-airtime_flags-depends-on-NL80211_EXT_FEATUR.patch \
-    file://906-mac80211-add-support-for-runtime-set-inband-discovery.patch \
-    file://908-mac80211-add-s1g-category-to-_ieee80211_is_robust_mg.patch \
-    file://910-mac80211-offload.patch \
-    file://911-add-fill-receive-path-ops-to-get-wed-idx-v2.patch \
-    file://912-mac80211-make-4addr-null-frames-using-min-rate-for-WDS.patch \
+    file://800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch \
+    file://900-mac80211-mtk-export-del-all-station-for-ampdu-amsdu-on-off-function.patch \
+    file://901-mac80211-mtk-check-twt-responder-when-setu-twt.patch \
+    file://902-nl80211-mtk-internal-extend-CAC-time-for-weather-radar-c.patch \
+    file://903-mac80211-mtk-it-s-invalid-case-when-frag_threshold-is-gr.patch \
+    file://904-mac80211-mtk-correct-legacy-rates-check-in-ieee80211_cal.patch \
+    file://905-mac80211-mtk-airtime_flags-depends-on-NL80211_EXT_FEATUR.patch \
+    file://906-mac80211-mtk-add-support-for-runtime-set-inband-discovery.patch \
+    file://908-mac80211-mtk-add-s1g-category-to-_ieee80211_is_robust_mg.patch \
+    file://910-mac80211-mtk-offload.patch \
+    file://911-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-idx-v2.patch \
+    file://912-mac80211-mtk-make-4addr-null-frames-using-min-rate-for-WDS.patch \
+    file://913-mac80211-mtk-remove-timerout-handle-for-ax210-iot-issue.patch \
+    file://914-cfg80211-mtk-implement-DFS-status-show-cac-and-nop-skip-command.patch \
+    file://915-mac80211-mtk-Set-TWT-Information-Frame-Disabled-bit-as-1.-This-mo.patch \
     "