linux-wireless.vger.kernel.org archive mirror
 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>
Subject: [PATCH 7/7] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
Date: Mon, 27 Jan 2025 01:02:13 +0200	[thread overview]
Message-ID: <2a7c21bd-e78c-4792-99c7-fc73ce209930@gmail.com> (raw)
In-Reply-To: <fb2c2ae6-6173-4b4a-9e1f-ff51759cdee6@gmail.com>

This function tells the firmware what rates it can use.

Put the 3SS and 4SS HT rates supported by the other station into the
rate mask.

Remove the 3SS and 4SS rates from the rate mask if the hardware only has
2 spatial streams.

And finally, select the right rate ID (a parameter for the firmware)
when the hardware has 3 spatial streams.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 0cee0fd8c0ef..fab7e79fce47 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1234,7 +1234,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
 		if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)
 			ldpc_en = VHT_LDPC_EN;
 	} else if (sta->deflink.ht_cap.ht_supported) {
-		ra_mask |= (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) |
+		ra_mask |= ((u64)sta->deflink.ht_cap.mcs.rx_mask[3] << 36) |
+			   ((u64)sta->deflink.ht_cap.mcs.rx_mask[2] << 28) |
+			   (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) |
 			   (sta->deflink.ht_cap.mcs.rx_mask[0] << 12);
 		if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
 			stbc_en = HT_STBC_EN;
@@ -1244,6 +1246,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
 
 	if (efuse->hw_cap.nss == 1 || rtwdev->hal.txrx_1ss)
 		ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
+	else if (efuse->hw_cap.nss == 2)
+		ra_mask &= RA_MASK_VHT_RATES_2SS | RA_MASK_HT_RATES_2SS |
+			   RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
 
 	if (hal->current_band_type == RTW_BAND_5G) {
 		ra_mask |= (u64)sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 4;
@@ -1302,10 +1307,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
 		break;
 	}
 
-	if (sta->deflink.vht_cap.vht_supported && ra_mask & 0xffc00000)
-		tx_num = 2;
-	else if (sta->deflink.ht_cap.ht_supported && ra_mask & 0xfff00000)
-		tx_num = 2;
+	if (sta->deflink.vht_cap.vht_supported ||
+	    sta->deflink.ht_cap.ht_supported)
+		tx_num = efuse->hw_cap.nss;
 
 	rate_id = get_rate_id(wireless_set, bw_mode, tx_num);
 
-- 
2.48.1


  parent reply	other threads:[~2025-01-26 23:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-26 22:53 [PATCH 0/7] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
2025-01-26 22:53 ` [PATCH 1/7] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU Bitterblue Smith
2025-01-27  6:06   ` Ping-Ke Shih
2025-01-26 22:54 ` [PATCH 2/7] wifi: rtw88: Fix download_firmware_validate() " Bitterblue Smith
2025-01-27  6:21   ` Ping-Ke Shih
2025-01-26 22:55 ` [PATCH 3/7] wifi: rtw88: Extend struct rtw_pwr_track_tbl " Bitterblue Smith
2025-01-27  6:23   ` Ping-Ke Shih
2025-01-26 22:55 ` [PATCH 4/7] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr " Bitterblue Smith
2025-01-27  6:26   ` Ping-Ke Shih
2025-01-26 22:56 ` [PATCH 5/7] wifi: rtw88: Extend rtw_fw_send_ra_info() " Bitterblue Smith
2025-01-27  6:36   ` Ping-Ke Shih
2025-01-27 23:18     ` Bitterblue Smith
2025-01-28  5:52       ` Ping-Ke Shih
2025-01-28 17:17         ` Bitterblue Smith
2025-01-29  2:43           ` Ping-Ke Shih
2025-01-29 23:14             ` Bitterblue Smith
2025-01-30  9:12               ` Ping-Ke Shih
2025-01-30 21:16                 ` Bitterblue Smith
2025-01-26 23:01 ` [PATCH 6/7] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams Bitterblue Smith
2025-01-27  7:06   ` Ping-Ke Shih
2025-01-26 23:02 ` Bitterblue Smith [this message]
2025-01-27  7:14   ` [PATCH 7/7] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU 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=2a7c21bd-e78c-4792-99c7-fc73ce209930@gmail.com \
    --to=rtl8821cerfe2@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;
as well as URLs for NNTP newsgroup(s).