Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76 03/15] wifi: mt76: mt7996: decrease timeout for commonly issued MCU commands
Date: Mon, 15 Sep 2025 09:58:58 +0200	[thread overview]
Message-ID: <20250915075910.47558-3-nbd@nbd.name> (raw)
In-Reply-To: <20250915075910.47558-1-nbd@nbd.name>

This allows faster recovery from firmware issues.
Based on patch by Chad Monroe and ported from mt7915.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 .../net/wireless/mediatek/mt76/mt7996/mcu.c   | 26 ++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index 1c89d235026d..29552ab16089 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -242,6 +242,30 @@ mt7996_mcu_parse_response(struct mt76_dev *mdev, int cmd,
 	return ret;
 }
 
+static void
+mt7996_mcu_set_timeout(struct mt76_dev *mdev, int cmd)
+{
+	mdev->mcu.timeout = 5 * HZ;
+
+	if (!(cmd & __MCU_CMD_FIELD_UNI))
+		return;
+
+	switch (FIELD_GET(__MCU_CMD_FIELD_ID, cmd)) {
+	case MCU_UNI_CMD_THERMAL:
+	case MCU_UNI_CMD_TWT:
+	case MCU_UNI_CMD_GET_MIB_INFO:
+	case MCU_UNI_CMD_STA_REC_UPDATE:
+	case MCU_UNI_CMD_BSS_INFO_UPDATE:
+		mdev->mcu.timeout = 2 * HZ;
+		return;
+	case MCU_UNI_CMD_EFUSE_CTRL:
+		mdev->mcu.timeout = 20 * HZ;
+		return;
+	default:
+		break;
+	}
+}
+
 static int
 mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
 			int cmd, int *wait_seq)
@@ -255,7 +279,7 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
 	u32 val;
 	u8 seq;
 
-	mdev->mcu.timeout = 20 * HZ;
+	mt7996_mcu_set_timeout(mdev, cmd);
 
 	seq = ++dev->mt76.mcu.msg_seq & 0xf;
 	if (!seq)
-- 
2.51.0


  parent reply	other threads:[~2025-09-15  7:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15  7:58 [PATCH mt76 01/15] wifi: mt76: mt7996: remove redundant per-phy mac80211 calls during restart Felix Fietkau
2025-09-15  7:58 ` [PATCH mt76 02/15] wifi: mt76: mt7996: improve hardware restart reliability Felix Fietkau
2025-09-15  7:58 ` Felix Fietkau [this message]
2025-09-15  7:58 ` [PATCH mt76 04/15] wifi: mt76: mt7996: fix setting beacon protection keys Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 05/15] wifi: mt76: mt7996: fix memory leak on mt7996_mcu_sta_key_tlv error Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 06/15] wifi: mt76: mt7996: delete vif keys when requested Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 07/15] wifi: mt76: mt7996: fix key add/remove imbalance Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 08/15] wifi: mt76: mt7996: fix updating beacon protection with beacons enabled Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 09/15] wifi: mt76: use altx queue for offchannel tx on connac+ Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 10/15] wifi: mt76: mt7996: disable promiscuous mode by default Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 11/15] wifi: mt76: mt7996: remove the mem_total field of STA_REC_BF command Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 12/15] wifi: mt76: mt7996: set VTA in txwi Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 13/15] wifi: mt76: mt7996: fill User Priority in skb->priority for rx packets Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 14/15] wifi: mt76: improve phy reset on hw restart Felix Fietkau
2025-09-15  7:59 ` [PATCH mt76 15/15] wifi: mt76: abort scan/roc " 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=20250915075910.47558-3-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