All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value
@ 2023-05-11  3:18 Yun Lu
  2023-05-11  4:34 ` Larry Finger
  0 siblings, 1 reply; 4+ messages in thread
From: Yun Lu @ 2023-05-11  3:18 UTC (permalink / raw)
  To: Jes.Sorensen, Larry.Finger
  Cc: kvalo, davem, edumazet, kuba, pabeni, linux-wireless, netdev

From: Yun Lu <luyun@kylinos.cn>

When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a
probability of failure, which shows "authentication with ... timed out".
Through debugging, it was found that the RCR register has been inexplicably
modified to an incorrect value, resulting in the nic not being able to
receive authenticated frames.

To fix this problem, add regrcr in rtl8xxxu_priv struct, and store
the RCR value every time the register is writen, and use it the next
time the register need to be modified.

Signed-off-by: Yun Lu <luyun@kylinos.cn>
Link: https://lore.kernel.org/all/20230427020512.1221062-1-luyun_611@163.com
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h      | 1 +
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index c8cee4a24755..4088aaa1c618 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1518,6 +1518,7 @@ struct rtl8xxxu_priv {
 	u32 rege9c;
 	u32 regeb4;
 	u32 regebc;
+	u32 regrcr;
 	int next_mbox;
 	int nr_out_eps;
 
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 620a5cc2bfdd..2fe71933ba08 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4053,6 +4053,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
 		RCR_ACCEPT_MGMT_FRAME | RCR_HTC_LOC_CTRL |
 		RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC;
 	rtl8xxxu_write32(priv, REG_RCR, val32);
+	priv->regrcr = val32;
 
 	if (priv->rtl_chip == RTL8188F) {
 		/* Accept all data frames */
@@ -6273,7 +6274,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw,
 				      unsigned int *total_flags, u64 multicast)
 {
 	struct rtl8xxxu_priv *priv = hw->priv;
-	u32 rcr = rtl8xxxu_read32(priv, REG_RCR);
+	u32 rcr = priv->regrcr;
 
 	dev_dbg(&priv->udev->dev, "%s: changed_flags %08x, total_flags %08x\n",
 		__func__, changed_flags, *total_flags);
@@ -6319,6 +6320,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw,
 	 */
 
 	rtl8xxxu_write32(priv, REG_RCR, rcr);
+	priv->regrcr = rcr;
 
 	*total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_BCN_PRBRESP_PROMISC |
 			 FIF_CONTROL | FIF_OTHER_BSS | FIF_PSPOLL |
-- 
2.25.1


No virus found
		Checked by Hillstone Network AntiVirus


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

* Re: [PATCH v2] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value
  2023-05-11  3:18 [PATCH v2] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value Yun Lu
@ 2023-05-11  4:34 ` Larry Finger
  2023-05-11 12:26   ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Larry Finger @ 2023-05-11  4:34 UTC (permalink / raw)
  To: Yun Lu, Jes.Sorensen
  Cc: kvalo, davem, edumazet, kuba, pabeni, linux-wireless, netdev

