wifi: rtl8xxxu: Fix off by one initial RTS rate
PATCH v2 1/1 wifi: rtl8xxxu: Fix off by one initial RTS rate
rtl8xxxu_set_basic_rates() sets the wrong initial RTS rate. It sets the next higher rate than the one it should set, e.g. 36M instead of 24M.
The while loop was supposed to find the index of the most significant bit which is 1, but it was copied incorrectly from the vendor driver. Use __fls() instead.
---
v2:
- Use __fls().
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +3 -4
@@ -4839,10 +4839,9 @@ static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg)dev_dbg (&priv->udev->dev,"%s: rates %08x\n" , __func__, rate_cfg); -while (rate_cfg) { - rate_cfg = (rate_cfg >>1 ); - rate_idx++; - } +if (rate_cfg) + rate_idx =__fls (rate_cfg); +rtl8xxxu_write8 (priv,REG_INIRTS_RATE_SEL , rate_idx); }
Signature · 1 line
2.43.0
Quoted 9 lines
-----Original Message-----
From: Bitterblue Smith <[email protected]>
Sent: Wednesday, January 3, 2024 3:33 AM
To: [email protected]
Cc: Jes Sorensen <[email protected]>; Ping-Ke Shih <[email protected]>
Subject: [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate
Quoted 8 lines
rtl8xxxu_set_basic_rates()sets the wrong initial RTS rate. It sets the next higher rate than the one it should set, e.g. 36M instead of 24M.The while loop was supposed to find the index of the most significant bit which is 1, but it was copied incorrectly from the vendor driver. Use
__fls()instead.Signed-off-by Bitterblue Smith <[email protected]>
Quoted 9 lines · Bitterblue Smith
rtl8xxxu_set_basic_rates()sets the wrong initial RTS rate. It sets the next higher rate than the one it should set, e.g. 36M instead of 24M.The while loop was supposed to find the index of the most significant bit which is 1, but it was copied incorrectly from the vendor driver. Use
__fls()instead.Signed-off-by Bitterblue Smith <[email protected]>Reviewed-by Ping-Ke Shih <[email protected]>
Patch applied to wireless-next.git, thanks.
80850ca041f2 wifi: rtl8xxxu: Fix off by one initial RTS rate
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches