[PATCH 1/4] wifi: mt76: mt7615: count beaconing interfaces again
From: Ryan Brue
Date: Mon Nov 30 2026 - 12:34:32 EST
phy->n_beacon_vif is meant to count the AP, mesh and IBSS interfaces.
When a station associates, mt7615_mac_set_beacon_filter() leaves the
firmware's BSS power save and the other-BSS beacon drop in MT_WF_RFCR
off if one is up, and debugfs refuses to enable runtime PM while one is.
It was counted in mt7615_mac_set_beacon_filter(), called from
add/remove_interface, until commit 4bec61d9fb96 ("mt76: mt7663: fix when
beacon filter is being applied") moved that call to BSS_CHANGED_ASSOC,
which only station interfaces get. The count has stayed 0 since: with an
AP up, debugfs turns runtime PM on and off freely (seen on an mt7663s
with a NetworkManager hotspot).
Count the beaconing interfaces in add/remove_interface again, without
the beacon filter MCU command that commit moved away, and clear the
beacon drop when one comes up. A station that is already associated
keeps its power save settings until it reassociates.
Fixes: 4bec61d9fb96 ("mt76: mt7663: fix when beacon filter is being applied")
Signed-off-by: Ryan Brue <ryanbrue.dev@xxxxxxxxx>
---
drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 15 ---------------
drivers/net/wireless/mediatek/mt76/mt7615/main.c | 24 ++++++++++++++++++++++++
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index aad232c5a6fa..3d7128cdca8b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -2273,21 +2273,6 @@ int mt7615_mac_set_beacon_filter(struct mt7615_phy *phy,
if (!mt7615_firmware_offload(dev))
return -EOPNOTSUPP;
- switch (vif->type) {
- case NL80211_IFTYPE_MONITOR:
- return 0;
- case NL80211_IFTYPE_MESH_POINT:
- case NL80211_IFTYPE_ADHOC:
- case NL80211_IFTYPE_AP:
- if (enable)
- phy->n_beacon_vif++;
- else
- phy->n_beacon_vif--;
- fallthrough;
- default:
- break;
- }
-
err = mt7615_mcu_set_bss_pm(dev, vif, !phy->n_beacon_vif);
if (err)
return err;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 175e847f49ef..a7ffb3af9b9a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -176,6 +176,18 @@ static int get_omac_idx(enum nl80211_iftype type, u64 mask)
return -1;
}
+static bool mt7615_vif_sends_beacons(struct ieee80211_vif *vif)
+{
+ switch (vif->type) {
+ case NL80211_IFTYPE_AP:
+ case NL80211_IFTYPE_MESH_POINT:
+ case NL80211_IFTYPE_ADHOC:
+ return true;
+ default:
+ return false;
+ }
+}
+
static int mt7615_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
@@ -237,6 +249,15 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
}
ret = mt7615_mcu_add_dev_info(phy, vif, true);
+ if (ret)
+ goto out;
+
+ /* a beaconing vif wants other BSSs' beacons and no runtime PM */
+ if (mt7615_vif_sends_beacons(vif)) {
+ phy->n_beacon_vif++;
+ mt76_clear(dev, MT_WF_RFCR(ext_phy),
+ MT_WF_RFCR_DROP_OTHER_BEACON);
+ }
out:
mt7615_mutex_release(dev);
@@ -267,6 +288,9 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,
mt7615_mcu_add_dev_info(phy, vif, false);
+ if (mt7615_vif_sends_beacons(vif))
+ phy->n_beacon_vif--;
+
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx);
--
2.56.1