[][MAC80211][WiFi6][mt76][Fix STA channel switch reason during auth/assoc for DFS channel]
[Description]
Fix STA channel switch reason during auth/assoc for DFS channel
[Release-log]
N/A
Change-Id: If9db692acacce1ae0c7bc8d99df7a94158e2d27c
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8832150
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/1055-wifi-mt76-mt7915-set-channel-after-sta-is-associated.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/1055-wifi-mt76-mt7915-set-channel-after-sta-is-associated.patch
new file mode 100644
index 0000000..6153cdf
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/1055-wifi-mt76-mt7915-set-channel-after-sta-is-associated.patch
@@ -0,0 +1,64 @@
+From be32df6be97cc2ffdbaa304d37c2a1f169c756e0 Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Thu, 21 Mar 2024 16:52:34 +0800
+Subject: [PATCH] wifi: mt76: mt7915: set channel after sta is associated to
+ adjust switch reason
+
+when sta is associated to AP operating in DFS channel, a channel
+setting operation is required to change the channel switch reason
+from CH_SWTICH_DFS to CH_SWITCH_NORMAL.
+Note that the switch reason for DFS channel during authentication is
+CH_SWITCH_DFS since the DFS state is still USABLE at that point
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ mt7915/main.c | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 69fcf4c..41fa450 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -792,6 +792,31 @@ out:
+ return ret;
+ }
+
++static void
++mt7915_event_callback(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ const struct ieee80211_event *event)
++{
++ struct mt7915_phy *phy = mt7915_hw_phy(hw);
++ int ret;
++
++ switch (event->type) {
++ case MLME_EVENT:
++ if (event->u.mlme.data == ASSOC_EVENT &&
++ event->u.mlme.status == MLME_SUCCESS) {
++ ieee80211_stop_queues(hw);
++ ret = mt7915_set_channel(phy);
++ if (ret)
++ return;
++ ieee80211_wake_queues(hw);
++ }
++ break;
++ default:
++ break;
++ }
++
++ return;
++}
++
+ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+ {
+@@ -1771,6 +1796,7 @@ const struct ieee80211_ops mt7915_ops = {
+ .set_sar_specs = mt7915_set_sar_specs,
+ .channel_switch_beacon = mt7915_channel_switch_beacon,
+ .post_channel_switch = mt7915_post_channel_switch,
++ .event_callback = mt7915_event_callback,
+ .get_stats = mt7915_get_stats,
+ .get_et_sset_count = mt7915_get_et_sset_count,
+ .get_et_stats = mt7915_get_et_stats,
+--
+2.18.0
+