Re: rtlwifi: rtl8821ae: Fix connection lost problem correctly

2018-02-07 Thread Kalle Valo
Larry Finger <larry.fin...@lwfinger.net> wrote:

> There has been a coding error in rtl8821ae since it was first introduced,
> namely that an 8-bit register was read using a 16-bit read in
> _rtl8821ae_dbi_read(). This error was fixed with commit 40b368af4b75
> ("rtlwifi: Fix alignment issues"); however, this change led to
> instability in the connection. To restore stability, this change
> was reverted in commit b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection
> lost problem").
> 
> Unfortunately, the unaligned access causes machine checks in ARM
> architecture, and we were finally forced to find the actual cause of the
> problem on x86 platforms. Following a suggestion from Pkshih
> <pks...@realtek.com>, it was found that increasing the ASPM L1
> latency from 0 to 7 fixed the instability. This parameter was varied to
> see if a smaller value would work; however, it appears that 7 is the
> safest value. A new symbol is defined for this quantity, thus it can be
> easily changed if necessary.
> 
> Fixes: b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem")
> Cc: Stable <sta...@vger.kernel.org> # 4.14+
> Fix-suggested-by: Pkshih <pks...@realtek.com>
> Signed-off-by: Larry Finger <larry.fin...@lwfinger.net>
> Tested-by: James Cameron <qu...@laptop.org>  # x86_64 OLPC NL3

Patch applied to wireless-drivers-next.git, thanks.

c713fb071edc rtlwifi: rtl8821ae: Fix connection lost problem correctly

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

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



Re: [PATCH] rtlwifi: rtl8821ae: Fix connection lost problem correctly

2018-02-06 Thread Kalle Valo
Larry Finger <larry.fin...@lwfinger.net> writes:

> There has been a coding error in rtl8821ae since it was first introduced,
> namely that an 8-bit register was read using a 16-bit read in
> _rtl8821ae_dbi_read(). This error was fixed with commit 40b368af4b75
> ("rtlwifi: Fix alignment issues"); however, this change led to
> instability in the connection. To restore stability, this change
> was reverted in commit b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection
> lost problem").
>
> Unfortunately, the unaligned access causes machine checks in ARM
> architecture, and we were finally forced to find the actual cause of the
> problem on x86 platforms. Following a suggestion from Pkshih
> <pks...@realtek.com>, it was found that increasing the ASPM L1
> latency from 0 to 7 fixed the instability. This parameter was varied to
> see if a smaller value would work; however, it appears that 7 is the
> safest value. A new symbol is defined for this quantity, thus it can be
> easily changed if necessary.
>
> Fixes: b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem")
> Cc: Stable <sta...@vger.kernel.org> # 4.14+
> Fix-suggested-by: Pkshih <pks...@realtek.com>
> Signed-off-by: Larry Finger <larry.fin...@lwfinger.net>
> ---
>
> Kalle,
>
> This patch should be submitted to 4.16.

Ok, I'll queue this to 4.16.

-- 
Kalle Valo


Re: [PATCH] rtlwifi: rtl8821ae: Fix connection lost problem correctly

2018-02-05 Thread James Cameron
On Mon, Feb 05, 2018 at 12:38:11PM -0600, Larry Finger wrote:
> There has been a coding error in rtl8821ae since it was first introduced,
> namely that an 8-bit register was read using a 16-bit read in
> _rtl8821ae_dbi_read(). This error was fixed with commit 40b368af4b75
> ("rtlwifi: Fix alignment issues"); however, this change led to
> instability in the connection. To restore stability, this change
> was reverted in commit b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection
> lost problem").
> 
> Unfortunately, the unaligned access causes machine checks in ARM
> architecture, and we were finally forced to find the actual cause of the
> problem on x86 platforms. Following a suggestion from Pkshih
> <pks...@realtek.com>, it was found that increasing the ASPM L1
> latency from 0 to 7 fixed the instability. This parameter was varied to
> see if a smaller value would work; however, it appears that 7 is the
> safest value. A new symbol is defined for this quantity, thus it can be
> easily changed if necessary.
> 
> Fixes: b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem")
> Cc: Stable <sta...@vger.kernel.org> # 4.14+
> Fix-suggested-by: Pkshih <pks...@realtek.com>
> Signed-off-by: Larry Finger <larry.fin...@lwfinger.net>

Tested-by: James Cameron <qu...@laptop.org>  # x86_64 OLPC NL3

Thanks Larry & Pkshih, this does work as well as it did before.

-- 
James Cameron
http://quozl.netrek.org/


[PATCH] rtlwifi: rtl8821ae: Fix connection lost problem correctly

2018-02-05 Thread Larry Finger
There has been a coding error in rtl8821ae since it was first introduced,
namely that an 8-bit register was read using a 16-bit read in
_rtl8821ae_dbi_read(). This error was fixed with commit 40b368af4b75
("rtlwifi: Fix alignment issues"); however, this change led to
instability in the connection. To restore stability, this change
was reverted in commit b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection
lost problem").

Unfortunately, the unaligned access causes machine checks in ARM
architecture, and we were finally forced to find the actual cause of the
problem on x86 platforms. Following a suggestion from Pkshih
<pks...@realtek.com>, it was found that increasing the ASPM L1
latency from 0 to 7 fixed the instability. This parameter was varied to
see if a smaller value would work; however, it appears that 7 is the
safest value. A new symbol is defined for this quantity, thus it can be
easily changed if necessary.

