mt76: mt7921: consider the invalid value for to_rssi
authorSean Wang <sean.wang@mediatek.com>
Mon, 10 May 2021 15:14:55 +0000 (23:14 +0800)
committerFelix Fietkau <nbd@nbd.name>
Sat, 19 Jun 2021 07:22:44 +0000 (09:22 +0200)
commitedb5aebc1c3db312e74e1dcf75b8626ee5300596
tree56b2a82c34159f7807aaf7d3d97d05243113318c
parent193e5f22eeb2a9661bff8bc0d8519e6ded48c807
mt76: mt7921: consider the invalid value for to_rssi

It is possible the RCPI from the certain antenna is an invalid value,
especially packets are receiving while the system is frequently entering
deep sleep mode, so consider calculating RSSI with the reasonable upper
bound to avoid report the wrong value to the mac80211 layer.

Fixes: 163f4d22c118 ("mt76: mt7921: add MAC support")
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7921/mac.c