blob: cd106e833f7659862ecc5a6d4ddb05adb9379723 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 7b2e80bf62f10469992b8e08c801e9b64f7c775d Mon Sep 17 00:00:00 2001
2From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Wed, 21 Feb 2024 13:41:23 +0800
4Subject: [PATCH 143/199] mtk: mt76: mt7996: add post channel switch for DFS
5 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
20index cc696a69..0ee2acfb 100644
21--- 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
32index 4f3b0070..c8259b86 100644
33--- 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,
57@@ -2791,6 +2806,7 @@ const struct ieee80211_ops mt7996_ops = {
58 .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--
662.18.0
67