Fixes: b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem")
Cc: Stable <sta...@vger.kernel.org> # 4.14+
Fix-suggested-by: Pkshih <pks...@realtek.com>
Signed-off-by: Larry Finger <larry.fin...@lwfinger.net>
---

Kalle,

This patch should be submitted to 4.16.

Larry
---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 5 +++--
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index f20e77b4bb65..317c1b3101da 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -1123,7 +1123,7 @@ static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, 
u16 addr)
}
if (0 == tmp) {
read_addr = REG_DBI_RDATA + addr % 4;
-   ret = rtl_read_word(rtlpriv, read_addr);
+   ret = rtl_read_byte(rtlpriv, read_addr);
}
return ret;
 }
@@ -1165,7 +1165,8 @@ static void _rtl8821ae_enable_aspm_back_door(struct 
ieee80211_hw *hw)
}
 
tmp = _rtl8821ae_dbi_read(rtlpriv, 0x70f);
-   _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7));
+   _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7) |
+ASPM_L1_LATENCY << 3);
 
tmp = _rtl8821ae_dbi_read(rtlpriv, 0x719);
_rtl8821ae_dbi_write(rtlpriv, 0x719, tmp | BIT(3) | BIT(4));
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h 
b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 1c9ed28b42da..4f48b934ec01 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -99,6 +99,7 @@
 #define RTL_USB_MAX_RX_COUNT   100
 #define QBSS_LOAD_SIZE 5
 #define MAX_WMMELE_LENGTH  64
+#define ASPM_L1_LATENCY7
 
 #define TOTAL_CAM_ENTRY32
 
-- 
2.16.1



Re: rtlwifi: rtl8821ae: Fix connection lost problem

2017-10-02 Thread Kalle Valo
Larry Finger <larry.fin...@lwfinger.net> wrote:

> In commit 40b368af4b75 ("rtlwifi: Fix alignment issues"), the read
> of REG_DBI_READ was changed from 16 to 8 bits. For unknown reasonsi
> this change results in reduced stability for the wireless connection.
> This regression was located using bisection.
> 
> Fixes: 40b368af4b75 ("rtlwifi: Fix alignment issues")
> Reported-and-tested-by: James Cameron <qu...@laptop.org>
> Signed-off-by: Larry Finger <larry.fin...@lwfinger.net>
> Cc: Stable <sta...@vger.kernel.org> # 4.11+
> Cc: Ping-Ke Shih <pks...@realtek.com>

Patch applied to wireless-drivers.git, thanks.

b8b8b16352cd rtlwifi: rtl8821ae: Fix connection lost problem

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

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



Re: rtlwifi: rtl8821ae: Fix connection lost problem

2017-09-25 Thread Larry Finger

On 09/25/2017 03:06 AM, Kalle Valo wrote:

Larry Finger  wrote:


In commit 40b368af4b75 ("rtlwifi: Fix alignment issues"), the read
of REG_DBI_READ was changed from 16 to 8 bits. For unknown reasonsi
this change results in reduced stability for the wireless connection.
This regression was located using bisection.

Fixes: 40b368af4b75 ("rtlwifi: Fix alignment issues")
Reported-and-tested-by: James Cameron 
Signed-off-by: Larry Finger 
Cc: Stable  # 4.11+
Cc: Ping-Ke Shih 


Should I queue this for 4.14?

(The first commit was v4.11-rc1.)


Yes, please do.

Larry



Re: rtlwifi: rtl8821ae: Fix connection lost problem

2017-09-25 Thread Kalle Valo
Larry Finger  wrote:

> In commit 40b368af4b75 ("rtlwifi: Fix alignment issues"), the read
> of REG_DBI_READ was changed from 16 to 8 bits. For unknown reasonsi
> this change results in reduced stability for the wireless connection.
> This regression was located using bisection.
> 
> Fixes: 40b368af4b75 ("rtlwifi: Fix alignment issues")
> Reported-and-tested-by: James Cameron 
> Signed-off-by: Larry Finger 
> Cc: Stable  # 4.11+
> Cc: Ping-Ke Shih 

Should I queue this for 4.14?

(The first commit was v4.11-rc1.)

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

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



[PATCH] rtlwifi: rtl8821ae: Fix connection lost problem

2017-09-20 Thread Larry Finger
In commit 40b368af4b75 ("rtlwifi: Fix alignment issues"), the read
of REG_DBI_READ was changed from 16 to 8 bits. For unknown reasonsi
this change results in reduced stability for the wireless connection.
This regression was located using bisection.

Fixes: 40b368af4b75 ("rtlwifi: Fix alignment issues")
Reported-and-tested-by: James Cameron 
Signed-off-by: Larry Finger 
Cc: Stable  # 4.11+
Cc: Ping-Ke Shih 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 3571ce4bd276..ac2ce86de506 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -1122,7 +1122,7 @@ static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, 
u16 addr)
}
if (0 == tmp) {
read_addr = REG_DBI_RDATA + addr % 4;
-   ret = rtl_read_byte(rtlpriv, read_addr);
+   ret = rtl_read_word(rtlpriv, read_addr);
}
return ret;
 }
-- 
2.12.3