mt76_phy_dfs_state() gives MT_DFS_STATE_DISABLED while MT76_SCANNING is set, which a software scan holds for its whole length. The scan end sets the operating channel before drv_sw_scan_complete() clears the bit. So a software scan on a DFS channel leaves the radar detector off. A remain-on-channel sets no such bit, so the detector follows the radio to the ROC channel. Give MT_DFS_STATE_DISABLED where the current channel is off the operating chandef, which phy->offchannel records at each channel set. The return to the operating chandef then starts the detector again in the same channel set. On mt7996 the detector now keeps running during a hardware scan dwell on the operating chandef. During a ROC off a DFS channel it is off, until mt76_roc_complete() starts it again. Fixes: 3f3064486b1a ("mt76: mt7915: fix/rewrite the dfs state handling logic") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 3 +-- drivers/net/wireless/mediatek/mt76/scan.c | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 948f9ed26095..e554f2eea7cc 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -2225,8 +2225,7 @@ enum mt76_dfs_state mt76_phy_dfs_state(struct mt76_phy *phy) struct ieee80211_hw *hw = phy->hw; struct mt76_dev *dev = phy->dev; - if (dev->region == NL80211_DFS_UNSET || - test_bit(MT76_SCANNING, &phy->state)) + if (dev->region == NL80211_DFS_UNSET || phy->offchannel) return MT_DFS_STATE_DISABLED; if (!phy->radar_enabled) { diff --git a/drivers/net/wireless/mediatek/mt76/scan.c b/drivers/net/wireless/mediatek/mt76/scan.c index 51b182ee99e2..0a5fea9e7454 100644 --- a/drivers/net/wireless/mediatek/mt76/scan.c +++ b/drivers/net/wireless/mediatek/mt76/scan.c @@ -28,10 +28,6 @@ static void mt76_scan_phy_complete(struct mt76_phy *phy, bool abort) clear_bit(MT76_SCANNING, &phy->state); - /* Re-program the operating channel even when the scan never left it: - * any channel set during the scan ran with MT76_SCANNING held, which - * left DFS radar detection disabled - */ if (phy->main_chandef.chan && !test_bit(MT76_MCU_RESET, &dev->phy.state)) { bool offchannel = phy->offchannel; -- 2.47.3