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 19/20] wifi: mt76: mt7915: clear the PS flag of a station at a reset
Date: Tue, 24 Nov 2026 09:43:08 +0100	[thread overview]
Message-ID: <20261124084309.1981968-19-nbd@nbd.name> (raw)
In-Reply-To: <20261124084309.1981968-1-nbd@nbd.name>

MT_WCID_FLAG_PS survives a full reset. The replay of a station keeps
wcid->flags. The reloaded firmware holds no PS state and reports no
leave when the station wakes.

The station then gets one frame per AC per TX status until its next
enter and leave. The L1 branch of the reset work writes no flag either.

Clear the flag when a station is added, like mt7996_mac_sta_init_link()
does. Also clear it for every station at the end of an L1 recovery,
like mt7996_mac_reset_sta_ps(). A station that still sleeps gets a new
enter from the firmware.

Fixes: dc930cf883c8 ("wifi: mt76: mt7915: handle MCU PS sync events")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 .../net/wireless/mediatek/mt76/mt7915/mac.c   | 20 +++++++++++++++++++
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  1 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index cc3ef641d1c1..84f75526da58 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1511,6 +1511,24 @@ mt7915_mac_full_reset(struct mt7915_dev *dev)
 		ieee80211_restart_hw(ext_phy->hw);
 }
 
+static void
+mt7915_mac_reset_sta_ps(struct mt7915_dev *dev)
+{
+	int i;
+
+	rcu_read_lock();
+	for (i = 0; i < ARRAY_SIZE(dev->mt76.wcid); i++) {
+		struct mt76_wcid *wcid = mt76_wcid_ptr(dev, i);
+
+		if (!wcid_to_sta(wcid) ||
+		    !test_bit(MT_WCID_FLAG_PS, &wcid->flags))
+			continue;
+
+		mt76_sta_ps_transition(&dev->mt76, wcid, false);
+	}
+	rcu_read_unlock();
+}
+
 static void
 mt7915_mac_reset_napi_enable(struct mt7915_dev *dev)
 {
@@ -1641,6 +1659,8 @@ void mt7915_mac_reset_work(struct work_struct *work)
 	if (!mt7915_wait_reset_state(dev, MT_MCU_CMD_NORMAL_STATE))
 		goto abort;
 
+	mt7915_mac_reset_sta_ps(dev);
+
 	/* enable DMA Tx/Rx and interrupt */
 	mt7915_dma_start(dev, false, false);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index 47796e0fa506..50e67a209693 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -759,6 +759,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 	msta->wcid.idx = idx;
 	msta->wcid.phy_idx = ext_phy;
 	msta->jiffies = jiffies;
+	clear_bit(MT_WCID_FLAG_PS, &msta->wcid.flags);
 
 	if (sta->tdls)
 		set_bit(MT_WCID_FLAG_TDLS_PEER, &msta->wcid.flags);
-- 
2.47.3


  parent reply	other threads:[~2026-11-24  8:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  8:42 [PATCH mt76-next 01/20] wifi: mt76: mt7915: dump the firmware memory of mt7916 Felix Fietkau
2026-11-24  8:42 ` [PATCH mt76-next 02/20] wifi: mt76: mt7915: set the LED GPIO mux " Felix Fietkau
2026-11-24  8:53   ` Lorenzo Bianconi
2026-11-24  8:42 ` [PATCH mt76-next 03/20] wifi: mt76: fail an MCU command started during an MCU reset Felix Fietkau
2026-11-24  8:54   ` Lorenzo Bianconi
2026-11-24  8:42 ` [PATCH mt76-next 04/20] wifi: mt76: mark an MCU command that only reads Felix Fietkau
2026-11-24  8:42 ` [PATCH mt76-next 05/20] wifi: mt76: retry only an MCU command that reads Felix Fietkau
2026-11-24  8:42 ` [PATCH mt76-next 06/20] wifi: mt76: report an MCU command whose outcome is unknown Felix Fietkau
2026-11-24  8:42 ` [PATCH mt76-next 07/20] wifi: mt76: mt7996: mark the MCU commands that only read Felix Fietkau
2026-11-24  8:42 ` [PATCH mt76-next 08/20] wifi: mt76: mt7996: reset after an MCU reset lost a state command Felix Fietkau
2026-11-24  8:42 ` [PATCH mt76-next 09/20] wifi: mt76: mt7915: mark the MCU commands that only read Felix Fietkau
2026-11-24  8:42 ` [PATCH mt76-next 10/20] wifi: mt76: mt7915: hold the device mutex in the rate control work Felix Fietkau
2026-11-24  8:56   ` Lorenzo Bianconi
2026-11-24  8:43 ` [PATCH mt76-next 11/20] wifi: mt76: mt7915: hold the device mutex in the station and regd updates Felix Fietkau
2026-11-24  8:58   ` Lorenzo Bianconi
2026-11-24  8:43 ` [PATCH mt76-next 12/20] wifi: mt76: mt7915: reset after an MCU reset lost a state command Felix Fietkau
2026-11-24  8:43 ` [PATCH mt76-next 13/20] wifi: mt76: mt7996: clear the PS state of stations at a reset Felix Fietkau
2026-11-24  8:43 ` [PATCH mt76-next 14/20] wifi: mt76: mt7996: apply the PS sync bitmap to MLD stations alone Felix Fietkau
2026-11-24  8:43 ` [PATCH mt76-next 15/20] wifi: mt76: mt7996: keep the TWT state out of the PS flag Felix Fietkau
2026-11-24  8:43 ` [PATCH mt76-next 16/20] wifi: mt76: mt7996: read the TSF twice against the firmware's latch Felix Fietkau
2026-11-24  8:43 ` [PATCH mt76-next 17/20] wifi: mt76: mt7996: check a TSF write " Felix Fietkau
2026-11-24  8:43 ` [PATCH mt76-next 18/20] wifi: mt76: mt7915: keep the TWT state out of the PS flag Felix Fietkau
2026-11-24  8:43 ` Felix Fietkau [this message]
2026-11-24  8:43 ` [PATCH mt76-next 20/20] wifi: mt76: mt7996: set the default link again when a link is reused Felix Fietkau
2026-11-24  8:53 ` [PATCH mt76-next 01/20] wifi: mt76: mt7915: dump the firmware memory of mt7916 Lorenzo Bianconi

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=20261124084309.1981968-19-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