> -----Original Message----- > From: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > Sent: Sunday, February 18, 2024 4:20 AM > To: linux-wireless@xxxxxxxxxxxxxxx > Cc: Ping-Ke Shih <pkshih@xxxxxxxxxxx>; Larry Finger <Larry.Finger@xxxxxxxxxxxx> > Subject: [PATCH] wifi: rtlwifi: Fix setting the basic rates Though driver sets register via enum HW_VAR_BASIC_RATE, but actually it uses supported rates as ACK and RTS rates, so I think it would be clearer to mention "fix setting of RTS rate" in subject. Others look good to me. > > RTL8192CU transmits RTS frames at 48M instead of the expected 24M. > This is because rtlwifi never writes REG_INIRTS_RATE_SEL, because when > rtl_op_bss_info_changed() is called with BSS_CHANGED_BASIC_RATES (and > BSS_CHANGED_BSSID) it calls ieee80211_find_sta(), which returns NULL, > and the code skips over the part that handles BSS_CHANGED_BASIC_RATES. > > A bit later rtl_op_bss_info_changed() is called with BSS_CHANGED_ASSOC. > At this point ieee80211_find_sta() works, so set the basic rates from > here. > > Some of the code from BSS_CHANGED_BSSID which needs ieee80211_find_sta() > was already duplicated under BSS_CHANGED_ASSOC, so delete it from > BSS_CHANGED_BSSID. > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > --- > > I'm not sure if this is enough. Should we also handle > BSS_CHANGED_BASIC_RATES? But bss_conf->basic_rates is only 0xf (CCK > rates only) and the out-of-tree Realtek drivers want to use the 6, 12, > and 24M rates as well. If ieee80211_find_sta() returns NULL, how can we > know if OFDM rates are supported? > > I'm also not sure if it's okay to set the basic rates later than > originally intended, but it's still better than never. bss_conf->basic_rates is from AP beacon basically, and only the supported rates with 0x80 bit are basic rates, which is minimum rates requirement to the AP. Thus, I think it is not suitable to consider basic rates as RTS rate. Ping-Ke