[][MAC80211][hostapd][core][Config TWT by User]

[Description]
Add user configuration for TWT

[Release-log]
N/A

Change-Id: I1bf85718a48144e24ca1c158441bc1921d4bdf87
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5531443
diff --git a/openwrt_patches-21.02/412-master-mac80211-check-twt-responder-when-setup-twt.patch b/openwrt_patches-21.02/412-master-mac80211-check-twt-responder-when-setup-twt.patch
new file mode 100644
index 0000000..d402f90
--- /dev/null
+++ b/openwrt_patches-21.02/412-master-mac80211-check-twt-responder-when-setup-twt.patch
@@ -0,0 +1,46 @@
+From 27c6b56c3335614299cf1dcf5a8b5320f83f64d5 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Tue, 18 Jan 2022 20:55:44 +0800
+Subject: [PATCH 1/2] mac80211: check twt responder when setup twt
+
+Change-Id: Iee987aaf9e907ea78367c8f1061d05bfacb5c1be
+---
+ ...11-check-twt-responder-when-setu-twt.patch | 26 +++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+ create mode 100644 package/kernel/mac80211/patches/subsys/901-mac80211-check-twt-responder-when-setu-twt.patch
+
+diff --git a/package/kernel/mac80211/patches/subsys/901-mac80211-check-twt-responder-when-setu-twt.patch b/package/kernel/mac80211/patches/subsys/901-mac80211-check-twt-responder-when-setu-twt.patch
+new file mode 100644
+index 0000000..e2f24b4
+--- /dev/null
++++ b/package/kernel/mac80211/patches/subsys/901-mac80211-check-twt-responder-when-setu-twt.patch
+@@ -0,0 +1,26 @@
++From fa2d47980f56462c5767a0ad9537f3e58f5864f4 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] mac80211: do not setup twt when twt responder is false
++
++---
++ net/mac80211/rx.c | 3 +++
++ 1 file changed, 3 insertions(+)
++
++diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
++index 41c3f22..3961270 100644
++--- a/net/mac80211/rx.c
+++++ b/net/mac80211/rx.c
++@@ -3231,6 +3231,9 @@ ieee80211_process_rx_twt_action(struct ieee80211_rx_data *rx)
++ 	if (sdata->vif.type != NL80211_IFTYPE_AP)
++ 		return false;
++ 
+++	if (!sdata->vif.bss_conf.twt_responder)
+++		return false;
+++
++ 	if (!rx->local->ops->add_twt_setup)
++ 		return false;
++ 
++-- 
++2.29.2
++
+-- 
+2.29.2
+