public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>, Jes Sorensen <Jes.Sorensen@gmail.com>
Subject: [PATCH rtw-next 4/5] wifi: rtl8xxxu: Fix RX channel width reported by RTL8192FU
Date: Sun, 16 Nov 2025 22:30:40 +0200	[thread overview]
Message-ID: <afd60ba6-4af8-4944-a915-4e2b814bbed3@gmail.com> (raw)
In-Reply-To: <b735b9c6-f17f-405a-8972-a7c98f3c89e2@gmail.com>

The other chips report the RX channel width in the RX descriptor,
but this one doesn't.

Get the RX channel width from the PHY status.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtl8xxxu/core.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 739456640ca8..668018229f7c 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -5701,7 +5701,7 @@ static void jaguar2_rx_parse_phystats_type1(struct rtl8xxxu_priv *priv,
 			 !rtl8xxxu_is_sta_sta(priv) &&
 			 (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) ||
 			  rtl8xxxu_is_packet_match_bssid(priv, hdr, 1));
-	u8 pwdb_max = 0;
+	u8 pwdb_max = 0, rxsc;
 	int rx_path;
 
 	if (parse_cfo) {
@@ -5716,6 +5716,16 @@ static void jaguar2_rx_parse_phystats_type1(struct rtl8xxxu_priv *priv,
 		pwdb_max = max(pwdb_max, phy_stats1->pwdb[rx_path]);
 
 	rx_status->signal = pwdb_max - 110;
+
+	if (rxmcs > DESC_RATE_11M && rxmcs < DESC_RATE_MCS0)
+		rxsc = phy_stats1->l_rxsc;
+	else
+		rxsc = phy_stats1->ht_rxsc;
+
+	if (phy_stats1->rf_mode == 0 || rxsc == 1 || rxsc == 2)
+		rx_status->bw = RATE_INFO_BW_20;
+	else
+		rx_status->bw = RATE_INFO_BW_40;
 }
 
 static void jaguar2_rx_parse_phystats_type2(struct rtl8xxxu_priv *priv,
-- 
2.51.1


  parent reply	other threads:[~2025-11-16 20:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-16 20:25 [PATCH rtw-next 0/5] wifi: rtl8xxxu: 40 MHz fixes Bitterblue Smith
2025-11-16 20:27 ` [PATCH rtw-next 1/5] wifi: rtl8xxxu: Fix HT40 channel config for RTL8192CU, RTL8723AU Bitterblue Smith
2025-11-18  2:44   ` Ping-Ke Shih
2025-11-16 20:28 ` [PATCH rtw-next 2/5] wifi: rtl8xxxu: Make RTL8192CU, RTL8723AU TX with 40 MHz width Bitterblue Smith
2025-11-18  2:46   ` Ping-Ke Shih
2025-11-16 20:29 ` [PATCH rtw-next 3/5] wifi: rtl8xxxu: Fix the 40 MHz subchannel for RTL8192EU, RTL8723BU Bitterblue Smith
2025-11-18  2:55   ` Ping-Ke Shih
2025-11-16 20:30 ` Bitterblue Smith [this message]
2025-11-18  2:59   ` [PATCH rtw-next 4/5] wifi: rtl8xxxu: Fix RX channel width reported by RTL8192FU Ping-Ke Shih
2025-11-18  3:02     ` Ping-Ke Shih
2025-11-18 17:33       ` Bitterblue Smith
2025-11-19  0:28         ` Ping-Ke Shih
2025-11-16 20:31 ` [PATCH rtw-next 5/5] wifi: rtl8xxxu: Enable 40 MHz width by default Bitterblue Smith
2025-11-18  3:01   ` Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afd60ba6-4af8-4944-a915-4e2b814bbed3@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox