2016-09-30 23:35:20

by Jes Sorensen

[permalink] [raw]
Subject: [PATCH 0/2] rtl8xxxu: Fix driver reload issues with 8723bu and 8192eu

From: Jes Sorensen <[email protected]>

Hi,

These two patches fix issues where rtl8723bu and rtl8192eu dongles
would stop receving data if one reloaded the driver module, requiring
it to be physically removed and reinserted.

Both issues are applicable to 4.9. The first patch for 8723bu is
applicable to stable 4.7 and 4.8. The second patch will only be
applicable to stable 4.8, once patches currently in flight are merged
by the network maintainers.

Cheers,
Jes


Jes Sorensen (2):
rtl8xxxu: Fix rtl8723bu driver reload issue
rtl8xxxu: Fix rtl8192eu driver reload issue

drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 8 +++++++-
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)

--
2.7.4


2016-10-03 07:29:54

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] rtl8xxxu: Fix rtl8723bu driver reload issue

Jes Sorensen <[email protected]> writes:

> Greg KH <[email protected]> writes:
>> On Fri, Sep 30, 2016 at 07:35:17PM -0400, [email protected] wrote:
>>> From: Jes Sorensen <[email protected]>
>>>
>>> The generic disable_rf() function clears bits 22 and 23 in
>>> REG_RX_WAIT_CCA, however we did not re-enable them again in
>>> rtl8723b_enable_rf()
>>>
>>> This resolves the problem for me with 8723bu devices not working again
>>> after reloading the driver.
>>>
>>> Signed-off-by: Jes Sorensen <[email protected]>
>>> ---
>>> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>
>> <formletter>
>>
>> This is not the correct way to submit patches for inclusion in the
>> stable kernel tree. Please read Documentation/stable_kernel_rules.txt
>> for how to do this properly.
>>
>> </formletter>
>
> DOH Kalle told me to CC stable I took it for granted that you meant CC
> in the email sense. Guess I get to blame my self for looking like a
> fool in public.

Yes, I meant adding it to the commit log. This part of the stable
process is a bit confusing, I should have been more clear how this
works.

> I'll send you an email directly with the SHA once it hits Linus' tree
> instead.

No need, I'll add this to the commit log and the stable team will get
the commit automatically once the commit is in Linus' tree:

Cc: [email protected] # 4.7+

--
Kalle Valo

2016-10-07 11:25:46

by Kalle Valo

[permalink] [raw]
Subject: Re: [1/2] rtl8xxxu: Fix rtl8723bu driver reload issue

Jes Sorensen <[email protected]> wrote:
> From: Jes Sorensen <[email protected]>
>
> The generic disable_rf() function clears bits 22 and 23 in
> REG_RX_WAIT_CCA, however we did not re-enable them again in
> rtl8723b_enable_rf()
>
> This resolves the problem for me with 8723bu devices not working again
> after reloading the driver.
>
> Signed-off-by: Jes Sorensen <[email protected]>
> Cc: [email protected] # 4.7+

2 patches applied to wireless-drivers.git, thanks.

ab05e5ec81c7 rtl8xxxu: Fix rtl8723bu driver reload issue
29d5e6fbd65b rtl8xxxu: Fix rtl8192eu driver reload issue

--
https://patchwork.kernel.org/patch/9359015/

Documentation about submitting wireless patches and checking status
from patchwork:

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

2016-09-30 23:35:20

by Jes Sorensen

[permalink] [raw]
Subject: [PATCH 1/2] rtl8xxxu: Fix rtl8723bu driver reload issue

From: Jes Sorensen <[email protected]>

The generic disable_rf() function clears bits 22 and 23 in
REG_RX_WAIT_CCA, however we did not re-enable them again in
rtl8723b_enable_rf()

This resolves the problem for me with 8723bu devices not working again
after reloading the driver.

Signed-off-by: Jes Sorensen <[email protected]>
---
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
index 6c086b5..02b8ddd 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
@@ -1498,6 +1498,10 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv)
u32 val32;
u8 val8;

