mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw88: 8723b: avoid converting RX SNR twice
@ 2026-10-10  1:32 Hungyu Lin
  2026-10-10  6:17 ` Luka Gejak
  0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-10-10  1:32 UTC (permalink / raw)
  To: pkshih
  Cc: linux-wireless, linux-kernel, luka.gejak, rtl8821cerfe2,
	straube.linux, Hungyu Lin

rtw8723b_query_phy_status_ofdm() already divides the PHY SNR report by
two when filling pkt_stat->rx_snr. Shifting it again when copying it to
dm_info->rx_snr halves the value shown in diagnostics and used for the
average SNR.

Copy the converted value directly.

Fixes: d726c70ce082 ("wifi: rtw88: 8723b: add the RTL8723B chip driver")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/rtw8723b.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723b.c b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
index 8bb9c03d769c..197add7cc110 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8723b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
@@ -1291,7 +1291,7 @@ static void rtw8723b_query_phy_status_ofdm(struct rtw_dev *rtwdev, void *phy_raw
 
 	dm_info->curr_rx_rate = pkt_stat->rate;
 	dm_info->rssi[RF_PATH_A] = pkt_stat->rssi;
-	dm_info->rx_snr[RF_PATH_A] = pkt_stat->rx_snr[RF_PATH_A] >> 1;
+	dm_info->rx_snr[RF_PATH_A] = pkt_stat->rx_snr[RF_PATH_A];
 	dm_info->cfo_tail[RF_PATH_A] = (pkt_stat->cfo_tail[RF_PATH_A] * 5) >> 1;
 
 	val_s8 = (s8)pkt_stat->rx_evm[RF_PATH_A];

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] wifi: rtw88: 8723b: avoid converting RX SNR twice
  2026-10-10  1:32 [PATCH] wifi: rtw88: 8723b: avoid converting RX SNR twice Hungyu Lin
@ 2026-10-10  6:17 ` Luka Gejak
  0 siblings, 0 replies; 2+ messages in thread
From: Luka Gejak @ 2026-10-10  6:17 UTC (permalink / raw)
  To: Hungyu Lin, pkshih
  Cc: linux-wireless, linux-kernel, rtl8821cerfe2, straube.linux, Hungyu Lin

October 10, 2026 at 3:32 AM, "Hungyu Lin" <dennylin0707@gmail.com> wrote:


> 
> rtw8723b_query_phy_status_ofdm() already divides the PHY SNR report by
> two when filling pkt_stat->rx_snr. Shifting it again when copying it to
> dm_info->rx_snr halves the value shown in diagnostics and used for the
> average SNR.
> 
> Copy the converted value directly.
> 
> Fixes: d726c70ce082 ("wifi: rtw88: 8723b: add the RTL8723B chip driver")
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtw88/rtw8723b.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723b.c b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
> index 8bb9c03d769c..197add7cc110 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8723b.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
> @@ -1291,7 +1291,7 @@ static void rtw8723b_query_phy_status_ofdm(struct rtw_dev *rtwdev, void *phy_raw
>  
>  dm_info->curr_rx_rate = pkt_stat->rate;
>  dm_info->rssi[RF_PATH_A] = pkt_stat->rssi;
> - dm_info->rx_snr[RF_PATH_A] = pkt_stat->rx_snr[RF_PATH_A] >> 1;
> + dm_info->rx_snr[RF_PATH_A] = pkt_stat->rx_snr[RF_PATH_A];
>  dm_info->cfo_tail[RF_PATH_A] = (pkt_stat->cfo_tail[RF_PATH_A] * 5) >> 1;
>  
>  val_s8 = (s8)pkt_stat->rx_evm[RF_PATH_A];
>

For consistency, please do it the other way round: drop the /2 when
filling pkt_stat->rx_snr and keep the shift on the dm_info line.
rtw8723d.c, rtw8822b.c, rtw8822c.c and rtw8814a.c all store the raw report
and shift it once.

Also, rtw8703b.c has the same double conversion in query_phy_status_ofdm().
That one is upstream, so a patch for it would be welcome.

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-10  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10  1:32 [PATCH] wifi: rtw88: 8723b: avoid converting RX SNR twice Hungyu Lin
2026-10-10  6:17 ` Luka Gejak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®