All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()
@ 2023-09-29  9:12 Dmitry Antipov
  2023-10-03  0:22 ` Ping-Ke Shih
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Antipov @ 2023-09-29  9:12 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: Kalle Valo, linux-wireless, lvc-project, Dmitry Antipov

Since '!(0x5ea42b & 0xffff0000)' is always zero, remove unreachable
block in 'rtl92d_dm_check_edca_turbo()' and convert EDCA limits to
constant variables. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 .../wireless/realtek/rtlwifi/rtl8192de/dm.c    | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
index 6cc9c7649eda..87798d7f5407 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
@@ -596,28 +596,14 @@ static void rtl92d_dm_check_edca_turbo(struct ieee80211_hw *hw)
 	static u64 last_rxok_cnt;
 	u64 cur_txok_cnt;
 	u64 cur_rxok_cnt;
-	u32 edca_be_ul = 0x5ea42b;
-	u32 edca_be_dl = 0x5ea42b;
+	const u32 edca_be_ul = 0x5ea42b;
+	const u32 edca_be_dl = 0x5ea42b;
 
 	if (mac->link_state != MAC80211_LINKED) {
 		rtlpriv->dm.current_turbo_edca = false;
 		goto exit;
 	}
 
-	/* Enable BEQ TxOP limit configuration in wireless G-mode. */
-	/* To check whether we shall force turn on TXOP configuration. */
-	if ((!rtlpriv->dm.disable_framebursting) &&
-	    (rtlpriv->sec.pairwise_enc_algorithm == WEP40_ENCRYPTION ||
-	    rtlpriv->sec.pairwise_enc_algorithm == WEP104_ENCRYPTION ||
-	    rtlpriv->sec.pairwise_enc_algorithm == TKIP_ENCRYPTION)) {
-		/* Force TxOP limit to 0x005e for UL. */
-		if (!(edca_be_ul & 0xffff0000))
-			edca_be_ul |= 0x005e0000;
-		/* Force TxOP limit to 0x005e for DL. */
-		if (!(edca_be_dl & 0xffff0000))
-			edca_be_dl |= 0x005e0000;
-	}
-
 	if ((!rtlpriv->dm.is_any_nonbepkts) &&
 	    (!rtlpriv->dm.disable_framebursting)) {
 		cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt;
-- 
2.41.0


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

* RE: [PATCH] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()
  2023-09-29  9:12 [PATCH] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo() Dmitry Antipov
@ 2023-10-03  0:22 ` Ping-Ke Shih
  2023-10-03  4:33   ` [PATCH] [v2] " Dmitry Antipov
  0 siblings, 1 reply; 5+ messages in thread
From: Ping-Ke Shih @ 2023-10-03  0:22 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Kalle Valo, linux-wireless, lvc-project



> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Friday, September 29, 2023 5:12 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; lvc-project@linuxtesting.org; Dmitry
> Antipov <dmantipov@yandex.ru>
> Subject: [PATCH] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()
> 
> Since '!(0x5ea42b & 0xffff0000)' is always zero, remove unreachable

s/zero/false/ 

> block in 'rtl92d_dm_check_edca_turbo()' and convert EDCA limits to
> constant variables. Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>  .../wireless/realtek/rtlwifi/rtl8192de/dm.c    | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
> index 6cc9c7649eda..87798d7f5407 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
> @@ -596,28 +596,14 @@ static void rtl92d_dm_check_edca_turbo(struct ieee80211_hw *hw)
>         static u64 last_rxok_cnt;
>         u64 cur_txok_cnt;
>         u64 cur_rxok_cnt;
> -       u32 edca_be_ul = 0x5ea42b;
> -       u32 edca_be_dl = 0x5ea42b;
> +       const u32 edca_be_ul = 0x5ea42b;
> +       const u32 edca_be_dl = 0x5ea42b;

move upward to have reverse X'mas tree order. 

> 
>         if (mac->link_state != MAC80211_LINKED) {
>                 rtlpriv->dm.current_turbo_edca = false;
>                 goto exit;
>         }
> 
> -       /* Enable BEQ TxOP limit configuration in wireless G-mode. */
> -       /* To check whether we shall force turn on TXOP configuration. */
> -       if ((!rtlpriv->dm.disable_framebursting) &&
> -           (rtlpriv->sec.pairwise_enc_algorithm == WEP40_ENCRYPTION ||
> -           rtlpriv->sec.pairwise_enc_algorithm == WEP104_ENCRYPTION ||
> -           rtlpriv->sec.pairwise_enc_algorithm == TKIP_ENCRYPTION)) {
> -               /* Force TxOP limit to 0x005e for UL. */
> -               if (!(edca_be_ul & 0xffff0000))
> -                       edca_be_ul |= 0x005e0000;
> -               /* Force TxOP limit to 0x005e for DL. */
> -               if (!(edca_be_dl & 0xffff0000))
> -                       edca_be_dl |= 0x005e0000;
> -       }
> -
>         if ((!rtlpriv->dm.is_any_nonbepkts) &&
>             (!rtlpriv->dm.disable_framebursting)) {
>                 cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt;
> --
> 2.41.0


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

* [PATCH] [v2] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()
  2023-10-03  0:22 ` Ping-Ke Shih
