wifi: mt76: mt7996: improve hardware restart reliability

Port latest version of similar changes from mt7915:
- use reconfig_complete to restart mac_work / queues
- reset full wtbl after firmware init
- clear wcid and vif mask to avoid leak
- fix sta poll list corruption
- clear rro list

Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2025-09-09 18:09:50 +02:00
parent a4d6f193be
commit ffda443265
3 changed files with 44 additions and 7 deletions
+28 -7
View File
@@ -2360,6 +2360,7 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
{
struct ieee80211_hw *hw = mt76_hw(dev);
struct mt7996_phy *phy;
LIST_HEAD(list);
int i;
dev->recovery.hw_full_reset = true;
@@ -2376,18 +2377,38 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)
if (!mt7996_mac_restart(dev))
break;
}
mutex_unlock(&dev->mt76.mutex);
if (i == 10)
dev_err(dev->mt76.dev, "chip full reset failed\n");
ieee80211_restart_hw(mt76_hw(dev));
ieee80211_wake_queues(mt76_hw(dev));
dev->recovery.hw_full_reset = false;
mt7996_for_each_phy(dev, phy)
ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
MT7996_WATCHDOG_TIME);
phy->omac_mask = 0;
mt76_reset_device(&dev->mt76);
INIT_LIST_HEAD(&dev->sta_rc_list);
INIT_LIST_HEAD(&dev->twt_list);
spin_lock_bh(&dev->wed_rro.lock);
list_splice_init(&dev->wed_rro.poll_list, &list);
spin_unlock_bh(&dev->wed_rro.lock);
while (!list_empty(&list)) {
struct mt7996_wed_rro_session_id *e;
e = list_first_entry(&list, struct mt7996_wed_rro_session_id,
list);
list_del_init(&e->list);
kfree(e);
}
i = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA);
dev->mt76.global_wcid.idx = i;
dev->recovery.hw_full_reset = false;
mutex_unlock(&dev->mt76.mutex);
ieee80211_restart_hw(mt76_hw(dev));
}
void mt7996_mac_reset_work(struct work_struct *work)
+14
View File
@@ -2202,6 +2202,19 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return 0;
}
static void
mt7996_reconfig_complete(struct ieee80211_hw *hw,
enum ieee80211_reconfig_type reconfig_type)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy;
ieee80211_wake_queues(hw);
mt7996_for_each_phy(dev, phy)
ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
MT7996_WATCHDOG_TIME);
}
const struct ieee80211_ops mt7996_ops = {
.add_chanctx = mt76_add_chanctx,
.remove_chanctx = mt76_remove_chanctx,
@@ -2260,4 +2273,5 @@ const struct ieee80211_ops mt7996_ops = {
#endif
.change_vif_links = mt7996_change_vif_links,
.change_sta_links = mt7996_mac_sta_change_links,
.reconfig_complete = mt7996_reconfig_complete,
};
+2
View File
@@ -3390,6 +3390,8 @@ int mt7996_mcu_init_firmware(struct mt7996_dev *dev)
return ret;
}
mt76_connac_mcu_del_wtbl_all(&dev->mt76);
ret = mt7996_mcu_init_rx_airtime(dev);
if (ret)
return ret;