All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Wang <sean.wang@kernel.org>
To: nbd@nbd.name, lorenzo.bianconi@redhat.com
Cc: linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Sean Wang <sean.wang@mediatek.com>
Subject: [PATCH v5 12/21] wifi: mt76: connac: tolerate inactive BSS deactivation
Date: Sat, 25 Apr 2026 14:50:02 -0500	[thread overview]
Message-ID: <20260425195011.790265-13-sean.wang@kernel.org> (raw)
In-Reply-To: <20260425195011.790265-1-sean.wang@kernel.org>

From: Sean Wang <sean.wang@mediatek.com>

Firmware may return wlan_failure when deactivating a BSS that is already
inactive. This is a valid teardown case and should not fail the remove
path.

Keep activation failures unchanged since they still indicate that firmware
failed to create or activate the BSS state.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 .../wireless/mediatek/mt76/mt76_connac_mcu.c  |  9 +++++++-
 .../wireless/mediatek/mt76/mt76_connac_mcu.h  | 23 +++++++++++++++++++
 .../net/wireless/mediatek/mt76/mt7925/mcu.c   |  6 +++--
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index 2b1c887d6709..0f2d580c7b4a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1227,6 +1227,9 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
 	len = enable ? sizeof(dev_req) : sizeof(basic_req);
 
 	err = mt76_mcu_send_msg(dev, cmd, data, len, true);
+	if (err && cmd == MCU_UNI_CMD(BSS_INFO_UPDATE))
+		err = mt76_connac_mcu_bss_deact_err(dev, err, enable);
+
 	if (err < 0)
 		return err;
 
@@ -1234,7 +1237,11 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
 	data = enable ? (void *)&basic_req : (void *)&dev_req;
 	len = enable ? sizeof(basic_req) : sizeof(dev_req);
 
-	return mt76_mcu_send_msg(dev, cmd, data, len, true);
+	err = mt76_mcu_send_msg(dev, cmd, data, len, true);
+	if (err && cmd == MCU_UNI_CMD(BSS_INFO_UPDATE))
+		err = mt76_connac_mcu_bss_deact_err(dev, err, enable);
+
+	return err;
 }
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_uni_add_dev);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index 552cb94edaa0..4691b9b5e2be 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -1906,6 +1906,29 @@ mt76_connac_mcu_get_wlan_idx(struct mt76_dev *dev, struct mt76_wcid *wcid,
 	}
 }
 
+#define MT76_CONNAC_MCU_STATUS_WLAN_FAILURE	0xc0000001
+
+static inline int
+mt76_connac_mcu_bss_deact_err(struct mt76_dev *mdev, int err, bool enable)
+{
+	if (err != (int)MT76_CONNAC_MCU_STATUS_WLAN_FAILURE)
+		return err;
+
+	/* Ignore wlan_failure state false alarm when deactivating an
+	 * inactive network. It does not harm the firmware state.
+	 */
+	if (!enable) {
+		dev_dbg(mdev->dev,
+			"ignore wlan_failure when bss is deactivated\n");
+		return 0;
+	}
+
+	dev_warn(mdev->dev,
+		 "wlan_failure when bss is activated\n");
+
+	return err;
+}
+
 struct sk_buff *
 __mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif_link *mvif,
 				struct mt76_wcid *wcid, int len);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index f403d9d925e3..b338d6bf02f5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -2832,6 +2832,7 @@ int mt7925_mcu_add_bss_info_sta(struct mt792x_phy *phy,
 	struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
 	struct mt792x_dev *dev = phy->dev;
 	struct sk_buff *skb;
+	int err;
 
 	skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76,
 					 MT7925_BSS_UPDATE_MAX_SIZE);
@@ -2857,8 +2858,9 @@ int mt7925_mcu_add_bss_info_sta(struct mt792x_phy *phy,
 		mt7925_mcu_bss_mbssid_tlv(skb, link_conf, enable);
 	}
 
