mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiale Yao <yaojiale02@163.com>
To: Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: stable@vger.kernel.org
Subject: [PATCH 3/4] wifi: mt76: mt7921: unwind interface restore failures
Date: Wed, 28 Oct 2026 13:03:36 +0800	[thread overview]
Message-ID: <20261028050337.127464-4-yaojiale02@163.com> (raw)
In-Reply-To: <20261028050337.127464-1-yaojiale02@163.com>

The reset recovery callback ignores failures while restoring an interface
in firmware and continues issuing per-vif configuration commands. A failed
two-command device addition can leave partial firmware state, while the
following commands operate on an interface that was not restored.

Check the restore result, remove any partially created firmware state and
stop configuring that interface on failure.

Fixes: 0c1ce9884607 ("mt76: mt7921: add wifi reset support")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 6f5e31489e2d..0d19f2d7dd5e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -628,13 +628,23 @@ mt7921_vif_connect_iter(void *priv, u8 *mac,
 	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
 	struct mt792x_dev *dev = mvif->phy->dev;
 	struct ieee80211_hw *hw = mt76_hw(dev);
+	int ret;
 
 	if (vif->type == NL80211_IFTYPE_STATION)
 		ieee80211_disconnect(vif, true);
 
-	mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
-				    &mvif->bss_conf.mt76,
-				    &mvif->sta.deflink.wcid, true);
+	ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+					  &mvif->bss_conf.mt76,
+					   &mvif->sta.deflink.wcid, true);
+	if (ret) {
+		mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+					    &mvif->bss_conf.mt76,
+					    &mvif->sta.deflink.wcid, false);
+		dev_err(dev->mt76.dev,
+			"failed to restore interface after reset: %d\n", ret);
+		return;
+	}
+
 	mt7921_mcu_set_tx(dev, vif);
 
 	if (vif->type == NL80211_IFTYPE_AP) {
-- 
2.34.1


  parent reply	other threads:[~2026-10-28  5:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28  5:03 [PATCH 0/4] wifi: unwind failed interface setup and recovery Jiale Yao
2026-10-28  5:03 ` [PATCH 1/4] wifi: ath10k: clear monitor interface after add failure Jiale Yao
2026-10-28  5:03 ` [PATCH 2/4] wifi: iwlwifi: mvm: clear P2P device pointer on " Jiale Yao
2026-10-28  5:03 ` Jiale Yao [this message]
2026-10-28  5:03 ` [PATCH 4/4] wifi: mt76: mt7925: unwind link restore failures Jiale Yao

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=20261028050337.127464-4-yaojiale02@163.com \
    --to=yaojiale02@163.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=stable@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

all inboxes | Powered by JetHome®