You are not logged in.

#1 2022-01-22 17:00:02

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

[SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

Hello everyone.

Kernel is

Linux lhack 5.16.2-arch1-1 #1 SMP PREEMPT Thu, 20 Jan 2022 16:18:29 +0000 x86_64 GNU/Linux

dmesg
http://ix.io/3N99

journalctl -u wpa_supplicant
http://ix.io/3N9a

lspci -k

02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter
	DeviceName: WLAN
	Subsystem: AzureWave Device 3040
	Kernel driver in use: rtw_8821ce
	Kernel modules: rtw88_8821ce

For some reason ix.io didnt allow me to input full journalctl log, maybe it's too big. If it is necessary I will try to do it another way.

Using NetworkManager and wpa_supplicant, nothing else supplicant is installed.

First of all, I am pretty sure it is not an power save issue. The problem appears regardless of state of my charger, neither it plug in nor not. I also tried to:
1)

iw wlo1 set power_save off

2) Disable power save via modprobe with config file

options rtw88_core disable_lps_deep=y 
options rtw88_pci disable_msi=y disable_aspm=y

3) Disable bluetooth powersave (in my case I have integrated wireless and bluetooth adapters) via config file

ACTION=="add" \
  , ATTR{idProduct}=="3529" \
  , ATTR{idVendor}=="13d3" \
  , ATTR{power/autosuspend_delay_ms}="-1" \
  , ATTR{power/control}="on"

and directly disable powersave with

echo 0 > /sys/bus/usb/devices/1-8/power/autosuspend

4) Set kerner parameters with

pcie_aspm.policy=performance fwlps=0

I suspecting the issue was caused by beacon timeout. Reconnect appears right after

wpa_supplicant[402]: wlo1: CTRL-EVENT-DISCONNECTED bssid=f8:f0:82:0e:ff:47 reason=4 locally_generated=1

and lots of

CTRL-EVENT-BEACON-LOSS

before it.

"reason=4" means "Disassociated due to inactivity". I set up monitor wifi interface and check correlation between BEACON-LOSS log and actual beacons who didnt reach the laptop and its high, so it's not a false positive messages.

In that case, Iam asking for help to properly increase beacons timeout or maybe increase the number of timeouts which makes wpa_supplicant to disconnect. Seems like NetworkManager makes temporary config for wpa_supplicant and launch it, can I somehow tell NM to increase values that I need?

Thanks in advance.

Last edited by GuyWithNvidia (2022-01-23 18:26:26)

Offline

#2 2022-01-22 17:40:56

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,391

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

GuyWithNvidia wrote:

Using NetworkManager and wpa_supplicant, nothing else supplicant is installed.

Are you sure? Use this to check what's enabled:

find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-40s | %s\n", $(NF-0), $(NF-1)) }' | sort -f

Note that wpa_supplicant shouldn't be enabled directly because NM will activate it also.

Have you tried connecting with just wpa_supplicant (and a DHCP client if needed)? That would help to eliminate NM as a source of the problem.

GuyWithNvidia wrote:

I also tried to:

Did you check sysfs & /proc/cmdline to see if those attempts have been applied correctly?

Offline

#3 2022-01-22 18:28:40

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

Head_on_a_Stick wrote:
find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-40s | %s\n", $(NF-0), $(NF-1)) }' | sort -f
dbus-org.freedesktop.nm-dispatcher.service | system
dirmngr.socket                           | sockets.target.wants
getty@tty1.service                       | getty.target.wants
gpg-agent-browser.socket                 | sockets.target.wants
gpg-agent-extra.socket                   | sockets.target.wants
gpg-agent.socket                         | sockets.target.wants
gpg-agent-ssh.socket                     | sockets.target.wants
NetworkManager.service                   | multi-user.target.wants
NetworkManager-wait-online.service       | network-online.target.wants
p11-kit-server.socket                    | sockets.target.wants
pipewire.socket                          | sockets.target.wants
pulseaudio.socket                        | sockets.target.wants
remote-fs.target                         | multi-user.target.wants
var-lib-snapd-snap-bare-5.mount          | multi-user.target.wants
var-lib-snapd-snap-core18-2284.mount     | multi-user.target.wants
var-lib-snapd-snap-gnome\x2d3\x2d28\x2d1804-161.mount | multi-user.target.wants
var-lib-snapd-snap-gtk\x2dcommon\x2dthemes-1519.mount | multi-user.target.wants
var-lib-snapd-snap-singularityapp-16.mount | multi-user.target.wants
var-lib-snapd-snap-snapd-14295.mount     | multi-user.target.wants
Head_on_a_Stick wrote:

Have you tried connecting with just wpa_supplicant (and a DHCP client if needed)? That would help to eliminate NM as a source of the problem.

Yes, I receive the same logs and issue if I run just wpa_supplicant.

Head_on_a_Stick wrote:

Did you check sysfs & /proc/cmdline to see if those attempts have been applied correctly?

