* [PATCH] wifi: mt76: mt7996: stop radios after add failure
@ 2026-10-19 1:31 Jiale Yao
2026-10-20 9:58 ` Felix Fietkau
0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-10-19 1:31 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
Sean Wang, Matthias Brugger, AngeloGioacchino Del Regno,
linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek
Cc: Jiale Yao
A multi-radio interface can start one radio before starting a later
radio fails. add_interface returns without stopping the radios started
by that failed request. mt7996_run can also leave firmware radio state
enabled when setup fails after radio enablement.
Disable a radio when mt7996_run fails and track radios newly started by
add_interface so they and their monitor state are rolled back on a later
failure.
Fixes: 69d54ce7491d ("wifi: mt76: mt7996: switch to single multi-radio wiphy")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
.../net/wireless/mediatek/mt76/mt7996/main.c | 26 ++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index dd7a01c02a7c..1cea0515a413 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -24,15 +24,15 @@ int mt7996_run(struct mt7996_phy *phy)
ret = mt7996_mcu_set_chan_info(phy, UNI_CHANNEL_RX_PATH);
if (ret)
- return ret;
+ goto disable_radio;
ret = mt7996_mcu_set_thermal_throttling(phy, MT7996_THERMAL_THROTTLE_MAX);
if (ret)
- return ret;
+ goto disable_radio;
ret = mt7996_mcu_set_thermal_protect(phy, true);
if (ret)
- return ret;
+ goto disable_radio;
set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
@@ -45,6 +45,11 @@ int mt7996_run(struct mt7996_phy *phy)
}
return 0;
+
+disable_radio:
+ mt7996_mcu_set_radio_en(phy, false);
+
+ return ret;
}
static int mt7996_start(struct ieee80211_hw *hw)
@@ -558,6 +563,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct wireless_dev *wdev = ieee80211_vif_to_wdev(vif);
struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ unsigned long started = 0;
int i, err = 0;
mutex_lock(&dev->mt76.mutex);
@@ -572,6 +578,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
err = mt7996_run(phy);
if (err)
goto out;
+ set_bit(i, &started);
if (vif->type == NL80211_IFTYPE_MONITOR)
mt7996_set_monitor(phy, true);
@@ -584,6 +591,19 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
out:
mutex_unlock(&dev->mt76.mutex);
+ if (err) {
+ for_each_set_bit(i, &started, MT7996_MAX_RADIOS) {
+ struct mt7996_phy *phy = dev->radio_phy[i];
+
+ if (vif->type == NL80211_IFTYPE_MONITOR) {
+ mutex_lock(&dev->mt76.mutex);
+ mt7996_set_monitor(phy, false);
+ mutex_unlock(&dev->mt76.mutex);
+ }
+
+ mt7996_stop_phy(phy);
+ }
+ }
return err;
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] wifi: mt76: mt7996: stop radios after add failure
2026-10-19 1:31 [PATCH] wifi: mt76: mt7996: stop radios after add failure Jiale Yao
@ 2026-10-20 9:58 ` Felix Fietkau
0 siblings, 0 replies; 2+ messages in thread
From: Felix Fietkau @ 2026-10-20 9:58 UTC (permalink / raw)
To: Jiale Yao, Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang,
Matthias Brugger, AngeloGioacchino Del Regno, linux-wireless,
linux-kernel, linux-arm-kernel, linux-mediatek
On 19.10.26 03:31, Jiale Yao wrote:
> A multi-radio interface can start one radio before starting a later
> radio fails. add_interface returns without stopping the radios started
> by that failed request. mt7996_run can also leave firmware radio state
> enabled when setup fails after radio enablement.
>
> Disable a radio when mt7996_run fails and track radios newly started by
> add_interface so they and their monitor state are rolled back on a later
> failure.
>
> Fixes: 69d54ce7491d ("wifi: mt76: mt7996: switch to single multi-radio wiphy")
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
This does not apply properly. Please rebase and resend.
Thanks,
- Felix
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-20 9:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-19 1:31 [PATCH] wifi: mt76: mt7996: stop radios after add failure Jiale Yao
2026-10-20 9:58 ` Felix Fietkau
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®