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

rtw8723b_query_phy_status_ofdm() divides the SNR report by two when
filling pkt_stat->rx_snr, then shifts it again when updating
dm_info->rx_snr. This halves the SNR used for diagnostics and average
statistics.

Store the raw report in pkt_stat->rx_snr and convert it only when
updating dm_info->rx_snr, as the other chip drivers do.

Fixes: d726c70ce082 ("wifi: rtw88: 8723b: add the RTL8723B chip driver")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
Changes in v2:
- Store the raw SNR report in pkt_stat->rx_snr and keep the shift when
  updating dm_info->rx_snr.

 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..18bd2b108ccb 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8723b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
@@ -1280,7 +1280,7 @@ static void rtw8723b_query_phy_status_ofdm(struct rtw_dev *rtwdev, void *phy_raw
 	pkt_stat->rx_power[RF_PATH_A] = (val_s8 * 2) - 110;
 
 	pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
-	pkt_stat->rx_snr[RF_PATH_A] = (s8)(phy_status->path_rxsnr[RF_PATH_A] / 2);
+	pkt_stat->rx_snr[RF_PATH_A] = phy_status->path_rxsnr[RF_PATH_A];
 
 	/* signal power reported by HW */
 	val_s8 = phy_status->cck_sig_qual_ofdm_pwdb_all >> 1;

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

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

October 10, 2026 at 12:47 PM, "Hungyu Lin" <dennylin0707@gmail.com mailto:dennylin0707@gmail.com?to=%22Hungyu%20Lin%22%20%3Cdennylin0707%40gmail.com%3E > wrote:


> 
> rtw8723b_query_phy_status_ofdm() divides the SNR report by two when
> filling pkt_stat->rx_snr, then shifts it again when updating
> dm_info->rx_snr. This halves the SNR used for diagnostics and average
> statistics.
> 
> Store the raw report in pkt_stat->rx_snr and convert it only when
> updating dm_info->rx_snr, as the other chip drivers do.
> 
> Fixes: d726c70ce082 ("wifi: rtw88: 8723b: add the RTL8723B chip driver")
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>

Ping-Ke should fixes tag be present here if this commit isn't in
mainline yet?

> ---
> Changes in v2:
> - Store the raw SNR report in pkt_stat->rx_snr and keep the shift when
>  updating dm_info->rx_snr.
> 
>  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..18bd2b108ccb 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8723b.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
> @@ -1280,7 +1280,7 @@ static void rtw8723b_query_phy_status_ofdm(struct rtw_dev *rtwdev, void *phy_raw
>  pkt_stat->rx_power[RF_PATH_A] = (val_s8 * 2) - 110;
>  
>  pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
> - pkt_stat->rx_snr[RF_PATH_A] = (s8)(phy_status->path_rxsnr[RF_PATH_A] / 2);
> + pkt_stat->rx_snr[RF_PATH_A] = phy_status->path_rxsnr[RF_PATH_A];
>  
>  /* signal power reported by HW */
>  val_s8 = phy_status->cck_sig_qual_ofdm_pwdb_all >> 1;
>

Either way change looks good to me.

Reviewed-by: Luka Gejak <luka.gejak@linux.dev>

Best regards,
Luka Gejak

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10 10:47 [PATCH v2] wifi: rtw88: 8723b: avoid converting RX SNR twice Hungyu Lin
2026-10-10 11:14 ` 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®