I did not, if its really matter, I will try it, but my other kernel parameters (like "loglevel" and "quiet") indeed works.

Offline

#4 2022-01-22 19:32:23

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,391

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

GuyWithNvidia wrote:
Head_on_a_Stick wrote:

Did you check sysfs & /proc/cmdline to see if those attempts have been applied correctly?

I did not, if its really matter, I will try it

I think you should because this does look like a power management issue with the card. Are you using TLP or any similar tool?

The full journal is probably also appropriate. Filtering the content can miss significant issues.

Offline

#5 2022-01-22 20:18:13

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

Head_on_a_Stick wrote:
GuyWithNvidia wrote:
Head_on_a_Stick wrote:

Did you check sysfs & /proc/cmdline to see if those attempts have been applied correctly?

I did not, if its really matter, I will try it

I think you should because this does look like a power management issue with the card.

cat /proc/cmdline                                                                                                                                
BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=0bff55b1-dad0-4edc-8ab1-244d7114e6ef rw loglevel=3 pcie_aspm.policy=performance fwlps=0
Head_on_a_Stick wrote:

Are you using TLP or any similar tool?

Im sorry, I have no idea what is this.

Head_on_a_Stick wrote:

The full journal is probably also appropriate. Filtering the content can miss significant issues.

I posted it in pastebin, hope its allowed on the forum.
https://pastebin.com/L1UauRi1

Offline

#6 2022-01-22 21:16:40

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,391

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

I was enquiring about the sysfs values for the module states:

cat /sys/module/rtw88_core/parameters/disable_lps_deep /sys/module/rtw88_pci/parameters/disable_aspm

And also

cat /sys/bus/usb/devices/usb*/power/autosuspend

The first command may be partiularly relevant because of this recurring message in your journal:

lhack kernel: rtw_8821ce 0000:02:00.0: firmware failed to leave lps state
GuyWithNvidia wrote:
Head_on_a_Stick wrote:

Are you using TLP or any similar tool?

Im sorry, I have no idea what is this.

See https://wiki.archlinux.org/title/TLP

Offline

#7 2022-01-22 21:30:00

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

Head_on_a_Stick wrote:
cat /sys/module/rtw88_core/parameters/disable_lps_deep /sys/module/rtw88_pci/parameters/disable_aspm
Y
Y
Head_on_a_Stick wrote:
cat /sys/bus/usb/devices/usb*/power/autosuspend
0
0
Head_on_a_Stick wrote:

I dont have this (maybe I should though)

sudo pacman -Qs tlp                                                                                                                              

Offline

#8 2022-01-22 22:33:29

seth
Member
Registered: 2012-09-03
Posts: 29,780

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

nvguy wrote:

options rtw88_core disable_lps_deep=y

modinfo rtw88_core wrote:

lps_deep_mode:Deeper PS mode. If 0, deep PS is disabled (uint)

journal wrote:

янв 22 23:00:32 lhack kernel: Unknown kernel command line parameters "BOOT_IMAGE=/boot/vmlinuz-linux fwlps=0", will be passed to user space.

янв 22 23:04:52 lhack kernel: rtw_8821ce 0000:02:00.0: firmware failed to leave lps state

I'd probably look into that first.

Offline

#9 2022-01-22 22:59:26

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

seth wrote:
nvguy wrote:

options rtw88_core disable_lps_deep=y

modinfo rtw88_core wrote:

lps_deep_mode:Deeper PS mode. If 0, deep PS is disabled (uint)

I have a different modinfo output:

filename:       /lib/modules/5.16.2-arch1-1/kernel/drivers/net/wireless/realtek/rtw88/rtw88_core.ko.zst
license:        Dual BSD/GPL
description:    Realtek 802.11ac wireless core module
author:         Realtek Corporation
srcversion:     D3F3780CDAF6995C5D8AD3C
depends:        mac80211,cfg80211
retpoline:      Y
intree:         Y
name:           rtw88_core
vermagic:       5.16.2-arch1-1 SMP preempt mod_unload 
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        40:A7:E4:32:95:4A:58:83:8A:FB:41:61:D7:6D:3A:E5:51:6E:0B:F5
sig_hashalgo:   sha512
signature:      30:64:02:30:30:09:37:92:A6:4A:A7:B1:16:BC:14:BA:DE:AA:C5:88:
                97:9F:46:DE:10:29:A2:AB:7C:97:01:26:F8:08:ED:4C:A5:5A:EE:4B:
                EC:A2:3D:86:49:75:80:94:86:34:0F:9C:02:30:48:F1:42:EF:62:E8:
                C7:F2:AA:FA:9C:D4:5D:FB:97:82:4C:C1:37:C7:5B:9B:9B:77:C0:41:
                75:4B:63:D9:7B:EB:DF:3D:2C:6B:95:4E:48:D7:18:D5:77:67:00:BB:
                F1:72
parm:           disable_lps_deep:Set Y to disable Deep PS (bool)
parm:           support_bf:Set Y to enable beamformee support (bool)
parm:           debug_mask:Debugging mask (uint)

