]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7996: fix invalid NSS setting when TX path differs from NSS
authorPeter Chiu <chui-hao.chiu@mediatek.com>
Thu, 15 May 2025 03:29:48 +0000 (11:29 +0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 22 May 2025 10:57:36 +0000 (12:57 +0200)
The maximum TX path and NSS may differ on a band. For example, one variant
of the MT7992 has 5 TX paths and 4 NSS on the 5 GHz band. To address this,
add orig_antenna_mask to record the maximum NSS and prevent setting an
invalid NSS in mt7996_set_antenna().

Fixes: 69d54ce7491d ("wifi: mt76: mt7996: switch to single multi-radio wiphy")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250515032952.1653494-5-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
drivers/net/wireless/mediatek/mt76/mt7996/main.c
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h

index 7bfd19ed95944acdb46320780581169d8e4ff2dd..87c6192b6384480affe34a8c3524ff11134af4d6 100644 (file)
@@ -310,6 +310,7 @@ int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy)
                phy->has_aux_rx = true;
 
        mphy->antenna_mask = BIT(nss) - 1;
+       phy->orig_antenna_mask = mphy->antenna_mask;
        mphy->chainmask = (BIT(path) - 1) << dev->chainshift[band_idx];
        phy->orig_chainmask = mphy->chainmask;
        dev->chainmask |= mphy->chainmask;
index b77e1721c7b80e328e86abe4a6d15a5283dcdf97..b11dd3dd5c46f0474d40ad37dafa98ba27149c89 100644 (file)
@@ -1528,7 +1528,8 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
                u8 shift = dev->chainshift[band_idx];
 
                phy->mt76->chainmask = tx_ant & phy->orig_chainmask;
-               phy->mt76->antenna_mask = phy->mt76->chainmask >> shift;
+               phy->mt76->antenna_mask = (phy->mt76->chainmask >> shift) &
+                                         phy->orig_antenna_mask;
 
                mt76_set_stream_caps(phy->mt76, true);
                mt7996_set_stream_vht_txbf_caps(phy);
index 7c334e319547483c103ef821bfe9162166610603..c75189a023165c09a95ff3229785b57a2d1c376f 100644 (file)
@@ -312,6 +312,7 @@ struct mt7996_phy {
        struct mt76_channel_state state_ts;
 
        u16 orig_chainmask;
+       u16 orig_antenna_mask;
 
        bool has_aux_rx;
        bool counter_reset;