blob: 421aa7022c96927e0176fa0407e2afc04d5c5b0f [file] [log] [blame]
developerd0c89452024-10-11 16:53:27 +08001From 00ef78d4d0738e36f529950b754e0042bdd57a68 Mon Sep 17 00:00:00 2001
developer05f3b2b2024-08-19 19:17:34 +08002From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Wed, 21 Feb 2024 13:41:23 +0800
developerd0c89452024-10-11 16:53:27 +08004Subject: [PATCH 131/223] mtk: mt76: mt7996: add post channel switch for DFS
developer05f3b2b2024-08-19 19:17:34 +08005 channel switching
6
7Add post channel switch callback for DFS channel switch support
8After CAC, we need to set channel again for DFS RDD (notify to change
9state from cac to active)
10Add IEEE80211_HW_HANDLE_QUIET_CSA flag to avoid stopping the entire vif TX
11queue when csa_blocked_tx is raised especially for DFS channel switch.
12
13Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
14---
15 mt7996/init.c | 1 +
16 mt7996/main.c | 16 ++++++++++++++++
17 2 files changed, 17 insertions(+)
18
19diff --git a/mt7996/init.c b/mt7996/init.c
developerd0c89452024-10-11 16:53:27 +080020index 001f0d9c..420c23c9 100644
developer05f3b2b2024-08-19 19:17:34 +080021--- a/mt7996/init.c
22+++ b/mt7996/init.c
23@@ -451,6 +451,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
24 ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
25 ieee80211_hw_set(hw, CHANCTX_STA_CSA);
26 ieee80211_hw_set(hw, CONNECTION_MONITOR);
27+ ieee80211_hw_set(hw, HANDLES_QUIET_CSA);
28
29 hw->max_tx_fragments = 4;
30
31diff --git a/mt7996/main.c b/mt7996/main.c
developerd0c89452024-10-11 16:53:27 +080032index 2b272cc4..485c87f9 100644
developer05f3b2b2024-08-19 19:17:34 +080033--- a/mt7996/main.c
34+++ b/mt7996/main.c
35@@ -1078,6 +1078,21 @@ fail:
36 mutex_unlock(&dev->mt76.mutex);
37 }
38
39+static int
40+mt7996_post_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
41+ struct ieee80211_bss_conf *link_conf)
42+{
43+ struct cfg80211_chan_def *chandef = &link_conf->chanreq.oper;
44+ struct mt7996_phy *phy = mt7996_band_phy(hw, chandef->chan->band);
45+ int ret;
46+
47+ ret = cfg80211_chandef_dfs_required(hw->wiphy, chandef, NL80211_IFTYPE_AP);
48+ if (ret <= 0)
49+ return ret;
50+
51+ return mt7996_set_channel(phy, chandef);
52+}
53+
54 static void mt7996_remove_link_sta(struct mt7996_dev *dev,
55 struct ieee80211_bss_conf *conf,
56 struct mt7996_bss_conf *mconf,
developerd0c89452024-10-11 16:53:27 +080057@@ -2795,6 +2810,7 @@ const struct ieee80211_ops mt7996_ops = {
developer05f3b2b2024-08-19 19:17:34 +080058 .release_buffered_frames = mt76_release_buffered_frames,
59 .get_txpower = mt7996_get_txpower,
60 .channel_switch_beacon = mt7996_channel_switch_beacon,
61+ .post_channel_switch = mt7996_post_channel_switch,
62 .get_stats = mt7996_get_stats,
63 .get_et_sset_count = mt7996_get_et_sset_count,
64 .get_et_stats = mt7996_get_et_stats,
65--
developerd0c89452024-10-11 16:53:27 +0800662.45.2
developer05f3b2b2024-08-19 19:17:34 +080067