wifi: mt76: mt7996: fix issues with manually triggered radar detection

Disallow triggering radar detection on non-DFS channels to prevent paused
TX queues from failing to resume, as a channel switch is not performed in
this case.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260312095724.2117448-6-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
StanleyYP Wang 2026-03-12 17:57:24 +08:00 committed by Felix Fietkau
parent 9eeea2984c
commit fc4533b5db

View File

@ -226,14 +226,23 @@ mt7996_radar_trigger(void *data, u64 val)
#define RADAR_BACKGROUND 2
struct mt7996_dev *dev = data;
struct mt7996_phy *phy = mt7996_band_phy(dev, NL80211_BAND_5GHZ);
int rdd_idx;
struct cfg80211_chan_def *chandef;
int rdd_idx, ret;
if (!phy || !val || val > RADAR_BACKGROUND)
return -EINVAL;
if (val == RADAR_BACKGROUND && !dev->rdd2_phy) {
dev_err(dev->mt76.dev, "Background radar is not enabled\n");
return -EINVAL;
if (test_bit(MT76_SCANNING, &phy->mt76->state))
return -EBUSY;
if (val == RADAR_BACKGROUND) {
if (!dev->rdd2_phy || !cfg80211_chandef_valid(&dev->rdd2_chandef)) {
dev_err(dev->mt76.dev, "Background radar is not enabled\n");
return -EINVAL;
}
chandef = &dev->rdd2_chandef;
} else {
chandef = &phy->mt76->chandef;
}
rdd_idx = mt7996_get_rdd_idx(phy, val == RADAR_BACKGROUND);
@ -242,6 +251,11 @@ mt7996_radar_trigger(void *data, u64 val)
return -EINVAL;
}
ret = cfg80211_chandef_dfs_required(dev->mt76.hw->wiphy, chandef,
NL80211_IFTYPE_AP);
if (ret <= 0)
return ret;
return mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE, rdd_idx, 0);
}