-	return mt76_mcu_skb_send_msg(&dev->mt76, skb,
-				     MCU_UNI_CMD(BSS_INFO_UPDATE), true);
+	err = mt76_mcu_skb_send_msg(&dev->mt76, skb,
+				    MCU_UNI_CMD(BSS_INFO_UPDATE), true);
+	return mt76_connac_mcu_bss_deact_err(&dev->mt76, err, enable);
 }
 
 int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
-- 
2.43.0



  parent reply	other threads:[~2026-04-25 19:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-25 19:49 [PATCH v5 00/21] wifi: mt76: mt7925: MT7927 (Filogic 380) support Sean Wang
2026-04-25 19:49 ` [PATCH v5 01/21] wifi: mt76: mt7925: fix stale pointer comparisons in change_vif_links Sean Wang
2026-04-25 19:49 ` [PATCH v5 02/21] wifi: mt76: mt7925: add 320MHz bandwidth to bss_rlm_tlv Sean Wang
2026-04-25 19:49 ` [PATCH v5 03/21] wifi: mt76: mt7925: handle 320MHz bandwidth in RXV and TXS Sean Wang
2026-04-25 19:49 ` [PATCH v5 04/21] wifi: mt76: mt7925: populate EHT 320MHz MCS map in sta_rec Sean Wang
2026-04-25 19:49 ` [PATCH v5 05/21] wifi: mt76: mt7925: advertise EHT 320MHz capabilities for 6GHz band Sean Wang
2026-04-25 19:49 ` [PATCH v5 06/21] wifi: mt76: mt7925: add MT7927 chip ID helpers Sean Wang
2026-04-25 19:49 ` [PATCH v5 07/21] wifi: mt76: mt7925: add MT7927 firmware paths Sean Wang
2026-04-25 19:49 ` [PATCH v5 08/21] wifi: mt76: mt7925: use irq_map for chip-specific interrupt handling Sean Wang
2026-04-25 19:49 ` [PATCH v5 09/21] wifi: mt76: mt7925: disable ASPM and runtime PM for MT7927 Sean Wang
2026-04-25 19:50 ` [PATCH v5 10/21] wifi: mt76: connac: replace is_mt7925() with is_connac3() Sean Wang
2026-04-25 19:50 ` [PATCH v5 11/21] wifi: mt76: mt7925: use link-specific removal for non-MLD STA Sean Wang
2026-04-25 19:50 ` Sean Wang [this message]
2026-04-25 19:50 ` [PATCH v5 13/21] wifi: mt76: mt792x: add MT7927 WFSYS reset support Sean Wang
2026-04-25 19:50 ` [PATCH v5 14/21] wifi: mt76: mt792x: factor out common DMA queue allocation Sean Wang
2026-04-25 19:50 ` [PATCH v5 15/21] wifi: mt76: mt7925: switch DMA init to common mt792x queue helpers Sean Wang
2026-04-25 19:50 ` [PATCH v5 16/21] wifi: mt76: mt792x: add MT7927-specific PCIe DMA support Sean Wang
2026-04-25 19:50 ` [PATCH v5 17/21] wifi: mt76: mt7925: sync MT7927 BSS band assignment Sean Wang
2026-04-25 19:50 ` [PATCH v5 18/21] wifi: mt76: mt7925: add MBMC event handling Sean Wang
2026-04-25 19:50 ` [PATCH v5 19/21] wifi: mt76: mt792x: enable CNM ops for MT7927 Sean Wang
2026-04-25 19:50 ` [PATCH v5 20/21] wifi: mt76: mt7925: add MT7927 PCIe support Sean Wang
2026-04-25 19:50 ` [PATCH v5 21/21] wifi: mt76: mt7925: add MT7927 USB support Sean Wang

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=20260425195011.790265-13-sean.wang@kernel.org \
    --to=sean.wang@kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=sean.wang@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.