Bug 218466

Summary: commit f04d2c247e0407 exposes bug in mediatek mt7921 driver
Product: Drivers Reporter: spasswolf
Component: network-wirelessAssignee: drivers_network-wireless (drivers_network-wireless)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: johannes, nbd
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: linux-next-20240205, linux-next-20240206 Subsystem:
Regression: Yes Bisected commit-id: f04d2c247e0407ff8219395bef11ddc0837b7397

Description spasswolf 2024-02-06 13:59:42 UTC
Since linux-next-20240205 the wireless network on my MSI Alpha 15 Laptop fails to start.

NIC:
04:00.0 Network controller [0280]: MEDIATEK Corp. MT7921K (RZ608) Wi-Fi 6E 80MHz [14c3:0608]

error message:
$ dmesg | grep mt7921
[    5.202784][  T449] mt7921e 0000:04:00.0: enabling device (0000 -> 0002)
[    5.216190][  T449] mt7921e 0000:04:00.0: ASIC revision: 79610010
[    5.292362][  T140] mt7921e 0000:04:00.0: HW/SW Version: 0x8a108a10, Build Time: 20230117170855a
[    5.304909][  T140] mt7921e 0000:04:00.0: WM Firmware Version: ____010000, Build Time: 20230117170942
[    6.919118][  T140] mt7921e 0000:04:00.0: register device failed

I bisected this (between v6.8-rc3 and next-20240205) and found commit f04d2c247e0407 as the culprit. Reverting this commit in next-20240206 makes the driver work again.
Comment 1 Artem S. Tashkinov 2024-02-06 16:29:08 UTC
CC'ing Johannes Berg who added this commit.
Comment 2 spasswolf 2024-02-07 00:03:35 UTC
Actually this seems to be a bug of the mediatek driver which can be solved by this patch (already posted to linux-wireless)

diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 8a3a90d1bfac..6cf08446f445 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -363,6 +363,7 @@ mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates,
 		   int n_rates)
 {
 	phy->hw->wiphy->bands[NL80211_BAND_2GHZ] = &phy->sband_2g.sband;
+	phy->sband_2g.sband.band = NL80211_BAND_2GHZ;
 
 	return mt76_init_sband(phy, &phy->sband_2g, mt76_channels_2ghz,
 			       ARRAY_SIZE(mt76_channels_2ghz), rates,
@@ -374,6 +375,7 @@ mt76_init_sband_5g(struct mt76_phy *phy, struct ieee80211_rate *rates,
 		   int n_rates, bool vht)
 {
 	phy->hw->wiphy->bands[NL80211_BAND_5GHZ] = &phy->sband_5g.sband;
+	phy->sband_5g.sband.band = NL80211_BAND_5GHZ;
 
 	return mt76_init_sband(phy, &phy->sband_5g, mt76_channels_5ghz,
 			       ARRAY_SIZE(mt76_channels_5ghz), rates,
@@ -385,6 +387,7 @@ mt76_init_sband_6g(struct mt76_phy *phy, struct ieee80211_rate *rates,
 		   int n_rates)
 {
 	phy->hw->wiphy->bands[NL80211_BAND_6GHZ] = &phy->sband_6g.sband;
+	phy->sband_6g.sband.band = NL80211_BAND_6GHZ;
 
 	return mt76_init_sband(phy, &phy->sband_6g, mt76_channels_6ghz,
 			       ARRAY_SIZE(mt76_channels_6ghz), rates,
-- 
2.39.2