Commit ec55d8e7 authored by StanleyYP Wang's avatar StanleyYP Wang Committed by Felix Fietkau

wifi: mt76: mt7996: add sanity checks for background radar trigger

Check if background radar is enabled or not before manually triggering it,
and also add more checks in radar detected event.
Signed-off-by: default avatarStanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: default avatarShayne Chen <shayne.chen@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b03e90d1
......@@ -225,6 +225,11 @@ mt7996_radar_trigger(void *data, u64 val)
if (val > MT_RX_SEL2)
return -EINVAL;
if (val == MT_RX_SEL2 && !dev->rdd2_phy) {
dev_err(dev->mt76.dev, "Background radar is not enabled\n");
return -EINVAL;
}
return mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE,
val, 0, 0);
}
......
......@@ -355,7 +355,10 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb)
if (r->band_idx >= ARRAY_SIZE(dev->mt76.phys))
return;
if (dev->rdd2_phy && r->band_idx == MT_RX_SEL2)
if (r->band_idx == MT_RX_SEL2 && !dev->rdd2_phy)
return;
if (r->band_idx == MT_RX_SEL2)
mphy = dev->rdd2_phy->mt76;
else
mphy = dev->mt76.phys[r->band_idx];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment