* [PATCH v2] mt76: mt7921: fix antenna signal are way off in monitor mode
@ 2022-08-04 1:07 sean.wang
2022-09-15 10:37 ` Felix Fietkau
0 siblings, 1 reply; 3+ messages in thread
From: sean.wang @ 2022-08-04 1:07 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu,
km.lin, jenhao.yang, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
ted.huang, Stella.Chang, Tom.Chou, steve.lee, jsiuda, frankgor,
kuabhs, druth, abhishekpandit, shawnku, linux-wireless,
linux-mediatek, Deren Wu
From: Sean Wang <sean.wang@mediatek.com>
Group 3 in RxD is disabled in monitor mode. We should use the group 5 in
RxD instead to fix antenna signal way off issue, e.g we would see the
incorrect antenna signal value in wireshark. On the other hand, Group 5
wouldn't be used in STA or AP mode, so the patch shouldn't cause any
harm to those modes.
Fixes: cbaa0a404f8d ("mt76: mt7921: fix up the monitor mode")
Reported-by: Adrian Granados <agranados@gmail.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
v2: drop an unnecessary blank line and fix typo
---
.../net/wireless/mediatek/mt76/mt7921/mac.c | 32 ++++++++++++-------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 47f0aa81ab02..1c242f2ae997 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -394,6 +394,27 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
if (v0 & MT_PRXV_HT_AD_CODE)
status->enc_flags |= RX_ENC_FLAG_LDPC;
+ ret = mt76_connac2_mac_fill_rx_rate(&dev->mt76, status, sband,
+ rxv, &mode);
+ if (ret < 0)
+ return ret;
+
+ if (rxd1 & MT_RXD1_NORMAL_GROUP_5) {
+ rxd += 6;
+ if ((u8 *)rxd - skb->data >= skb->len)
+ return -EINVAL;
+
+ rxv = rxd;
+ /* Monitor mode would use RCPI described in GROUP 5
+ * instead.
+ */
+ v1 = le32_to_cpu(rxv[0]);
+
+ rxd += 12;
+ if ((u8 *)rxd - skb->data >= skb->len)
+ return -EINVAL;
+ }
+
status->chains = mphy->antenna_mask;
status->chain_signal[0] = to_rssi(MT_PRXV_RCPI0, v1);
status->chain_signal[1] = to_rssi(MT_PRXV_RCPI1, v1);
@@ -408,17 +429,6 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
status->signal = max(status->signal,
status->chain_signal[i]);
}
-
- ret = mt76_connac2_mac_fill_rx_rate(&dev->mt76, status, sband,
- rxv, &mode);
- if (ret < 0)
- return ret;
-
- if (rxd1 & MT_RXD1_NORMAL_GROUP_5) {
- rxd += 18;
- if ((u8 *)rxd - skb->data >= skb->len)
- return -EINVAL;
- }
}
amsdu_info = FIELD_GET(MT_RXD4_NORMAL_PAYLOAD_FORMAT, rxd4);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] mt76: mt7921: fix antenna signal are way off in monitor mode
2022-08-04 1:07 [PATCH v2] mt76: mt7921: fix antenna signal are way off in monitor mode sean.wang
@ 2022-09-15 10:37 ` Felix Fietkau
2022-09-16 5:37 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Felix Fietkau @ 2022-09-15 10:37 UTC (permalink / raw)
To: sean.wang, lorenzo.bianconi
Cc: Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin,
jenhao.yang, robin.chiu, Eddie.Chen, ch.yeh, posh.sun, ted.huang,
Stella.Chang, Tom.Chou, steve.lee, jsiuda, frankgor, kuabhs,
druth, abhishekpandit, shawnku, linux-wireless, linux-mediatek
On 04.08.22 03:07, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> Group 3 in RxD is disabled in monitor mode. We should use the group 5 in
> RxD instead to fix antenna signal way off issue, e.g we would see the
> incorrect antenna signal value in wireshark. On the other hand, Group 5
> wouldn't be used in STA or AP mode, so the patch shouldn't cause any
> harm to those modes.
>
> Fixes: cbaa0a404f8d ("mt76: mt7921: fix up the monitor mode")
> Reported-by: Adrian Granados <agranados@gmail.com>
> Co-developed-by: Deren Wu <deren.wu@mediatek.com>
> Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
This patch has been line wrapped and does not apply. Please resend.
- Felix
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] mt76: mt7921: fix antenna signal are way off in monitor mode
2022-09-15 10:37 ` Felix Fietkau
@ 2022-09-16 5:37 ` Kalle Valo
0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2022-09-16 5:37 UTC (permalink / raw)
To: Felix Fietkau
Cc: sean.wang, lorenzo.bianconi, Soul.Huang, YN.Chen, Leon.Yen,
Eric-SY.Chang, Deren.Wu, km.lin, jenhao.yang, robin.chiu,
Eddie.Chen, ch.yeh, posh.sun, ted.huang, Stella.Chang, Tom.Chou,
steve.lee, jsiuda, frankgor, kuabhs, druth, abhishekpandit,
shawnku, linux-wireless, linux-mediatek
Felix Fietkau <nbd@nbd.name> writes:
> On 04.08.22 03:07, sean.wang@mediatek.com wrote:
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> Group 3 in RxD is disabled in monitor mode. We should use the group 5 in
>> RxD instead to fix antenna signal way off issue, e.g we would see the
>> incorrect antenna signal value in wireshark. On the other hand, Group 5
>> wouldn't be used in STA or AP mode, so the patch shouldn't cause any
>> harm to those modes.
>>
>> Fixes: cbaa0a404f8d ("mt76: mt7921: fix up the monitor mode")
>> Reported-by: Adrian Granados <agranados@gmail.com>
>> Co-developed-by: Deren Wu <deren.wu@mediatek.com>
>> Signed-off-by: Deren Wu <deren.wu@mediatek.com>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>
> This patch has been line wrapped and does not apply. Please resend.
And please use "wifi:" in the title.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-16 5:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-04 1:07 [PATCH v2] mt76: mt7921: fix antenna signal are way off in monitor mode sean.wang
2022-09-15 10:37 ` Felix Fietkau
2022-09-16 5:37 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).