wifi: mt76: mt7996: use correct phy for background radar event
authorStanleyYP Wang <StanleyYP.Wang@mediatek.com>
Mon, 5 Jun 2023 15:21:38 +0000 (23:21 +0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 25 Jul 2023 19:59:42 +0000 (21:59 +0200)
If driver directly uses the band_idx reported from the radar event to
access mt76_phy array, it will get the wrong phy for background radar.
Fix this by adjusting the statement.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c

index 0ede9769a8e8eac0e1e8549a4ed4d9c376fd2f07..20519bffce21275e1db0c7291100e95ed144be6a 100644 (file)
@@ -339,7 +339,11 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb)
        if (r->band_idx >= ARRAY_SIZE(dev->mt76.phys))
                return;
 
-       mphy = dev->mt76.phys[r->band_idx];
+       if (dev->rdd2_phy && r->band_idx == MT_RX_SEL2)
+               mphy = dev->rdd2_phy->mt76;
+       else
+               mphy = dev->mt76.phys[r->band_idx];
+
        if (!mphy)
                return;