Skip to content

Commit c713fb0

Browse files
lwfingerKalle Valo
authored andcommitted
rtlwifi: rtl8821ae: Fix connection lost problem correctly
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 40b368a ("rtlwifi: Fix alignment issues"); however, this change led to instability in the connection. To restore stability, this change was reverted in commit b8b8b16 ("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 <[email protected]>, 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: b8b8b16 ("rtlwifi: rtl8821ae: Fix connection lost problem") Cc: Stable <[email protected]> # 4.14+ Fix-suggested-by: Pkshih <[email protected]> Signed-off-by: Larry Finger <[email protected]> Tested-by: James Cameron <[email protected]> # x86_64 OLPC NL3 Signed-off-by: Kalle Valo <[email protected]>
1 parent cbbde7e commit c713fb0

File tree

2 files changed

+4
-2
lines changed
  • drivers/net/wireless/realtek/rtlwifi

2 files changed

+4
-2
lines changed

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, u16 addr)
11231123
}
11241124
if (0 == tmp) {
11251125
read_addr = REG_DBI_RDATA + addr % 4;
1126-
ret = rtl_read_word(rtlpriv, read_addr);
1126+
ret = rtl_read_byte(rtlpriv, read_addr);
11271127
}
11281128
return ret;
11291129
}
@@ -1165,7 +1165,8 @@ static void _rtl8821ae_enable_aspm_back_door(struct ieee80211_hw *hw)
11651165
}
11661166

11671167
tmp = _rtl8821ae_dbi_read(rtlpriv, 0x70f);
1168-
_rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7));
1168+
_rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7) |
1169+
ASPM_L1_LATENCY << 3);
11691170

11701171
tmp = _rtl8821ae_dbi_read(rtlpriv, 0x719);
11711172
_rtl8821ae_dbi_write(rtlpriv, 0x719, tmp | BIT(3) | BIT(4));

drivers/net/wireless/realtek/rtlwifi/wifi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
#define RTL_USB_MAX_RX_COUNT 100
100100
#define QBSS_LOAD_SIZE 5
101101
#define MAX_WMMELE_LENGTH 64
102+
#define ASPM_L1_LATENCY 7
102103

103104
#define TOTAL_CAM_ENTRY 32
104105

0 commit comments

Comments
 (0)