@ 2023-10-03  4:33   ` Dmitry Antipov
  2023-10-03  5:29     ` Ping-Ke Shih
  2023-10-05  6:55     ` Kalle Valo
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Antipov @ 2023-10-03  4:33 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: Kalle Valo, linux-wireless, lvc-project, Dmitry Antipov

Since '!(0x5ea42b & 0xffff0000)' is always false, remove unreachable
block in 'rtl92d_dm_check_edca_turbo()' and convert EDCA limits to
constant variables. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v2: ensure reverse X'mas decls and adjust commit message (Ping-Ke Shih)
---
 .../wireless/realtek/rtlwifi/rtl8192de/dm.c    | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
index 6cc9c7649eda..cf4aca83bd05 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
@@ -592,32 +592,18 @@ static void rtl92d_dm_check_edca_turbo(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
+	const u32 edca_be_ul = 0x5ea42b;
+	const u32 edca_be_dl = 0x5ea42b;
 	static u64 last_txok_cnt;
 	static u64 last_rxok_cnt;
 	u64 cur_txok_cnt;
 	u64 cur_rxok_cnt;
-	u32 edca_be_ul = 0x5ea42b;
-	u32 edca_be_dl = 0x5ea42b;
 
 	if (mac->link_state != MAC80211_LINKED) {
 		rtlpriv->dm.current_turbo_edca = false;
 		goto exit;
 	}
 
-	/* Enable BEQ TxOP limit configuration in wireless G-mode. */
-	/* To check whether we shall force turn on TXOP configuration. */
-	if ((!rtlpriv->dm.disable_framebursting) &&
-	    (rtlpriv->sec.pairwise_enc_algorithm == WEP40_ENCRYPTION ||
-	    rtlpriv->sec.pairwise_enc_algorithm == WEP104_ENCRYPTION ||
-	    rtlpriv->sec.pairwise_enc_algorithm == TKIP_ENCRYPTION)) {
-		/* Force TxOP limit to 0x005e for UL. */
-		if (!(edca_be_ul & 0xffff0000))
-			edca_be_ul |= 0x005e0000;
-		/* Force TxOP limit to 0x005e for DL. */
-		if (!(edca_be_dl & 0xffff0000))
-			edca_be_dl |= 0x005e0000;
-	}
-
 	if ((!rtlpriv->dm.is_any_nonbepkts) &&
 	    (!rtlpriv->dm.disable_framebursting)) {
 		cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt;
-- 
2.41.0


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

* RE: [PATCH] [v2] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()
  2023-10-03  4:33   ` [PATCH] [v2] " Dmitry Antipov
@ 2023-10-03  5:29     ` Ping-Ke Shih
  2023-10-05  6:55     ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2023-10-03  5:29 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Kalle Valo, linux-wireless, lvc-project



> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Tuesday, October 3, 2023 12:33 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; lvc-project@linuxtesting.org; Dmitry
> Antipov <dmantipov@yandex.ru>
> Subject: [PATCH] [v2] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()
> 
> Since '!(0x5ea42b & 0xffff0000)' is always false, remove unreachable
> block in 'rtl92d_dm_check_edca_turbo()' and convert EDCA limits to
> constant variables. Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

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



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

* Re: [PATCH] [v2] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()
  2023-10-03  4:33   ` [PATCH] [v2] " Dmitry Antipov
  2023-10-03  5:29     ` Ping-Ke Shih
@ 2023-10-05  6:55     ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2023-10-05  6:55 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Ping-Ke Shih, linux-wireless, lvc-project, Dmitry Antipov

Dmitry Antipov <dmantipov@yandex.ru> wrote:

> Since '!(0x5ea42b & 0xffff0000)' is always false, remove unreachable
> block in 'rtl92d_dm_check_edca_turbo()' and convert EDCA limits to
> constant variables. Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

9418edf8ff01 wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20231003043318.11370-1-dmantipov@yandex.ru/

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


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

end of thread, other threads:[~2023-10-05 14:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-29  9:12 [PATCH] wifi: rtlwifi: remove unreachable code in rtl92d_dm_check_edca_turbo() Dmitry Antipov
2023-10-03  0:22 ` Ping-Ke Shih
2023-10-03  4:33   ` [PATCH] [v2] " Dmitry Antipov
2023-10-03  5:29     ` Ping-Ke Shih
2023-10-05  6: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.