All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate
@ 2024-01-02 19:33 Bitterblue Smith
  2024-01-03  1:52 ` Ping-Ke Shih
  2024-01-10 14:55 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Bitterblue Smith @ 2024-01-02 19:33 UTC (permalink / raw)
  To: linux-wireless@vger.kernel.org; +Cc: Jes Sorensen, Ping-Ke Shih

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 <rtl8821cerfe2@gmail.com>
---
v2:
 - Use __fls().
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 180907319e8c..2b1b633a1f96 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -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);
 }
 
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate
  2024-01-02 19:33 [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate Bitterblue Smith
@ 2024-01-03  1:52 ` Ping-Ke Shih
  2024-01-10 14:55 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-01-03  1:52 UTC (permalink / raw)
  To: Bitterblue Smith, linux-wireless@vger.kernel.org; +Cc: Jes Sorensen



> -----Original Message-----
> From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Sent: Wednesday, January 3, 2024 3:33 AM
> To: linux-wireless@vger.kernel.org
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Ping-Ke Shih <pkshih@realtek.com>
> Subject: [PATCH v2] 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.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate
  2024-01-02 19:33 [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate Bitterblue Smith
  2024-01-03  1:52 ` Ping-Ke Shih
@ 2024-01-10 14:55 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2024-01-10 14:55 UTC (permalink / raw)
  To: Bitterblue Smith
  Cc: linux-wireless@vger.kernel.org, Jes Sorensen, Ping-Ke Shih

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:

> 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 <rtl8821cerfe2@gmail.com>
> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

80850ca041f2 wifi: rtl8xxxu: Fix off by one initial RTS rate

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/761e6836-6cd6-4930-91b6-0446834655c5@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-10 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-02 19:33 [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate Bitterblue Smith
2024-01-03  1:52 ` Ping-Ke Shih
2024-01-10 14:55 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.