Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 09/20] wifi: mt76: mt7925: restore the beacon filter when monitor mode ends
Date: Fri, 20 Nov 2026 18:44:48 +0100	[thread overview]
Message-ID: <20261120174459.1657382-9-nbd@nbd.name> (raw)
In-Reply-To: <20261120174459.1657382-1-nbd@nbd.name>

mt7925_sniffer_interface_iter() turns the beacon filter of each running
interface off when monitor mode starts, but not on again when it ends.
An associated station then keeps the filter off while
IEEE80211_VIF_BEACON_FILTER stays set, so mac80211 leaves beacon loss
detection to the device.

When monitor mode ends, turn the filter of each associated station back
on, unless runtime PM is off and a runtime PM write turned the filter
off. Stations that are not associated stay off, since the firmware
expects the filter only after the association.

Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 .../net/wireless/mediatek/mt76/mt7925/main.c  | 41 ++++++++++++-------
 1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 188e3ad06c37..d3b1f5e7850b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -916,29 +916,36 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 }
 
 static void
-mt7925_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
+mt7925_vif_set_beacon_filter(struct mt792x_dev *dev, struct ieee80211_vif *vif,
+			     bool enable)
 {
-	struct mt792x_dev *dev = priv;
 	struct ieee80211_hw *hw = mt76_hw(dev);
-	bool pm_enable;
-	int err;
 
-	mt792x_mutex_acquire(dev);
+	if (mt7925_mcu_set_beacon_filter(dev, vif, enable) < 0)
+		return;
 
-	pm_enable = dev->pm.enable_user &&
-		    !(hw->conf.flags & IEEE80211_CONF_MONITOR);
-	err = mt7925_mcu_set_beacon_filter(dev, vif, pm_enable);
-	if (err < 0)
-		goto out;
-
-	if (pm_enable) {
+	if (enable) {
 		vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
 		ieee80211_hw_set(hw, CONNECTION_MONITOR);
 	} else {
 		vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER;
 		__clear_bit(IEEE80211_HW_CONNECTION_MONITOR, hw->flags);
 	}
-out:
+}
+
+static void
+mt7925_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
+{
+	struct mt792x_dev *dev = priv;
+	struct ieee80211_hw *hw = mt76_hw(dev);
+	bool pm_enable;
+
+	mt792x_mutex_acquire(dev);
+
+	pm_enable = dev->pm.enable_user &&
+		    !(hw->conf.flags & IEEE80211_CONF_MONITOR);
+	mt7925_vif_set_beacon_filter(dev, vif, pm_enable);
+
 	mt792x_mutex_release(dev);
 }
 
@@ -956,8 +963,14 @@ mt7925_sniffer_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
 
 	mt7925_mcu_set_deep_sleep(dev, pm->ds_enable);
 
-	if (monitor)
+	if (monitor) {
 		mt7925_mcu_set_beacon_filter(dev, vif, false);
+		return;
+	}
+
+	if (vif->cfg.assoc &&
+	    (pm->enable || (vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)))
+		mt7925_vif_set_beacon_filter(dev, vif, true);
 }
 
 void mt7925_set_runtime_pm(struct mt792x_dev *dev)
-- 
2.47.3


  parent reply	other threads:[~2026-11-20 17:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 17:44 [PATCH mt76-next 01/20] wifi: mt76: mt7925: free the vif links when all links go Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 02/20] wifi: mt76: mt7925: free removed vif links after an RCU grace period Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 03/20] wifi: mt76: remove a replayed station from the driver before the add Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 04/20] wifi: mt76: mt7925: run the reset link replay under the wiphy lock Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 05/20] wifi: mt76: mt7925: take the mutex before the link_info_changed lookup Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 06/20] wifi: mt76: mt7925: hold the mutex for the link lookup in conf_tx Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 07/20] wifi: mt76: mt7925: skip a polled link without a station Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 08/20] wifi: mt76: mt7925: skip a link without a link conf in the MLO PS update Felix Fietkau
2026-11-20 17:44 ` Felix Fietkau [this message]
2026-11-20 17:44 ` [PATCH mt76-next 10/20] wifi: mt76: usb: do not park the TX worker again under MT76_RESET Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 11/20] wifi: mt76: mt7925: keep the default link in the active links Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 12/20] wifi: mt76: mt7925: read the monitor state under the mutex for deep sleep Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 13/20] wifi: mt76: clear roc_link before the ROC link is freed Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 14/20] wifi: mt76: mt792x: handle all interfaces of a channel context Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 15/20] wifi: mt76: mt792x: set up the sniffer when a monitor gets its channel Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 16/20] wifi: mt76: buffer Disassociation frames for stations in power save Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 17/20] wifi: mt76: mt7921: read the monitor state under the mutex for deep sleep Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 18/20] wifi: mt76: mt7925: wake the device to unassign a channel context Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 19/20] wifi: mt76: mt7996: keep the firmware log settings across a reload Felix Fietkau
2026-11-20 17:44 ` [PATCH mt76-next 20/20] wifi: mt76: mt7915: " Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120174459.1657382-9-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox