[BUG] staging: r8822be: RTL8822be can't find any wireless AP

From: Jian-Hong Pan
Date: Wed Jul 04 2018 - 04:03:47 EST


Hi,

We have an ASUS X530UN (Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz)
laptop equipped with Realtek rtl8822be wireless which cannot find any
access point after WiFi is launched.

Realtek rtl8822be wireless' information:
dev@endless:~/linux-eos$ sudo lspci -nnvs 02:00.0
02:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd.
Device [10ec:b822] (rev ff) (prog-if ff)
!!! Unknown header type 7f
Kernel driver in use: r8822be
Kernel modules: r8822be

System always hits the error: "halmac_init_hal failed" in dmesg after
WiFi is launched.

[ 8.591333] r8822be: module is from the staging directory, the quality
is unknown, you have been warned.
[ 8.593122] r8822be 0000:02:00.0: enabling device (0000 -> 0003)
[ 8.669163] r8822be: Using firmware rtlwifi/rtl8822befw.bin
[ 9.289939] r8822be: rtlwifi: wireless switch is on
[ 10.056426] r8822be 0000:02:00.0 wlp2s0: renamed from wlan0
...
[ 11.952534] r8822be: halmac_init_hal failed
[ 11.955933] r8822be: halmac_init_hal failed
[ 11.956227] r8822be: halmac_init_hal failed
[ 22.007942] r8822be: halmac_init_hal failed

We noticed the r8822be module parameter "aspm"'s default value is 1.
Here is the parameter list of r8822be:
dev@endless:~$ sudo grep "" /sys/module/r8822be/parameters/*
/sys/module/r8822be/parameters/aspm:1
/sys/module/r8822be/parameters/debug_level:0
/sys/module/r8822be/parameters/debug_mask:0
/sys/module/r8822be/parameters/disable_watchdog:N
/sys/module/r8822be/parameters/dma64:N
/sys/module/r8822be/parameters/fwlps:Y
/sys/module/r8822be/parameters/ips:Y
/sys/module/r8822be/parameters/msi:Y
/sys/module/r8822be/parameters/swenc:N
/sys/module/r8822be/parameters/swlps:N

If I make a module options like "options r8822be aspm=0" which
disables ASPM and reboot, the WiFi works correctly. It can find the
access points, then connects.
Here is the parameter list of r8822be:
dev@endless:~$ sudo grep "" /sys/module/r8822be/parameters/*
/sys/module/r8822be/parameters/aspm:0
/sys/module/r8822be/parameters/debug_level:0
/sys/module/r8822be/parameters/debug_mask:0
/sys/module/r8822be/parameters/disable_watchdog:N
/sys/module/r8822be/parameters/dma64:N
/sys/module/r8822be/parameters/fwlps:Y
/sys/module/r8822be/parameters/ips:Y
/sys/module/r8822be/parameters/msi:Y
/sys/module/r8822be/parameters/swenc:N
/sys/module/r8822be/parameters/swlps:N

This issue can be reproduced on Linux stable 4.16.17, 4.17.2 and
4.18.0-rc3. (I list versions that we have tried)

Besides, I also notice there is a comment in
drivers/staging/rtlwifi/rtl8822be/sw.c rtl8822be_init_aspm_vars
function.

/*
* This setting works for those device with
* backdoor ASPM setting such as EPHY setting.
* 0 - Not support ASPM,
* 1 - Support ASPM,
* 2 - According to chipset.
*/

The value 2 for ASPM interests me. It says "Enable or disable ASPM
according to chipset."
I tried the setting value 2 for ASPM. Here is the parameter list of r8822be:
dev@endless:~$ sudo grep "" /sys/module/r8822be/parameters/*
/sys/module/r8822be/parameters/aspm:2
/sys/module/r8822be/parameters/debug_level:0
/sys/module/r8822be/parameters/debug_mask:0
/sys/module/r8822be/parameters/disable_watchdog:N
/sys/module/r8822be/parameters/dma64:N
/sys/module/r8822be/parameters/fwlps:Y
/sys/module/r8822be/parameters/ips:Y
/sys/module/r8822be/parameters/msi:Y
/sys/module/r8822be/parameters/swenc:N
/sys/module/r8822be/parameters/swlps:N

The value 2 for ASPM also works correctly on ASUS X530UN.

Jian-Hong Pan