On 5/10/23 22:18, Yun Lu wrote:
> From: Yun Lu <luyun@kylinos.cn>
> 
> When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a
> probability of failure, which shows "authentication with ... timed out".
> Through debugging, it was found that the RCR register has been inexplicably
> modified to an incorrect value, resulting in the nic not being able to
> receive authenticated frames.
> 
> To fix this problem, add regrcr in rtl8xxxu_priv struct, and store
> the RCR value every time the register is writen, and use it the next
> time the register need to be modified.
> 
> Signed-off-by: Yun Lu <luyun@kylinos.cn>
> Link: https://lore.kernel.org/all/20230427020512.1221062-1-luyun_611@163.com
> ---
>   drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h      | 1 +
>   drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 +++-
>   2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> index c8cee4a24755..4088aaa1c618 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> @@ -1518,6 +1518,7 @@ struct rtl8xxxu_priv {
>   	u32 rege9c;
>   	u32 regeb4;
>   	u32 regebc;
> +	u32 regrcr;
>   	int next_mbox;
>   	int nr_out_eps;
>   
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index 620a5cc2bfdd..2fe71933ba08 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -4053,6 +4053,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
>   		RCR_ACCEPT_MGMT_FRAME | RCR_HTC_LOC_CTRL |
>   		RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC;
>   	rtl8xxxu_write32(priv, REG_RCR, val32);
> +	priv->regrcr = val32;
>   
>   	if (priv->rtl_chip == RTL8188F) {
>   		/* Accept all data frames */
> @@ -6273,7 +6274,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw,
>   				      unsigned int *total_flags, u64 multicast)
>   {
>   	struct rtl8xxxu_priv *priv = hw->priv;
> -	u32 rcr = rtl8xxxu_read32(priv, REG_RCR);
> +	u32 rcr = priv->regrcr;
>   
>   	dev_dbg(&priv->udev->dev, "%s: changed_flags %08x, total_flags %08x\n",
>   		__func__, changed_flags, *total_flags);
> @@ -6319,6 +6320,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw,
>   	 */
>   
>   	rtl8xxxu_write32(priv, REG_RCR, rcr);
> +	priv->regrcr = rcr;
>   
>   	*total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_BCN_PRBRESP_PROMISC |
>   			 FIF_CONTROL | FIF_OTHER_BSS | FIF_PSPOLL |

Acked-by and Tested-by: Larry Finger <Larry.Finger@lwfinger.net>

Thanks,

Larry


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

* Re: [PATCH v2] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value
  2023-05-11  4:34 ` Larry Finger
@ 2023-05-11 12:26   ` Simon Horman
  2023-05-12  1:06     ` Yun Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2023-05-11 12:26 UTC (permalink / raw)
  To: Larry Finger
  Cc: Yun Lu, Jes.Sorensen, kvalo, davem, edumazet, kuba, pabeni,
	linux-wireless, netdev

On Wed, May 10, 2023 at 11:34:19PM -0500, Larry Finger wrote:
> On 5/10/23 22:18, Yun Lu wrote:
> > From: Yun Lu <luyun@kylinos.cn>
> > 
> > When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a
> > probability of failure, which shows "authentication with ... timed out".
> > Through debugging, it was found that the RCR register has been inexplicably
> > modified to an incorrect value, resulting in the nic not being able to
> > receive authenticated frames.
> > 
> > To fix this problem, add regrcr in rtl8xxxu_priv struct, and store
> > the RCR value every time the register is writen, and use it the next

nit: s/writen/written/

> > time the register need to be modified.
> > 
> > Signed-off-by: Yun Lu <luyun@kylinos.cn>

...

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

* Re:Re: [PATCH v2] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value
  2023-05-11 12:26   ` Simon Horman
@ 2023-05-12  1:06     ` Yun Lu
  0 siblings, 0 replies; 4+ messages in thread
From: Yun Lu @ 2023-05-12  1:06 UTC (permalink / raw)
  To: Simon Horman
  Cc: Larry Finger, Jes.Sorensen, kvalo, davem, edumazet, kuba, pabeni,
	linux-wireless, netdev


At 2023-05-11 20:26:40, "Simon Horman" <simon.horman@corigine.com> wrote:
>On Wed, May 10, 2023 at 11:34:19PM -0500, Larry Finger wrote:
>> On 5/10/23 22:18, Yun Lu wrote:
>> > From: Yun Lu <luyun@kylinos.cn>
>> > 
>> > When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a
>> > probability of failure, which shows "authentication with ... timed out".
>> > Through debugging, it was found that the RCR register has been inexplicably
>> > modified to an incorrect value, resulting in the nic not being able to
>> > receive authenticated frames.
>> > 
>> > To fix this problem, add regrcr in rtl8xxxu_priv struct, and store
>> > the RCR value every time the register is writen, and use it the next
>
>nit: s/writen/written/
>
>> > time the register need to be modified.
>> > 
>> > Signed-off-by: Yun Lu <luyun@kylinos.cn>
>
>...

Yeah, it's my mistake. I will send a third version later to correct it.

Thanks.

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

end of thread, other threads:[~2023-05-12  1:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11  3:18 [PATCH v2] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value Yun Lu
2023-05-11  4:34 ` Larry Finger
2023-05-11 12:26   ` Simon Horman
2023-05-12  1:06     ` Yun Lu

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.