blob: 593e1b60e05def3ffb1f38af295c82f1374e9fcd [file] [log] [blame]
From b77ddf219b289e76985dd4cd7795e75eda12c195 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 16 Nov 2023 14:41:54 +0800
Subject: [PATCH 07/14] wifi: mt76: mt7915: add post channel switch for DFS
channel switching
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
mt7915/main.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
index 61a1dbb0..71e0d55f 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -736,6 +736,27 @@ mt7915_channel_switch_beacon(struct ieee80211_hw *hw,
mutex_unlock(&dev->mt76.mutex);
}
+static int
+mt7915_post_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
+ struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
+ int ret;
+
+ ret = cfg80211_chandef_dfs_required(hw->wiphy, chandef, NL80211_IFTYPE_AP);
+ if (ret <= 0)
+ goto out;
+
+ ieee80211_stop_queues(hw);
+ ret = mt7915_set_channel(phy);
+ if (ret)
+ goto out;
+ ieee80211_wake_queues(hw);
+
+out:
+ return ret;
+}
+
int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
@@ -1701,6 +1722,7 @@ const struct ieee80211_ops mt7915_ops = {
.get_txpower = mt76_get_txpower,
.set_sar_specs = mt7915_set_sar_specs,
.channel_switch_beacon = mt7915_channel_switch_beacon,
+ .post_channel_switch = mt7915_post_channel_switch,
.get_stats = mt7915_get_stats,
.get_et_sset_count = mt7915_get_et_sset_count,
.get_et_stats = mt7915_get_et_stats,
--
2.18.0