From: Sean Wang <sean.wang@xxxxxxxxxxxx> IEEE80211_CONF_CHANGE_MONITOR would be set every time even when vif runs as sta mode. If vif runs as sta mode, the beacon filter would be falsely enabled earlier than the associated state. That is not the behavior the firmware expects and also breaks the original logic of sta mode. Thus, we only limit the operation to set the beacon filter only for monitor mode when IEEE80211_CONF_CHANGE_MONITOR is set. Fixes: 4ad65a54617c ("mt76: mt7921: toggle runtime-pm adding a monitor vif") Signed-off-by: Sean Wang <sean.wang@xxxxxxxxxxxx> --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index e5dcf1615f17..cfa813bd627a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -484,9 +484,17 @@ mt7921_sniffer_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) { struct mt7921_dev *dev = priv; struct ieee80211_hw *hw = mt76_hw(dev); - bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); + struct mt76_connac_pm *pm = &dev->pm; + bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); + + mt7921_mcu_set_sniffer(dev, vif, monitor); + pm->enable = !monitor; + pm->ds_enable = !monitor; + + mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable); - mt7921_mcu_set_sniffer(dev, vif, enabled); + if (monitor) + mt7921_mcu_set_beacon_filter(dev, vif, false); } void mt7921_set_runtime_pm(struct mt7921_dev *dev) @@ -530,7 +538,6 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed) IEEE80211_IFACE_ITER_RESUME_ALL, mt7921_sniffer_interface_iter, dev); dev->mt76.rxfilter = mt76_rr(dev, MT_WF_RFCR(0)); - mt7921_set_runtime_pm(dev); } out: -- 2.25.1