]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
authorBitterblue Smith <rtl8821cerfe2@gmail.com>
Tue, 4 Feb 2025 18:42:08 +0000 (20:42 +0200)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 10 Feb 2025 03:39:57 +0000 (11:39 +0800)
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>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/48d1d90f-2aeb-4ec5-9a24-0980e10eae1e@gmail.com
drivers/net/wireless/realtek/rtw88/main.c

index 8d22df293e789398e25df90ad1a42474b6a6b305..e4f9b744f24de49958ba002a66da4587b01f0629 100644 (file)
@@ -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);