+ val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA);
+ val32 |= (BIT(22) | BIT(23));
+ rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32);
+
/*
* No indication anywhere as to what 0x0790 does. The 2 antenna
* vendor code preserves bits 6-7 here.
--
2.7.4

2016-10-03 07:30:52

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/2] rtl8xxxu: Fix rtl8192eu driver reload issue

[email protected] writes:

> From: Jes Sorensen <[email protected]>
>
> The 8192eu suffered from two issues when reloading the driver.
>
> The same problems as with the 8723bu where REG_RX_WAIT_CCA bits 22 and
> 23 didn't get set in rtl8192e_enable_rf().
>
> In addition it also seems prone to issues when setting REG_RF_CTRL to
> 0 intead of just disabling the RF_ENABLE bit. Similar to what was
> causing issues with the 8188eu.
>
> With this patch I can successfully reload the driver and reassociate
> to an APi with an 8192eu dongle.
>
> Signed-off-by: Jes Sorensen <[email protected]>

I'll add:

Cc: [email protected] # 4.8+

--
Kalle Valo

2016-10-01 12:16:11

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 1/2] rtl8xxxu: Fix rtl8723bu driver reload issue

On Fri, Sep 30, 2016 at 07:35:17PM -0400, [email protected] wrote:
> From: Jes Sorensen <[email protected]>
>
> The generic disable_rf() function clears bits 22 and 23 in
> REG_RX_WAIT_CCA, however we did not re-enable them again in
> rtl8723b_enable_rf()
>
> This resolves the problem for me with 8723bu devices not working again
> after reloading the driver.
>
> Signed-off-by: Jes Sorensen <[email protected]>
> ---
> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++
> 1 file changed, 4 insertions(+)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

2016-10-01 12:29:45

by Jes Sorensen

[permalink] [raw]
Subject: Re: [PATCH 1/2] rtl8xxxu: Fix rtl8723bu driver reload issue

Greg KH <[email protected]> writes:
> On Fri, Sep 30, 2016 at 07:35:17PM -0400, [email protected] wrote:
>> From: Jes Sorensen <[email protected]>
>>
>> The generic disable_rf() function clears bits 22 and 23 in
>> REG_RX_WAIT_CCA, however we did not re-enable them again in
>> rtl8723b_enable_rf()
>>
>> This resolves the problem for me with 8723bu devices not working again
>> after reloading the driver.
>>
>> Signed-off-by: Jes Sorensen <[email protected]>
>> ---
>> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>
> <formletter>
>
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree. Please read Documentation/stable_kernel_rules.txt
> for how to do this properly.
>
> </formletter>

DOH Kalle told me to CC stable I took it for granted that you meant CC
in the email sense. Guess I get to blame my self for looking like a
fool in public.

I'll send you an email directly with the SHA once it hits Linus' tree
instead.

Jes

2016-09-30 23:35:20

by Jes Sorensen

[permalink] [raw]
Subject: [PATCH 2/2] rtl8xxxu: Fix rtl8192eu driver reload issue

From: Jes Sorensen <[email protected]>

The 8192eu suffered from two issues when reloading the driver.

The same problems as with the 8723bu where REG_RX_WAIT_CCA bits 22 and
23 didn't get set in rtl8192e_enable_rf().

In addition it also seems prone to issues when setting REG_RF_CTRL to
0 intead of just disabling the RF_ENABLE bit. Similar to what was
causing issues with the 8188eu.

With this patch I can successfully reload the driver and reassociate
to an APi with an 8192eu dongle.

Signed-off-by: Jes Sorensen <[email protected]>
---
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
index df54d27..a793fed 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
@@ -1461,7 +1461,9 @@ static int rtl8192eu_active_to_emu(struct rtl8xxxu_priv *priv)
int count, ret = 0;

/* Turn off RF */
- rtl8xxxu_write8(priv, REG_RF_CTRL, 0);
+ val8 = rtl8xxxu_read8(priv, REG_RF_CTRL);
+ val8 &= ~RF_ENABLE;
+ rtl8xxxu_write8(priv, REG_RF_CTRL, val8);

/* Switch DPDT_SEL_P output from register 0x65[2] */
val8 = rtl8xxxu_read8(priv, REG_LEDCFG2);
@@ -1593,6 +1595,10 @@ static void rtl8192e_enable_rf(struct rtl8xxxu_priv *priv)
u32 val32;
u8 val8;

+ val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA);
+ val32 |= (BIT(22) | BIT(23));
+ rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32);
+
val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG);
val8 |= BIT(5);
rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8);
--
2.7.4