From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 18/20] wifi: mt76: mt7915: keep the TWT state out of the PS flag
Date: Tue, 24 Nov 2026 09:43:07 +0100 [thread overview]
Message-ID: <20261124084309.1981968-18-nbd@nbd.name> (raw)
In-Reply-To: <20261124084309.1981968-1-nbd@nbd.name>
The firmware also sends the PS sync event from its TWT agreement code.
It sends state 1 when an agreement of a station starts, and state 0
when its last agreement ends. mt7915_mcu_rx_ps_sync() writes that state
into MT_WCID_FLAG_PS.
The host thus holds the TX of a TWT station to the PS limit. That lasts
until the agreement ends or a PS leave clears the flag. The end of the
agreement also clears the flag of a station in power save.
The PS limit is the wrong limit for a station that is not in power
save. The WA firmware of mt7986 and mt7981 applies a frame limit of its
own to the station.
Tell the TWT events from the PS events by their path value. Do not
write the TWT state into the flag.
Clear the flag when an agreement starts. The firmware reports no PS
enter of a TWT station, so a flag set before the agreement could stay
set. This matches what mt7996 does for its TWT state.
Fixes: dc930cf883c8 ("wifi: mt76: mt7915: handle MCU PS sync events")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 10 +++++++++-
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h | 11 ++++++++---
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 981135c23723..59042d043481 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -430,7 +430,7 @@ mt7915_mcu_rx_ps_sync(struct mt7915_dev *dev, struct sk_buff *skb)
struct mt7915_mcu_ps_notify_v2 *p2 = (void *)skb->data;
struct mt7915_mcu_ps_notify *p = (void *)skb->data;
struct mt76_wcid *wcid;
- u16 wcid_idx;
+ u16 wcid_idx, path;
bool v2, ps;
/* the mt7986 and mt7981 firmware send the longer v2 layout */
@@ -443,15 +443,23 @@ mt7915_mcu_rx_ps_sync(struct mt7915_dev *dev, struct sk_buff *skb)
wcid_idx = le16_to_cpu(p2->wtbl_lower) |
(le16_to_cpu(p2->wtbl_higher) << 8);
ps = p2->ps_bit;
+ path = le16_to_cpu(p2->path);
} else {
wcid_idx = p->wtbl_lower | (p->wtbl_higher << 8);
ps = p->ps_bit;
+ path = p->path;
}
wcid = mt76_wcid_ptr(dev, wcid_idx);
if (!wcid || !wcid_to_sta(wcid))
return;
+ if (path == MT7915_PS_SYNC_TWT || path == MT7915_PS_SYNC_TWT_MANY) {
+ if (ps)
+ mt76_sta_ps_transition(&dev->mt76, wcid, false);
+ return;
+ }
+
mt76_sta_ps_transition(&dev->mt76, wcid, ps);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
index 456c452e07c1..175136dfafff 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
@@ -65,7 +65,7 @@ struct mt7915_mcu_ps_notify {
u8 wtbl_lower;
u8 ps_bit;
u8 wtbl_higher;
- u8 rsv;
+ u8 path;
} __packed;
struct mt7915_mcu_ps_notify_v2 {
@@ -73,11 +73,16 @@ struct mt7915_mcu_ps_notify_v2 {
__le16 wtbl_lower;
__le16 wtbl_higher;
- __le16 rsv;
+ __le16 path;
u8 ps_bit;
- u8 rsv2;
+ u8 rsv;
} __packed;
+enum {
+ MT7915_PS_SYNC_TWT_MANY = 0x08,
+ MT7915_PS_SYNC_TWT = 0x80,
+};
+
struct mt7915_mcu_rdd_report {
struct mt76_connac2_mcu_rxd_hdr rxd;
--
2.47.3
next prev 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 ` Felix Fietkau [this message]
2026-11-24 8:43 ` [PATCH mt76-next 19/20] wifi: mt76: mt7915: clear the PS flag of a station at a reset Felix Fietkau
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-18-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