1: 3778e5e139f4 ! 1: ffa6f5ffa77c wifi: rtw89: set RA init rate level when the station RSSI is known @@ Commit message the PER is 0. On an 80 MHz AP, the TCP throughput to the station then stays at approximately 36 Mbit/s for the full connection.  - Move the mapping from RSSI to init_rate_lv to a function. Use it in the - RA association and in the RA update. In a test on RTL8922A, the - firmware used init_rate_lv only together with upd_all, and upd_all - resets the RA context. Thus, the RA - association sets rssi_unknown in the RA info when the RSSI is not known. - The RA update then sets upd_all one time, when the RSSI is known. + Move the mapping from RSSI to init_rate_lv to a function. In a test on + RTL8922A, the firmware used init_rate_lv only together with upd_all, and + upd_all resets the RA context. Thus, the RA association sets + rssi_unknown in the RA info when the RSSI is not known. When the RSSI is + known, the RA update sets init_rate_lv and upd_all one time. Other RA + updates still send init_rate_lv 0. The flag is in a struct_group at the end of the RA info, and rtw89_phy_ra_sta_update() clears the RA info only up to this group. Thus, the flag stays until the RA update uses it.  Tested on RTL8912AU (RTL8922A, USB) in AP mode with hostapd 2.10 and - VHT 80 MHz. The client is an Intel Meteor Lake CNVi (iwlwifi) at -38 to + VHT 80 MHz. The client is an Intel Meteor Lake CNVi (iwlwifi) at -34 to -40 dBm. Each test reconnects the client, then sends TCP from the AP for 60 s. Before: 6 of 8 connections stay at VHT-MCS 2 and 20 MHz, 36 Mbit/s. - After: 8 of 8 connections use VHT-MCS 7 to 9 at 80 MHz, 668 to - 684 Mbit/s. + After: 8 of 8 connections use VHT-MCS 9 at 80 MHz, 671 to 683 Mbit/s.  Suggested-by: Ping-Ke Shih  Signed-off-by: Vincent Schurink  @@ drivers/net/wireless/realtek/rtw89/phy.c: static void rtw89_phy_ra_sta_update(st void rtw89_phy_ra_update_sta_link(struct rtw89_dev *rtwdev, struct rtw89_sta_link *rtwsta_link, u32 changed) +@@ drivers/net/wireless/realtek/rtw89/phy.c: void rtw89_phy_ra_update_sta_link(struct rtw89_dev *rtwdev, + struct ieee80211_vif *vif = rtwvif_link_to_vif(rtwvif_link); + struct rtw89_ra_info *ra = &rtwsta_link->ra; + struct ieee80211_link_sta *link_sta; ++ u8 init_rate_lv; +  + rcu_read_lock(); +   @@ drivers/net/wireless/realtek/rtw89/phy.c: void rtw89_phy_ra_update_sta_link(struct rtw89_dev *rtwdev,  rcu_read_unlock();  -+ ra->init_rate_lv = rtw89_phy_ra_get_init_rate_lv(rtwsta_link); -+ if (ra->rssi_unknown && ra->init_rate_lv) { -+ ra->upd_all = 1; -+ ra->rssi_unknown = false; ++ if (ra->rssi_unknown) { ++ init_rate_lv = rtw89_phy_ra_get_init_rate_lv(rtwsta_link); ++ if (init_rate_lv) { ++ ra->init_rate_lv = init_rate_lv; ++ ra->upd_all = 1; ++ ra->rssi_unknown = false; ++ }  + } if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) ra->upd_mask = 1;