]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: connac: tolerate inactive BSS deactivation
authorSean Wang <sean.wang@mediatek.com>
Sat, 25 Apr 2026 19:50:02 +0000 (14:50 -0500)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 Jun 2026 10:15:21 +0000 (10:15 +0000)
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>
Link: https://patch.msgid.link/20260425195011.790265-13-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c

index ff884697d62f5b00de5bc061faffb0abe73fae84..be0ec1eaa7467b9d097bc2dd2068ee419b105483 100644 (file)
@@ -1232,6 +1232,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;
 
@@ -1239,7 +1242,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);
 
index 552cb94edaa01bb76b235064dd320f9a042d5408..4691b9b5e2be1318669b13e47b52a63a421b065f 100644 (file)
@@ -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);
index db6df9da5b5d78b8305752acd7106f5c41c6b6cc..9a1891c653c0626288c7c27d3d4ef0f1e0c62a77 100644 (file)
@@ -2837,6 +2837,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);
@@ -2862,8 +2863,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,