Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 14/20] wifi: mt76: mt7915: publish the global wcid again after a full reset
Date: Thu, 19 Nov 2026 13:43:46 +0100	[thread overview]
Message-ID: <20261119124352.1842164-14-nbd@nbd.name> (raw)
In-Reply-To: <20261119124352.1842164-1-nbd@nbd.name>

After a full reset, dev->wcid[] no longer holds the global wcid.
mt76_reset_device() unpublishes it with every other wcid, and
mt7915_mac_full_reset() only allocates its index again. A frame on the
global wcid that requests a TX status then reports no ACK, since
mt76_tx_status_skb_add() does not find the wcid in dev->wcid[].

Set up the global wcid in the full reset as at probe time.

Fixes: 065c79df595a ("wifi: mt76: mt7915: fix list corruption after hardware restart")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 .../net/wireless/mediatek/mt76/mt7915/init.c  | 29 +++++++++++--------
 .../net/wireless/mediatek/mt76/mt7915/mac.c   |  3 +-
 .../wireless/mediatek/mt76/mt7915/mt7915.h    |  1 +
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 358c45acf79b..6d09718ec585 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -865,10 +865,25 @@ static bool mt7915_band_config(struct mt7915_dev *dev)
 	return ret;
 }
 
+int mt7915_global_wcid_init(struct mt7915_dev *dev)
+{
+	int idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
+
+	if (idx)
+		return -ENOSPC;
+
+	dev->mt76.global_wcid.idx = idx;
+	dev->mt76.global_wcid.hw_key_idx = -1;
+	dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET;
+	rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid);
+
+	return 0;
+}
+
 static int
 mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
 {
-	int ret, idx;
+	int ret;
 
 	mt76_wr(dev, MT_INT_MASK_CSR, 0);
 	mt76_wr(dev, MT_INT_SOURCE_CSR, ~0);
@@ -895,17 +910,7 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
 			return ret;
 	}
 
-	/* Beacon and mgmt frames should occupy wcid 0 */
-	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
-	if (idx)
-		return -ENOSPC;
-
-	dev->mt76.global_wcid.idx = idx;
-	dev->mt76.global_wcid.hw_key_idx = -1;
-	dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET;
-	rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid);
-
-	return 0;
+	return mt7915_global_wcid_init(dev);
 }
 
 void mt7915_set_stream_vht_txbf_caps(struct mt7915_phy *phy)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 6e2b26017692..0c03199a55a4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1487,8 +1487,7 @@ mt7915_mac_full_reset(struct mt7915_dev *dev)
 	dev->twt.table_mask = 0;
 	dev->twt.n_agrt = 0;
 
-	i = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
-	dev->mt76.global_wcid.idx = i;
+	mt7915_global_wcid_init(dev);
 	dev->recovery.hw_full_reset = false;
 
 	mutex_unlock(&dev->mt76.mutex);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
index ec1d10832b27..1a0aeed5073e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
@@ -455,6 +455,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
 
 int mt7915_register_device(struct mt7915_dev *dev);
 void mt7915_unregister_device(struct mt7915_dev *dev);
+int mt7915_global_wcid_init(struct mt7915_dev *dev);
 int mt7915_eeprom_init(struct mt7915_dev *dev);
 void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
 				struct mt7915_phy *phy);
-- 
2.47.3


  parent reply	other threads:[~2026-11-19 12:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 12:43 [PATCH mt76-next 01/20] wifi: mt76: mt7921: skip the ND offload update of a vif not in the driver Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 02/20] wifi: mt76: mt7925: " Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 03/20] wifi: mt76: take the remaining wcids off the phy tx_list at reset Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 04/20] wifi: mt76: take the remaining wcids off sta_poll_list " Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 05/20] wifi: mt76: mt7915: take the remaining stations off sta_rc_list " Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 06/20] wifi: mt76: mt7996: list only published links on sta_rc_list Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 07/20] wifi: mt76: mt7996: take the remaining links off sta_rc_list at reset Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 08/20] wifi: mt76: mt7915: take the TWT flows of a removed station off twt_list Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 09/20] wifi: mt76: mt7996: " Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 10/20] wifi: mt76: mt7915: drop the TWT agreements at a full reset Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 11/20] wifi: mt76: mt7996: " Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 12/20] wifi: mt76: mt7915: read twt_list under the mutex in twt_stats Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 13/20] wifi: mt76: mt7996: " Felix Fietkau
2026-11-19 12:43 ` Felix Fietkau [this message]
2026-11-19 12:43 ` [PATCH mt76-next 15/20] wifi: mt76: mt7996: publish the global wcid again after a full reset Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 16/20] wifi: mt76: mt7925: keep the antenna mask across a firmware reload Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 17/20] wifi: mt76: mt7925: remove mt7925_mcu_del_dev() Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 18/20] wifi: mt76: mt7921: keep the antenna mask across a firmware reload Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 19/20] wifi: mt76: mt792x: flush frames that still wait for the TX worker Felix Fietkau
2026-11-19 12:43 ` [PATCH mt76-next 20/20] wifi: mt76: mt7925: send the deauth of an MLD station on its AC queue 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=20261119124352.1842164-14-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