mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-29 03:47:37 +00:00
mt76: mt7615: fix/rewrite the dfs state handling logic
Copy the updated logic from mt7915 to to fix issues in handling DFS radar detector states Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
3f3064486b
commit
2c86f67520
@ -552,7 +552,6 @@ void mt7615_init_device(struct mt7615_dev *dev)
|
|||||||
dev->pm.stats.last_wake_event = jiffies;
|
dev->pm.stats.last_wake_event = jiffies;
|
||||||
dev->pm.stats.last_doze_event = jiffies;
|
dev->pm.stats.last_doze_event = jiffies;
|
||||||
mt7615_cap_dbdc_disable(dev);
|
mt7615_cap_dbdc_disable(dev);
|
||||||
dev->phy.dfs_state = -1;
|
|
||||||
|
|
||||||
#ifdef CONFIG_NL80211_TESTMODE
|
#ifdef CONFIG_NL80211_TESTMODE
|
||||||
dev->mt76.test_ops = &mt7615_testmode_ops;
|
dev->mt76.test_ops = &mt7615_testmode_ops;
|
||||||
|
|||||||
@ -2287,44 +2287,51 @@ mt7615_dfs_init_radar_specs(struct mt7615_phy *phy)
|
|||||||
|
|
||||||
int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy)
|
int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy)
|
||||||
{
|
{
|
||||||
struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
|
|
||||||
struct mt7615_dev *dev = phy->dev;
|
struct mt7615_dev *dev = phy->dev;
|
||||||
bool ext_phy = phy != &dev->phy;
|
bool ext_phy = phy != &dev->phy;
|
||||||
|
enum mt76_dfs_state dfs_state, prev_state;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (is_mt7663(&dev->mt76))
|
if (is_mt7663(&dev->mt76))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (dev->mt76.region == NL80211_DFS_UNSET) {
|
prev_state = phy->mt76->dfs_state;
|
||||||
phy->dfs_state = -1;
|
dfs_state = mt76_phy_dfs_state(phy->mt76);
|
||||||
if (phy->rdd_state)
|
|
||||||
goto stop;
|
|
||||||
|
|
||||||
return 0;
|
if (prev_state == dfs_state)
|
||||||
}
|
|
||||||
|
|
||||||
if (test_bit(MT76_SCANNING, &phy->mt76->state))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (phy->dfs_state == chandef->chan->dfs_state)
|
if (prev_state == MT_DFS_STATE_UNKNOWN)
|
||||||
return 0;
|
mt7615_dfs_stop_radar_detector(phy);
|
||||||
|
|
||||||
err = mt7615_dfs_init_radar_specs(phy);
|
if (dfs_state == MT_DFS_STATE_DISABLED)
|
||||||
if (err < 0) {
|
|
||||||
phy->dfs_state = -1;
|
|
||||||
goto stop;
|
goto stop;
|
||||||
|
|
||||||
|
if (prev_state <= MT_DFS_STATE_DISABLED) {
|
||||||
|
err = mt7615_dfs_init_radar_specs(phy);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = mt7615_dfs_start_radar_detector(phy);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
phy->mt76->dfs_state = MT_DFS_STATE_CAC;
|
||||||
}
|
}
|
||||||
|
|
||||||
phy->dfs_state = chandef->chan->dfs_state;
|
if (dfs_state == MT_DFS_STATE_CAC)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (chandef->chan->flags & IEEE80211_CHAN_RADAR) {
|
err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_CAC_END,
|
||||||
if (chandef->chan->dfs_state != NL80211_DFS_AVAILABLE)
|
ext_phy, MT_RX_SEL0, 0);
|
||||||
return mt7615_dfs_start_radar_detector(phy);
|
if (err < 0) {
|
||||||
|
phy->mt76->dfs_state = MT_DFS_STATE_UNKNOWN;
|
||||||
return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_CAC_END, ext_phy,
|
return err;
|
||||||
MT_RX_SEL0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
phy->mt76->dfs_state = MT_DFS_STATE_ACTIVE;
|
||||||
|
return 0;
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_NORMAL_START, ext_phy,
|
err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_NORMAL_START, ext_phy,
|
||||||
MT_RX_SEL0, 0);
|
MT_RX_SEL0, 0);
|
||||||
@ -2332,6 +2339,8 @@ stop:
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
mt7615_dfs_stop_radar_detector(phy);
|
mt7615_dfs_stop_radar_detector(phy);
|
||||||
|
phy->mt76->dfs_state = MT_DFS_STATE_DISABLED;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user