Wifi speed slow on TP-link usb wireless adapter (20/150 mbps)

This is my first time posting here, I’ve been researching my problem online and haven’t been having much luck. If I make an egregious etiquette error, please let me know, and I’ll try and update / edit my post.

Here’s the problem: I’m using an old TP-link usb wifi adapter to access my home network from a pc I built maybe 6 ish years ago, and I’m not getting anything like the speed that I should be getting from it (the adapter says it caps out at 150 mbps, my home network goes up to 200 mbps). I’m only getting 20. Previously I was only getting 9, but after wrangling with dnsmasq, I saw some (minor) improvement. Still not what it should be.

I’ve been having a slew of unrelated hardware and software issues, because I didn’t do the best job when I built this thing (I was 16 at the time), but I like to think that I know (mostly) what I’m doing now, after having worked with PC’s and Linux operating systems for a while, building my own arch and gentoo installs from scratch, etc. I don’t think my ISP is throttling my connection (though I don’t know for sure), and I’ve messed around with my steam settings already to make sure it wasn’t a steam problem. I’ve picked my tower up and thrust it into the air to see if that was the problem, but… it wasn’t.

I still can’t figure out why my network speed is so low.

Here’s the output of inxi -Fazy:

System:
  Kernel: 6.6.8-2-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: hpet available: acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.6-x86_64
    root=UUID=6f7f115f-be6f-4f1a-adec-4a9b404807de rw quiet splash
    udev.log_priority=3
  Desktop: KDE Plasma v: 5.27.10 tk: Qt v: 5.15.11 wm: kwin_x11 vt: 2
    dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Desktop Mobo: ASRock model: X570 Phantom Gaming 4
    serial: <superuser required> UEFI-[Legacy]: American Megatrends v: P2.20
    date: 11/25/2019
