mt7615_mac_set_beacon_filter() sets MT_WF_RFCR_DROP_OTHER_BEACON in the RX filter register when a station interface associates, but not in phy->rxfilter. mt7615_configure_filter() writes phy->rxfilter to the same register as a whole, so the next filter update clears the bit again. mac80211 calls configure_filter right after association (the interface joins its IPv6 multicast groups), so in practice the drop is never in effect, and every beacon from every network on the channel goes to the host. Since commit 7124198ab1a4 ("mt76: mt7615: enable beacon filtering by default for offload fw"), mt7615_configure_filter() keeps the bit as phy->rxfilter has it, but nothing ever put it there. Set and clear the bit in phy->rxfilter as well, including where a beaconing interface comes up. With the bit now kept, set it only while the station is associated, so a disconnected station does not keep dropping beacons, and clear it while mac80211 asks for other BSSs' frames (FIF_OTHER_BSS or FIF_BCN_PRBRESP_PROMISC), as it does for a monitor interface. On an MT7663 SDIO module (mt7663s) associated in a busy 2.4 GHz band, MT_WF_RFCR read back 0x001ce302 (bit 11 clear) and mac80211 processed about 300 beacons a second. With the bit kept, that falls to the associated AP's, and the SDIO host's interrupt rate when idle from about 6200 to 3600 a second. Fixes: 83b9f42aea98 ("mt76: mt7615: enable beacon hw filter for runtime-pm") Signed-off-by: Ryan Brue --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 17 +++++++++++++---- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 4 +++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 3d7128cdca8b..53a5cc48da6e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -2277,14 +2277,23 @@ int mt7615_mac_set_beacon_filter(struct mt7615_phy *phy, if (err) return err; - if (phy->n_beacon_vif) { + if (phy->n_beacon_vif) vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER; - mt76_clear(dev, MT_WF_RFCR(ext_phy), - MT_WF_RFCR_DROP_OTHER_BEACON); - } else { + else vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; + + /* Drop other BSSs' beacons only while associated, and keep + * phy->rxfilter in sync: mt7615_configure_filter() writes it to + * MT_WF_RFCR as a whole. + */ + if (enable && !phy->n_beacon_vif) { + phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_BEACON; mt76_set(dev, MT_WF_RFCR(ext_phy), MT_WF_RFCR_DROP_OTHER_BEACON); + } else { + phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_BEACON; + mt76_clear(dev, MT_WF_RFCR(ext_phy), + MT_WF_RFCR_DROP_OTHER_BEACON); } return 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index a7ffb3af9b9a..cc35880bef92 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -255,6 +255,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw, /* a beaconing vif wants other BSSs' beacons and no runtime PM */ if (mt7615_vif_sends_beacons(vif)) { phy->n_beacon_vif++; + phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_BEACON; mt76_clear(dev, MT_WF_RFCR(ext_phy), MT_WF_RFCR_DROP_OTHER_BEACON); } @@ -539,7 +540,8 @@ static void mt7615_configure_filter(struct ieee80211_hw *hw, MT_WF_RFCR_DROP_UNWANTED_CTL | MT_WF_RFCR_DROP_STBC_MULTI); - if (phy->n_beacon_vif || !mt7615_firmware_offload(dev)) + if (phy->n_beacon_vif || !mt7615_firmware_offload(dev) || + (*total_flags & (FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC))) phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_BEACON; MT76_FILTER(OTHER_BSS, MT_WF_RFCR_DROP_OTHER_TIM | -- 2.56.1