64bc7f8707707800fd69b053752c6d40233704ab
[openwrt/staging/blocktrron.git] /
1 From 9f00e2218e15a2ea3c284567424a100c10b6fb85 Mon Sep 17 00:00:00 2001
2 From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
3 Date: Tue, 4 Feb 2025 20:42:08 +0200
4 Subject: [PATCH] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
5
6 This function tells the firmware what rates it can use.
7
8 Put the 3SS and 4SS HT rates supported by the other station into the
9 rate mask.
10
11 Remove the 3SS and 4SS rates from the rate mask if the hardware only has
12 2 spatial streams.
13
14 And finally, select the right rate ID (a parameter for the firmware)
15 when the hardware has 3 spatial streams.
16
17 Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
18 Acked-by: Ping-Ke Shih <pkshih@realtek.com>
19 Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
20 Link: https://patch.msgid.link/48d1d90f-2aeb-4ec5-9a24-0980e10eae1e@gmail.com
21 ---
22 drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++++-----
23 1 file changed, 9 insertions(+), 5 deletions(-)
24
25 --- a/drivers/net/wireless/realtek/rtw88/main.c
26 +++ b/drivers/net/wireless/realtek/rtw88/main.c
27 @@ -1234,7 +1234,9 @@ void rtw_update_sta_info(struct rtw_dev
28 if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)
29 ldpc_en = VHT_LDPC_EN;
30 } else if (sta->deflink.ht_cap.ht_supported) {
31 - ra_mask |= (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) |
32 + ra_mask |= ((u64)sta->deflink.ht_cap.mcs.rx_mask[3] << 36) |
33 + ((u64)sta->deflink.ht_cap.mcs.rx_mask[2] << 28) |
34 + (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) |
35 (sta->deflink.ht_cap.mcs.rx_mask[0] << 12);
36 if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
37 stbc_en = HT_STBC_EN;
38 @@ -1244,6 +1246,9 @@ void rtw_update_sta_info(struct rtw_dev
39
40 if (efuse->hw_cap.nss == 1 || rtwdev->hal.txrx_1ss)
41 ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
42 + else if (efuse->hw_cap.nss == 2)
43 + ra_mask &= RA_MASK_VHT_RATES_2SS | RA_MASK_HT_RATES_2SS |
44 + RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
45
46 if (hal->current_band_type == RTW_BAND_5G) {
47 ra_mask |= (u64)sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 4;
48 @@ -1302,10 +1307,9 @@ void rtw_update_sta_info(struct rtw_dev
49 break;
50 }
51
52 - if (sta->deflink.vht_cap.vht_supported && ra_mask & 0xffc00000)
53 - tx_num = 2;
54 - else if (sta->deflink.ht_cap.ht_supported && ra_mask & 0xfff00000)
55 - tx_num = 2;
56 + if (sta->deflink.vht_cap.vht_supported ||
57 + sta->deflink.ht_cap.ht_supported)
58 + tx_num = efuse->hw_cap.nss;
59
60 rate_id = get_rate_id(wireless_set, bw_mode, tx_num);
61