CPU:
  Info: model: AMD Ryzen 3 3200G with Radeon Vega Graphics bits: 64 type: MCP
    arch: Zen/Zen+ note: check gen: 1 level: v3 note: check built: 2019
    process: GF 12nm family: 0x17 (23) model-id: 0x18 (24) stepping: 1
    microcode: 0x8108109
  Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 384 KiB
    desc: d-4x32 KiB; i-4x64 KiB L2: 2 MiB desc: 4x512 KiB L3: 4 MiB
    desc: 1x4 MiB
  Speed (MHz): avg: 2312 high: 2955 min/max: 1400/3600 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 2112 2: 2955
    3: 2949 4: 1235 bogomips: 28811
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed mitigation: untrained return thunk; SMT disabled
  Type: spec_rstack_overflow mitigation: SMT disabled
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
    disabled, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
    vendor: Micro-Star MSI driver: amdgpu v: kernel arch: GCN-4
    code: Arctic Islands process: GF 14nm built: 2016-20 pcie: gen: 3
    speed: 8 GT/s lanes: 8 link-max: lanes: 16 ports: active: DVI-D-1
    empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 01:00.0 chip-ID: 1002:67df
    class-ID: 0300 temp: 37.0 C
  Display: x11 server: X.Org v: 21.1.10 compositor: kwin_x11 driver: X:
    loaded: amdgpu unloaded: modesetting alternate: fbdev,vesa dri: radeonsi
    gpu: amdgpu display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93") monitors: <missing: xrandr>
  Monitor-1: DVI-D-1 model: Acer X233H serial: <filter> built: 2009
    res: 1920x1080 dpi: 96 gamma: 1.2 size: 510x287mm (20.08x11.3")
    diag: 585mm (23") ratio: 16:9 modes: max: 1920x1080 min: 720x400
  API: EGL v: 1.5 hw: drv: amd radeonsi platforms: device: 0 drv: radeonsi
    device: 1 drv: swrast surfaceless: drv: radeonsi x11: drv: radeonsi
    inactive: gbm,wayland
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 23.1.9-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: AMD Radeon RX 580 Series (polaris10
    LLVM 16.0.6 DRM 3.54 6.6.8-2-MANJARO) device-ID: 1002:67df memory: 7.81 GiB
    unified: no
  API: Vulkan v: 1.3.274 layers: N/A device: 0 type: discrete-gpu name: AMD
    Radeon RX 580 Series (RADV POLARIS10) driver: mesa radv
    v: 23.1.9-manjaro1.1 device-ID: 1002:67df surfaces: xcb,xlib
Audio:
  Device-1: AMD Family 17h/19h HD Audio vendor: ASRock driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 08:00.6
    chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.6.8-2-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 1.0.0 status: off with: pipewire-media-session
    status: active tools: pw-cli
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl
Network:
  Device-1: Intel I211 Gigabit Network vendor: ASRock driver: igb v: kernel
    pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 04:00.0
    chip-ID: 8086:1539 class-ID: 0200
  IF: enp4s0 state: down mac: <filter>
  Device-2: TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS] driver: rtl8xxxu
    type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-4:2
    chip-ID: 2357:010c class-ID: 0000 serial: <filter>
  IF: wlp5s0f1u4 state: up mac: <filter>
Drives:
  Local Storage: total: 931.51 GiB used: 22.29 GiB (2.4%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Samsung model: HD103SI size: 931.51 GiB
    block-size: physical: 512 B logical: 512 B speed: 3.0 Gb/s tech: N/A
    serial: <filter> fw-rev: 1118 scheme: MBR
Partition:
  ID-1: / raw-size: 441.07 GiB size: 433.08 GiB (98.19%) used: 22.29 GiB (5.1%)
    fs: ext4 dev: /dev/sda4 maj-min: 8:4
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 48.6 C mobo: N/A gpu: amdgpu temp: 35.0 C
  Fan Speeds (rpm): N/A gpu: amdgpu fan: 1485
Info:
  Processes: 266 Uptime: 1h 9m wakeups: 0 Memory: total: 8 GiB
  available: 7.68 GiB used: 3.96 GiB (51.6%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: 1177 pm: pacman pkgs: 1164 libs: 341 tools: pamac pm: flatpak
  pkgs: 13 Shell: Zsh v: 5.9 default: Bash v: 5.2.21 running-in: konsole
  inxi: 3.3.31

Let me know if you have any questions, or if I can provide any additional info. Thanks!

1 Like

Hi there,

Thanks for including system info :slight_smile:

I guess lets start with that.

Did you install any packages or drivers for it?

pacman -Qs rtl8

Any options?

modinfo -p rtl8xxxu

EDIT

Wait … so … its just steam?
You didnt check any other measurements (like even speedtest.net) ?

Of course! Thanks for your help.

–The issue isn’t just with steam; sorry for the confusion. I read somewhere previously that steam in particular can cause some system-wide issues, so I wanted to make sure that it wasn’t that, and I don’t think it was. Speedtest returns between 15 and 20 mbps.

pacman -Qs rtl8

returns nothing.

modinfo -p rtl8xxxu

returns

debug:Set debug mask (int)
ht40_2g:Enable HT40 support on the 2.4GHz band (bool)
dma_aggregation:Enable DMA packet aggregation (bool)
dma_agg_timeout:Set DMA aggregation timeout (range 1-127) (int)
dma_agg_pages:Set DMA aggregation pages (range 1-127, 0 to disable) (int)

–someone else (on another topic) mentioned that my BIOS is pretty out of date (2019). I wonder if that could be the issue? The TP-link adapter (model no. TL-WN722N) came out in 2020.

Your BIOS is indeed out of date … with various improvements including Ryzen support, USB compatibility, etc.

So yeah I would do that if I were you. If my search is correct
https://pg.asrock.com/mb/AMD/X570%20Phantom%20Gaming%204/index.asp#BIOS

So I guess its just the one from the kernel then.
(support for the rtl8xxxu module was added in kernel 6.3 or so)

We can keep trying this. The BIOS, some of those options, disable powersaving, etc.

Maybe another check with

iw dev wlp5s0f1u4 link | grep -v SSID

(grep to hide the SSID cuz we dont need that :wink:)

But its possible the module is finicky for your hardware, in which case you might try the AUR package
8188-eu-dkms. ex

pamac build 8188eu-dkms

If you go that route make sure to blacklist the rtl8xxxu module, ex:

echo 'blacklist rtl8xxxu' | sudo tee /etc/modprobe.d/blacklist-rtl8xxxu.conf

(and reboot to observe changes)

Yep, that checks out. Semi-relatedly, some research has yielded that TP-Link was at one point developing a version of their proprietary driver for linux, but stopped the development process a couple of years ago; I was able to download a zip with a makefile, but had trouble compiling it, probably because the beta was developed for linux 4.x.

First thing I’m going to try is updating the BIOS, once my 32GB flashdrive arrives. In the meantime, the output of

iw dev wlp5s0f1u4 link | grep -v SSID

is

Connected to [redacted] (on wlp5s0f1u4)
        freq: 2437.0
        RX: 39023567 bytes (142023 packets)
        TX: 6330344 bytes (27166 packets)
        signal: -65 dBm
        rx bitrate: 52.0 MBit/s MCS 5
        tx bitrate: 39.0 MBit/s MCS 4
        bss flags: short-preamble short-slot-time
        dtim period: 2
        beacon int: 100

which means very little to me; but you might make something of it.

Also, I’ve checked, and I believe powersaving is turned off, so that narrows it down just a little bit.

Oh, please remove the first line from the iw output. :blush:

Well, if the update cant be done until later … we can still try some of the things.

options for the module:

echo 'options rtl8xxxu ht40_2g=1 dma_aggregation=1' | sudo tee /etc/modprobe.d/rtl8xxxu.conf

(reboot)

This would enable High Throughput for the 2.4ghz, and enable “dma aggreggation”, which frankly … is not really documented.
From what I can find … the module may not even be able to support 5ghz … so pumping up the 2.4 should help.


Multiple powersaving approaches;

  • Check iw powersave
    iw dev wlp5s0f1u4 get power_save

  • One line to instruct iw to disable powersave
    sudo iw dev wlp5s0f1u4 set power_save off

  • Udev rule to use iw to disable powersave all the time
    /etc/udev/rules.d/81-wifi-powersave.rules

ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", RUN+="/usr/bin/iw dev $name set power_save off"
  • NetworkManager powersaving (only do this if you really need to)
    /etc/NetworkManager/conf.d/10-wifi-powersaving-off.conf
[connection]
wifi.powersave = 2

Reboot in between changes to see impact.


Remember any of these can be removed by deleting the file containing the configs.


And dont forget to give the AUR package a try if only as an observation… as it is known to support some devices that this new in-kernel module does not.

I tried

echo 'options rtl8xxxu ht40_2g=1 dma_aggregation=1' | sudo tee /etc/modprobe.d/rtl8xxxu.conf

And rebooted; now I seem to be back down to 9 mbps from 20, but that might be because in the intervening time I messed something else up (this morning I opened up the case and upgraded my ram, and inadvertently caused my graphics card to come unseated, which usually isn’t a problem as I can easily re-seat it, but sometimes it gets quirky when I try and flip my tower back up to a vertical position, so it’s lying on its side right now, which might be affecting the antenna’s reception). Anyway, 9 or 20 mpbs is probably still too low either way, so I think it’s a safe bet that High Throughput and dma aggregation didn’t fix the underlying problem… I’ll see how it performs when I do manage to get it sitting upright without causing it to fail on boot.

ahm. I also tried to check the powersave setting, using these commands:

 iw dev wlp5s0f1u4 link | grep -v SSID                                                      237 ✘ 

returned

command failed: No such device (-19)

and the second command returned the same.

Haven’t tried altering the config files yet, I’m going to actually flash my BIOS now because my flashdrive arrived in the mail.

Also: Thanks for reminding me to redact that line!

I suppose the device changed?
You can look again with something like

inxi -nz

As to the options … you can remove them again, ex:

sudo rm /etc/modprobe.d/rtl8xxxu.conf

Ok:

Network:
  Device-1: Intel I211 Gigabit Network driver: igb
  IF: enp4s0 state: down mac: <filter>
  Device-2: TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS] driver: rtl8xxxu
    type: USB
  IF: wlp5s0f3u6 state: up mac: <filter>

This is after flashing the BIOS to the latest version, by the way. Issue seems the same, though I’m back at around 15 mbps.

Edit: After removing the options and rebooting, speedtest now yields 1 mbps… agh

So thats the device now.

The driver is the same … so any of the above options can be reapplied, but any of the other query/powersave/etc commands need use this address instead of the previous one.

Play around to see what you can get ‘best’ out of those options …

if still unsatisfactory … give the AUR package a try (and blacklist current module).