Bad WiFi Performance on Battery

Hi!

I hava a Lenovo Thinkpad P14s with bad wifi performance when running on battery.

This is my system:

$ inxi -v 2
System:
  Host: p14s Kernel: 6.6.41 arch: x86_64 bits: 64
  Desktop: Xfce v: 4.18.1 Distro: NixOS 24.11 (Vicuna)
Machine:
  Type: Laptop System: LENOVO product: 21A0000DGE v: ThinkPad P14s Gen 2a
    serial: <superuser required>
  Mobo: LENOVO model: 21A0000DGE v: SDK0J40697 WIN
    serial: <superuser required> UEFI: LENOVO v: R1MET55W (1.25 )
    date: 10/30/2023
Battery:
  ID-1: BAT0 charge: 44.5 Wh (87.9%) condition: 50.6/51.0 Wh (99.2%)
CPU:
  Info: 8-core AMD Ryzen 7 PRO 5850U with Radeon Graphics [MT MCP]
    speed (MHz): avg: 748 min/max: 400/4507
Graphics:
  Device-1: AMD Cezanne [Radeon Vega Series / Radeon Mobile Series]
    driver: amdgpu v: kernel
  Device-2: Sonix Integrated Camera driver: uvcvideo type: USB
  Display: x11 server: X.org v: 1.21.1.13 driver: gpu: amdgpu
    resolution: 1920x1080~60Hz
  API: OpenGL Message: Unable to show GL data. glxinfo is missing.
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    driver: r8169
  Device-2: Realtek RTL8852AE 802.11ax PCIe Wireless Network Adapter
    driver: rtw89_8852ae
  Device-3: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    driver: r8169
Drives:
  Local Storage: total: 476.94 GiB used: 152.02 GiB (31.9%)
Info:
  Memory: total: 28 GiB available: 27.24 GiB used: 2.47 GiB (9.1%)
  Processes: 360 Uptime: 0h 27m Shell: Zsh inxi: 3.3.34

On AC power, everything is fine. But when I unplug the AC adapter, instantaneously the ping time begins to vary strongly, increasing overall and I experience ping losses. From time to time I completely lose my WiFi connection and have to re-connect manually.

In journalctl is see messages like this:

p14s kernel: wlp3s0: disassociated from 44:fe:3b:xx:xx:xx (Reason: 39=QSTA_TIMEOUT)
p14s kernel: rtw89_8852ae 0000:03:00.0: timed out to flush queues
p14s kernel: rtw89_8852ae 0000:03:00.0: timed out to flush queues
p14s wpa_supplicant[1740]: wlp3s0: CTRL-EVENT-DISCONNECTED bssid=44:fe:3b:xx:xx:xx reason=39
[...]
Jul 21 14:03:29 p14s wpa_supplicant[2137]: wlp3s0: CTRL-EVENT-BEACON-LOSS
Jul 21 14:03:54 p14s wpa_supplicant[2137]: wlp3s0: CTRL-EVENT-BEACON-LOSS
Jul 21 14:04:30 p14s wpa_supplicant[2137]: wlp3s0: CTRL-EVENT-BEACON-LOSS

I expect this to be a power save issue.

I already tried adding

networking.networkmanager.wifi.powersave = false;

to configuration.nix but there was no improvement.

Do you have an idea?

Regards,
rzbrk

Hi, I don’t have the solution for your problem but I noticed I have the exact same output as you:

Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
driver: r8169
Device-2: Realtek RTL8852AE 802.11ax PCIe Wireless Network Adapter
driver: rtw89_8852ae

However my wireless interface is still not working and not showing up, I don’t know if it sounds familiar for you and if you can maybe send some of your configurations to see if I missed something.

Thanks you.