mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: mt7915: fix/rewrite the dfs state handling logic
Client mode on DFS channels was broken, because the old code was activating the DFS detector on radar channels while leaving it in CAC state. This was caused by making the decision based on the channel radar flag, instead of hw->conf.radar_enabled. In order to properly deal with the various corner cases, rip out the state handling code and replace it with something that's much easier to reason about. Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+28
@@ -823,6 +823,10 @@ void mt76_set_channel(struct mt76_phy *phy)
|
||||
wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(phy), timeout);
|
||||
mt76_update_survey(phy);
|
||||
|
||||
if (phy->chandef.chan->center_freq != chandef->chan->center_freq ||
|
||||
phy->chandef.width != chandef->width)
|
||||
phy->dfs_state = MT_DFS_STATE_UNKNOWN;
|
||||
|
||||
phy->chandef = *chandef;
|
||||
phy->chan_state = mt76_channel_state(phy, chandef->chan);
|
||||
|
||||
@@ -1604,3 +1608,27 @@ void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
|
||||
wi->worker_stat_count = ei - wi->initial_stat_idx;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_ethtool_worker);
|
||||
|
||||
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))
|
||||
return MT_DFS_STATE_DISABLED;
|
||||
|
||||
if (!hw->conf.radar_enabled) {
|
||||
if ((hw->conf.flags & IEEE80211_CONF_MONITOR) &&
|
||||
(phy->chandef.chan->flags & IEEE80211_CHAN_RADAR))
|
||||
return MT_DFS_STATE_ACTIVE;
|
||||
|
||||
return MT_DFS_STATE_DISABLED;
|
||||
}
|
||||
|
||||
if (phy->chandef.chan->dfs_state != NL80211_DFS_AVAILABLE)
|
||||
return MT_DFS_STATE_CAC;
|
||||
|
||||
return MT_DFS_STATE_ACTIVE;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_phy_dfs_state);
|
||||
|
||||
Reference in New Issue
Block a user