mt7921_mcu_parse_phy_cap() sets antenna_mask and chainmask to every chain that the firmware reports, also when the chip reset of mt7921_mac_reset_work() loads the firmware again. A mask that mt7921_set_antenna() set is thus lost, while the stream caps of each band still follow it. Only set the mask of every chain at the first firmware load. On a reload, keep the current mask, limited to the chains of the reloaded firmware, and build the stream caps again if that limit changes it. Fixes: 8c94f0e63bb3 ("mt76: connac: extend mcu_get_nic_capability") Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index a16f41eda2bb..9f1410c4cdb5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -582,9 +582,10 @@ static void mt7921_mcu_parse_tx_resource(struct mt76_dev *dev, sdio->sched.deficit = tx_res->pp_padding; } -static void mt7921_mcu_parse_phy_cap(struct mt76_dev *dev, +static void mt7921_mcu_parse_phy_cap(struct mt76_dev *mdev, struct sk_buff *skb, int len) { + struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt7921_phy_cap { u8 ht; u8 vht; @@ -604,16 +605,28 @@ static void mt7921_mcu_parse_phy_cap(struct mt76_dev *dev, WF0_24G, WF0_5G }; + bool changed; + u8 mask; if (len < offsetofend(struct mt7921_phy_cap, hw_path)) return; cap = (struct mt7921_phy_cap *)skb->data; - dev->phy.antenna_mask = BIT(cap->nss) - 1; - dev->phy.chainmask = dev->phy.antenna_mask; - dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G); - dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G); + mask = BIT(cap->nss) - 1; + if (dev->hw_init_done) + mask &= mdev->phy.antenna_mask; + changed = mask != mdev->phy.antenna_mask; + + mdev->phy.antenna_mask = mask; + mdev->phy.chainmask = mask; + mdev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G); + mdev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G); + + if (dev->hw_init_done && changed) { + mt76_set_stream_caps(&mdev->phy, true); + mt7921_set_stream_he_caps(&dev->phy); + } } static int mt7921_mcu_get_nic_capability(struct mt792x_phy *mphy) -- 2.47.3