Offline

#10 2022-01-22 23:19:46

seth
Member
Registered: 2012-09-03
Posts: 29,780

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

Indeed, https://git.kernel.org/pub/scm/linux/ke … 9c6a5ebd2c
(Checking uname, I'm still running the 5.10 lts - time to reboot, I guess ;-)

Offline

#11 2022-01-23 12:09:10

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

I have also tried to increase beacon timeout time by passing

beacon_int=9000

to wpa_supplicant config file, which I found to be responsible for this and nothing changed. https://github.com/vanhoefm/hostap-wpa3 … icant.conf
Config file:

network={
	ssid="*******"
	psk="******"
	psk=122f681d3333333333335e84d3e3a1e37ce3e3e3a236113ff3602dc33c056a3b
	beacon_int=9000
}

iw tells me that I have power_save on even if I have disable it via modprobe config file. I dont know how its function, I guess modprobe options have nothing to do with power_save, only some part of it.

Also, could I post this issue also in Laptop Issues section of the forum?

Offline

#12 2022-01-23 12:19:16

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,391

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

GuyWithNvidia wrote:

iw tells me that I have power_save on even if I have disable it via modprobe config file.

You should use a udev rule to disable power_save at boot with the iw command.

Something like

# /etc/udev/rules.d/81-wifi-power_save.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", RUN+="/usr/bin/iw dev $name set power_save off"
GuyWithNvidia wrote:

could I post this issue also in Laptop Issues section of the forum?

No but you can use the "Report" button on the OP to request that the moderators move this thread there. Not sure if that would be appropriate though.

EDIT: and obfuscate the psk line in your wpa_supplicant file — the hash is unsalted so it can be reversed trivially.

Last edited by Head_on_a_Stick (2022-01-23 12:20:58)

Offline

#13 2022-01-23 13:11:30

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

Head_on_a_Stick wrote:
GuyWithNvidia wrote:

iw tells me that I have power_save on even if I have disable it via modprobe config file.

You should use a udev rule to disable power_save at boot with the iw command.

Something like

# /etc/udev/rules.d/81-wifi-power_save.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", RUN+="/usr/bin/iw dev $name set power_save off"

Ok, thanks for this magic, I will use it for different goals, as I said iw does not help me here.

Head_on_a_Stick wrote:

EDIT: and obfuscate the psk line in your wpa_supplicant file — the hash is unsalted so it can be reversed trivially.

I paste invalid psk line.

Offline

#14 2022-01-23 13:21:36

seth
Member
Registered: 2012-09-03
Posts: 29,780

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

* Disable/rfkill the BT chip (it operates on 2.4GHz and might interfere)
* Do other devices keep working w/ the AP? (maybe we're looking at the wrong side of the disconnect)

Offline

#15 2022-01-23 14:39:46

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

seth wrote:

* Disable/rfkill the BT chip (it operates on 2.4GHz and might interfere)

0: hci0: Bluetooth
	Soft blocked: yes
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

Did change anything.

seth wrote:

* Do other devices keep working w/ the AP? (maybe we're looking at the wrong side of the disconnect)

I have another Arch laptop with iwlwifi driver, after disable power_save via iw works like a charm, at least WiFi.

Offline

#16 2022-01-23 14:51:24

seth
Member
Registered: 2012-09-03
Posts: 29,780

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

Offline

#17 2022-01-23 15:47:28

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

seth wrote:

Thank you, silly question, are rtl8821ce and rtw8821ce the same thing? I dont really know how Realtek name it's drivers.

Last edited by GuyWithNvidia (2022-01-23 15:53:26)

Offline

#18 2022-01-23 15:52:39

seth
Member
Registered: 2012-09-03
Posts: 29,780

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

The dkms repo strongly suggests that one's a replacement for the other.
About realteks naming scheme, https://git.kernel.org/pub/scm/linux/ke … ss/realtek
Don't ask me - "w" is probably for "wifi" and "l" for … errrr… umm… maybe they originally meant "rlt"??

Offline

#19 2022-01-23 17:54:20

GuyWithNvidia
Member
Registered: 2021-05-04
Posts: 47

Re: [SOLVED] WiFi frequently and randomly disconnects, rtw_8821ce driver.

seth wrote:

This works for me, thanks one more time, no more beacon loss and reconnecting. Marking thread as solved. My working configuration is:
Kernel option

pcie_aspm.policy=performance

Modprobe config:

options rtw88_core disable_lps_deep=y 
options rtw88_pci disable_msi=y disable_aspm=y

And usb devices:

cat /sys/bus/usb/devices/usb*/power/autosuspend                                                                                                  
0
0

And blacklisting rtw88_8821ce.
I suspect power save could be enabled with that driver, will try to remove any configuration which I tried and see how it works, will post results here.

EDIT: I removed all power save configs and everything still works.

Last edited by GuyWithNvidia (2022-01-23 19:33:33)

Offline

Board footer

Powered by FluxBB