On 25/11/2022 10:13, Ping-Ke Shih wrote: > > >> -----Original Message----- >> From: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> >> Sent: Thursday, November 24, 2022 5:34 AM >> To: linux-wireless@xxxxxxxxxxxxxxx >> Cc: Jes Sorensen <Jes.Sorensen@xxxxxxxxx>; Ping-Ke Shih <pkshih@xxxxxxxxxxx> >> Subject: [PATCH 2/2] wifi: rtl8xxxu: Introduce rtl8xxxu_update_ra_report >> >> The ra_report struct is used for reporting the TX rate via >> sta_statistics. The code which fills it out is duplicated in two >> places, and the RTL8188EU will need it in a third place. Move this >> code into a new function rtl8xxxu_update_ra_report. >> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> >> --- >> This patch should be applied after my other patch: >> "[PATCH v2] wifi: rtl8xxxu: Fix use after rcu_read_unlock in rtl8xxxu_bss_info_changed" >> --- >> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 105 ++++++++---------- >> 1 file changed, 45 insertions(+), 60 deletions(-) >> >> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> index 1c29d0bf09e2..2c8798cb3b4b 100644 >> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> @@ -4598,6 +4598,32 @@ static void rtl8xxxu_set_aifs(struct rtl8xxxu_priv *priv, u8 slot_time) >> } >> } >> >> +static void rtl8xxxu_update_ra_report(struct rtl8xxxu_ra_report *rarpt, >> + u8 rate, u8 sgi, u8 bw) >> +{ >> + u8 mcs, nss; >> + >> + rarpt->txrate.flags = 0; >> + >> + if (rate < DESC_RATE_MCS0) { > > I think 'if (rate <= DESC_RATE_54M)' would be more reasonable, because > rtl8xxxu_legacy_ratetable[] are list of legacy rates. > Okay.