diff mbox series

[2/8] wifi: rtw88: Fix rtw_desc_to_mcsrate() to handle MCS16-31

Message ID 23d28222-8f83-43a8-b312-d5858cf355d8@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Ping-Ke Shih
Headers show
Series wifi: rtw88: Prepare to support RTL8814AU (part 2/2) | expand

Commit Message

Bitterblue Smith Feb. 11, 2025, 10:22 p.m. UTC
This function translates the rate number reported by the hardware into
something mac80211 can understand. It was ignoring the 3SS and 4SS HT
rates.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ping-Ke Shih Feb. 13, 2025, 7:30 a.m. UTC | #1
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> This function translates the rate number reported by the hardware into
> something mac80211 can understand. It was ignoring the 3SS and 4SS HT
> rates.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtw88/util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/util.c b/drivers/net/wireless/realtek/rtw88/util.c
> index e222d3c01a77..ba02ba72e104 100644
> --- a/drivers/net/wireless/realtek/rtw88/util.c
> +++ b/drivers/net/wireless/realtek/rtw88/util.c
> @@ -101,7 +101,7 @@ void rtw_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss)
>                 *nss = 4;
>                 *mcs = rate - DESC_RATEVHT4SS_MCS0;
>         } else if (rate >= DESC_RATEMCS0 &&
> -                  rate <= DESC_RATEMCS15) {
> +                  rate <= DESC_RATEMCS31) {
>                 *mcs = rate - DESC_RATEMCS0;

Somehow, we don't set *nss in this case. The caller rtw_fw_ra_report_iter()
doesn't initialize nss, so there is potential problem.
Bitterblue Smith Feb. 13, 2025, 4:12 p.m. UTC | #2
On 13/02/2025 09:30, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> This function translates the rate number reported by the hardware into
>> something mac80211 can understand. It was ignoring the 3SS and 4SS HT
>> rates.
>>
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>> ---
>>  drivers/net/wireless/realtek/rtw88/util.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtw88/util.c b/drivers/net/wireless/realtek/rtw88/util.c
>> index e222d3c01a77..ba02ba72e104 100644
>> --- a/drivers/net/wireless/realtek/rtw88/util.c
>> +++ b/drivers/net/wireless/realtek/rtw88/util.c
>> @@ -101,7 +101,7 @@ void rtw_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss)
>>                 *nss = 4;
>>                 *mcs = rate - DESC_RATEVHT4SS_MCS0;
>>         } else if (rate >= DESC_RATEMCS0 &&
>> -                  rate <= DESC_RATEMCS15) {
>> +                  rate <= DESC_RATEMCS31) {
>>                 *mcs = rate - DESC_RATEMCS0;
> 
> Somehow, we don't set *nss in this case. The caller rtw_fw_ra_report_iter()
> doesn't initialize nss, so there is potential problem.
> 
> 

I assumed it's not needed because the MCS index implies the NSS,
but I can add that:

		*nss = *mcs / 8 + 1;
Ping-Ke Shih Feb. 14, 2025, 12:09 a.m. UTC | #3
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> On 13/02/2025 09:30, Ping-Ke Shih wrote:
> > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> >> This function translates the rate number reported by the hardware into
> >> something mac80211 can understand. It was ignoring the 3SS and 4SS HT
> >> rates.
> >>
> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> >> ---
> >>  drivers/net/wireless/realtek/rtw88/util.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/wireless/realtek/rtw88/util.c b/drivers/net/wireless/realtek/rtw88/util.c
> >> index e222d3c01a77..ba02ba72e104 100644
> >> --- a/drivers/net/wireless/realtek/rtw88/util.c
> >> +++ b/drivers/net/wireless/realtek/rtw88/util.c
> >> @@ -101,7 +101,7 @@ void rtw_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss)
> >>                 *nss = 4;
> >>                 *mcs = rate - DESC_RATEVHT4SS_MCS0;
> >>         } else if (rate >= DESC_RATEMCS0 &&
> >> -                  rate <= DESC_RATEMCS15) {
> >> +                  rate <= DESC_RATEMCS31) {
> >>                 *mcs = rate - DESC_RATEMCS0;
> >
> > Somehow, we don't set *nss in this case. The caller rtw_fw_ra_report_iter()
> > doesn't initialize nss, so there is potential problem.
> >
> >
> 
> I assumed it's not needed because the MCS index implies the NSS,

Yes, HT doesn't need NSS.

> but I can add that:
> 
>                 *nss = *mcs / 8 + 1;

So *nss = 0;

Please see how rtw_fw_ra_report_iter() uses its local variable 'nss'.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/util.c b/drivers/net/wireless/realtek/rtw88/util.c
index e222d3c01a77..ba02ba72e104 100644
--- a/drivers/net/wireless/realtek/rtw88/util.c
+++ b/drivers/net/wireless/realtek/rtw88/util.c
@@ -101,7 +101,7 @@  void rtw_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss)
 		*nss = 4;
 		*mcs = rate - DESC_RATEVHT4SS_MCS0;
 	} else if (rate >= DESC_RATEMCS0 &&
-		   rate <= DESC_RATEMCS15) {
+		   rate <= DESC_RATEMCS31) {
 		*mcs = rate - DESC_RATEMCS0;
 	}
 }