Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project: Add 8821/11au rtw88 in-kernel driver. Need testers... #133

Open
morrownr opened this issue Apr 30, 2024 · 206 comments
Open

Project: Add 8821/11au rtw88 in-kernel driver. Need testers... #133

morrownr opened this issue Apr 30, 2024 · 206 comments

Comments

@morrownr
Copy link
Owner

morrownr commented Apr 30, 2024

Greetings to anyone that reads this message.

This Issue is where we coordinate and take bug report for the new 8821a in-kernel driver.

An effort is underway to add support for the rtl8821/11au chipset to the rtw88 in-kernel driver series. The driver is available for testing at the following repo:

https://github.com/lwfinger/rtw88

Remember to first remove the out-of-kernel driver in this repo or whatever repo you may have installed. You can run the following to remove it if using this repo:

$ sudo sh remove-driver.sh

It is important to follow the instructions in the README at the repo with the new test driver. You may not be familiar with rtw88 in the kernel but even if you are, there are some necessary mods that you need to know about. The rtw88 that has this new driver is more advanced than the rtw88 in stable kernels as it follows wireless-next and is used to work on and develop new drivers.

We welcome you to test and report on this new driver. Your testing will help us get this new driver in the Linux kernel sooner and in better shape. We do have specific needs. The most immediate need is to find users that have adapters that have bluetooth support (rtl8821au chip). The current developers only have adapters that have rtl8811au chips so we need help. We also need testers with old laptps that have the rtl8821ae chip.

If you are aware of anyone who is familiar with mac80211 drivers, please invite them as more eyes on the code is a good thing. Your ideas are most welcome. We can do this.

@morrownr

Status report:

  • Managed mode (client) appears to be in really good shape. No outstanding issues.

  • Monitor mode appears to be in good shape but Active Monitor mode is not supported yet.

  • AP mode is in good shape but AP Mode DFS channels are not supported (this common on usb wifi adapters). This is an issue that needs to be investigated but should not slow down the upstreaming of this driver.

  • P2P mode is in good shape.

  • IBSS mode has not been tested yet. Please test and report.

Overall: the driver appears to be in good shape. Please test and report your results.

@lwfinger
Copy link

lwfinger commented May 5, 2024

I get a maximum of 130 Mbps transmit and 93 RX with iperf3. LibreSpeed gets 119 down and 113 up.

@lwfinger
Copy link

lwfinger commented May 6, 2024

The master branch now contains all of dubhater's changes for the RTW8821AU and RTW8812AU, and the driver works. I have not removed any of the other branches until the code is checked a bit more, but please test everything. The speeds are still on the low side, but that will come.

@morrownr
Copy link
Owner Author

morrownr commented May 6, 2024

@lwfinger

The master branch now contains all of dubhater's changes for the RTW8821AU and RTW8812AU, and the driver works.

Thanks. I'll start testing and adding additional vid/pids for rtw8812au.

@dubhater

As you ready for rtw8812au to be tested or just rtw8821au?

@morrownr
Copy link
Owner Author

morrownr commented May 6, 2024

Initital testing of rtw88 master:

$ iperf3 -c 192.168.1.1
Connecting to host 192.168.1.1, port 5201
[  5] local 192.168.1.172 port 57430 connected to 192.168.1.1 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  28.6 MBytes   240 Mbits/sec    0    526 KBytes       
[  5]   1.00-2.00   sec  25.4 MBytes   213 Mbits/sec    0    526 KBytes       
[  5]   2.00-3.00   sec  25.5 MBytes   214 Mbits/sec    0    526 KBytes       
[  5]   3.00-4.00   sec  25.5 MBytes   214 Mbits/sec    0    551 KBytes       
[  5]   4.00-5.00   sec  25.7 MBytes   216 Mbits/sec    0    551 KBytes       
[  5]   5.00-6.00   sec  25.7 MBytes   216 Mbits/sec    0    551 KBytes       
[  5]   6.00-7.00   sec  26.5 MBytes   222 Mbits/sec    0    577 KBytes       
[  5]   7.00-8.00   sec  24.2 MBytes   203 Mbits/sec    0    577 KBytes       
[  5]   8.00-9.00   sec  25.5 MBytes   214 Mbits/sec    0    577 KBytes       
[  5]   9.00-10.00  sec  25.6 MBytes   215 Mbits/sec    0    577 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   258 MBytes   217 Mbits/sec    0             sender
[  5]   0.00-10.01  sec   256 MBytes   214 Mbits/sec                  receiver

iperf Done.

I ran iperf3 several times with my primary testing setup. Speed looks really good. Around 220 Mbps is about as fast as this chip can go if the out-of-kernel results over the last few years are good. The test above is on a DFS channel where there is no congestion. dmesg is clean. I'm impressed so far.

Monitor mode frame injection test:

$ sudo aireplay-ng --test wlx00c0caac47c7
[sudo] password for morrow:         
13:40:39  Trying broadcast probe requests...
13:40:39  Injection is working!
13:40:41  Found 12 APs

13:40:41  Trying directed probe requests...
13:40:41  C6:BE:59:93:4F:3B - channel: 44 - ''
13:40:43  Ping (min/avg/max): 2.473ms/9.155ms/17.771ms Power: -81.38
13:40:43  21/30:  70%

13:40:43  10:33:BF:60:FA:3B - channel: 44 - 'CoxWiFi'
13:40:43  Ping (min/avg/max): 1.548ms/5.636ms/8.924ms Power: -39.00
13:40:43  29/30:  96%

13:40:43  08:A7:C0:14:81:DA - channel: 44 - 'Wade Wifi'
13:40:47  Ping (min/avg/max): 10.801ms/17.700ms/27.914ms Power: -76.69
13:40:47  13/30:  43%

13:40:47  08:A7:C0:14:81:DF - channel: 44 - ''
13:40:51  Ping (min/avg/max): 14.111ms/22.023ms/39.249ms Power: -76.83
13:40:51  12/30:  40%

13:40:51  CC:BE:59:93:4F:3B - channel: 44 - 'SKHutch5'
13:40:52  Ping (min/avg/max): 2.017ms/6.207ms/20.025ms Power: -80.83
13:40:52  24/30:  80%

13:40:52  08:A7:C0:14:81:DD - channel: 44 - ''
13:40:57  Ping (min/avg/max): 10.314ms/21.516ms/31.877ms Power: -77.00
13:40:57  10/30:  33%

13:40:57  C2:BE:59:93:4F:3B - channel: 44 - ''
13:40:59  Ping (min/avg/max): 7.544ms/18.691ms/34.159ms Power: -79.70
13:40:59  20/30:  66%

13:40:59  10:33:BF:60:FA:3A - channel: 44 - ''
13:41:00  Ping (min/avg/max): 3.128ms/9.390ms/16.078ms Power: -38.93
13:41:00  28/30:  93%

13:41:00  10:33:BF:60:FA:3E - channel: 44 - ''
13:41:00  Ping (min/avg/max): 1.213ms/8.218ms/20.971ms Power: -38.80
13:41:00  30/30: 100%

13:41:00  08:A7:C0:14:81:DC - channel: 44 - 'CoxWiFi'
13:41:04  Ping (min/avg/max): 6.712ms/18.391ms/26.479ms Power: -77.00
13:41:04   9/30:  30%

13:41:04  08:A7:C0:14:81:DB - channel: 44 - ''
13:41:09  Ping (min/avg/max): 12.830ms/20.560ms/26.364ms Power: -77.00
13:41:09   9/30:  30%

13:41:09  10:33:BF:60:FA:3C - channel: 44 - ''
13:41:09  Ping (min/avg/max): 2.109ms/8.086ms/23.178ms Power: -38.93
13:41:09  28/30:  93%

Going in and out of monitor mode works well and things look like they should. The injection test above showed very good results. So far monitor mode looks good.

I will do more detailed test on managed and monitor mode as able this week and I plan to test AP mode and
P2P-client. So far, this driver looks good.

I plan to rework the first message in this thread to provide instructions to those who can test/report as most will not be used to the instructions for getting this driver going,

I am still looking for someone with a rtl8821au based adapter and someone with an old laptop with a rtl8821ce chip in it so we can test bluetooth.

@morrownr

Repository owner deleted a comment from dubhater May 6, 2024
Repository owner deleted a comment from dubhater May 6, 2024
Repository owner deleted a comment from dubhater May 6, 2024
Repository owner deleted a comment from lwfinger May 6, 2024
Repository owner deleted a comment from dubhater May 6, 2024
Repository owner deleted a comment from lwfinger May 6, 2024
Repository owner deleted a comment from dubhater May 6, 2024
Repository owner deleted a comment from lwfinger May 6, 2024
Repository owner deleted a comment from lwfinger May 6, 2024
@dubhater
Copy link

dubhater commented May 6, 2024

@morrownr rtw_8812au is not ready yet.

I can see some RTL8821AE on Aliexpress, both M.2 and mini PCIe.

Repository owner deleted a comment from dubhater May 6, 2024
@morrownr
Copy link
Owner Author

morrownr commented May 6, 2024

@dubhater

I can see some RTL8821AE on Aliexpress, both M.2 and mini PCIe.

Give me a chance to round up some testers that already have the chips. We can always go get one if we have to do so. This repo gets over 100 hits per day so there are a lot of users of this chip. I just need to work on getting them in here now that we have something for them to test. I'll work it.

I'm impressed with this driver so far. We'll find problems but so far it is working well. My opinion after a few years of supporting out-of-kernel drivers for both the rtl8821au and rtl8821cu is that the au is simply a more reliable chip that causes users far fewer problems.

@morrownr

@gmsanchez
Copy link

@morrownr

I have a TP-Link Archer T2U PLUS [RTL8821AU]. I removed this kernel module using $ sudo sh remove-driver.sh and installed rtw88 using the provided readme on Kubuntu 24.04

So far everything is working good. I am willing to help, but I don't have a lot of experience in this field. Are there any instructions to run the required tests? Just let me know.

@morrownr
Copy link
Owner Author

morrownr commented May 8, 2024

Hi @gmsanchez

Thanks for testing.

Are there any instructions to run the required tests?

Do you have any experience using any modes in addition to managed (client) mode?

Please document your distro and version here and post the results of the following:

$ uname -r
$ gcc --version

Do you know of a way to test your speed? If so, do it.

Post the results of:

$ sudo dmesg | grep rtw

Since you have an adapter with the version of the chip that has bluetooth support, can you verify that bluetooth is working correctly?

Post the results of:

$ lsusb

If your adapter has an LED, does it blink?

Lastly, just use it. See if anything goes wrong over the next few days. Keep us posted.

You may also get questions from @dubhater and @lwfinger .

@morrownr

@gmsanchez
Copy link

gmsanchez commented May 8, 2024

Do you know of a way to test your speed? If so, do it.

I don't know how to test my speed.

Since you have an adapter with the version of the chip that has bluetooth support, can you verify that bluetooth is working correctly?

I don't have any bluetooth device on my system.

If your adapter has an LED, does it blink?

I'll move the adapter to the front and check the LED status.

In the meantime, the requested output of the commands is below:

$ uname -r
6.8.0-31-generic
$ gcc --version
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ sudo dmesg | grep rtw
[    3.848959] rtw_core: loading out-of-tree module taints kernel.
[    3.848966] rtw_core: module verification failed: signature and/or required key missing - tainting kernel
[    3.874055] rtw_8821au 3-1:1.0: Firmware version 42.4.0, H2C version 0
[    3.915832] usbcore: registered new interface driver rtw_8821au
[    3.919055] rtw_8821au 3-1:1.0 wlx6c5ab0d0395d: renamed from wlan0
[    6.110598] rtw_8821au 3-1:1.0: MAC has not been powered on yet
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 002 Device 004: ID 046d:c077 Logitech, Inc. Mouse
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 2357:0120 TP-Link Archer T2U PLUS [RTL8821AU]
Bus 003 Device 003: ID 046d:08e4 Logitech, Inc. C505e HD Webcam
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

@morrownr
Copy link
Owner Author

morrownr commented May 8, 2024

@dubhater

rtw88 master - rtw_8821au

I am seeing the below during compilation. This is with Debian 12 and kernels 6.1 LTS and 6.6 LTS plus gcc 12.2. This not fatal but...

  CC [M]  /home/morrow/src/rtw88/rtw8821a.o
  CC [M]  /home/morrow/src/rtw88/rtw8821a_table.o
In file included from /usr/src/linux-headers-6.1.0-21-common/include/linux/kernel.h:26,
                 from /usr/src/linux-headers-6.1.0-21-common/arch/x86/include/asm/percpu.h:27,
                 from /usr/src/linux-headers-6.1.0-21-common/arch/x86/include/asm/current.h:6,
                 from /usr/src/linux-headers-6.1.0-21-common/include/linux/sched.h:12,
                 from /usr/src/linux-headers-6.1.0-21-common/include/linux/delay.h:23,
                 from /usr/src/linux-headers-6.1.0-21-common/include/linux/usb.h:15,
                 from /home/morrow/src/rtw88/rtw8821a.c:5:
/home/morrow/src/rtw88/rtw8821a.c: In function ‘rtw8821a_tx_power_training’:
/usr/src/linux-headers-6.1.0-21-common/include/linux/minmax.h:20:35: warning: comparison of distinct pointer types lacks a cast
   20 |         (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
      |                                   ^~
/usr/src/linux-headers-6.1.0-21-common/include/linux/minmax.h:26:18: note: in expansion of macro ‘__typecheck’
   26 |                 (__typecheck(x, y) && __no_side_effects(x, y))
      |                  ^~~~~~~~~~~
/usr/src/linux-headers-6.1.0-21-common/include/linux/minmax.h:36:31: note: in expansion of macro ‘__safe_cmp’
   36 |         __builtin_choose_expr(__safe_cmp(x, y), \
      |                               ^~~~~~~~~~
/usr/src/linux-headers-6.1.0-21-common/include/linux/minmax.h:52:25: note: in expansion of macro ‘__careful_cmp’
   52 | #define max(x, y)       __careful_cmp(x, y, >)
      |                         ^~~~~~~~~~~~~
/home/morrow/src/rtw88/rtw8821a.c:2481:31: note: in expansion of macro ‘max’
 2481 |                 write_data |= max(power_level, 2) << (i * 8);
      |                               ^~~

@lwfinger
Copy link

lwfinger commented May 8, 2024

The problem is that the code used max(a,b), whereas it should have been max_t(u32,a,b). It now compiles cleanly on openSUSE Tumbleweed and Debian 12.

@morrownr
Copy link
Owner Author

morrownr commented May 9, 2024

@gmsanchez

I don't know how to test my speed.

You can give the following site a try for basic speed testing:

https://testmy.net/

Most of us use iperf3 on our local lans for speed testing. Do you have a RasPi on your local lan or a wifi router that runs OpenWRT?

I don't have any bluetooth device on my system.

It looked like you might have a version of the chipset that includes bluetooth support so I was looking to see if the bluetooth in your adapter was working. Maybe you have a chip that is wifi only.

[ 6.110598] rtw_8821au 3-1:1.0: MAC has not been powered on yet

Let me think out loud here for a moment. I am trying to sort out why the above line is needed. What is it doing for us?

Thanks for the info and we'll be waiting for additional reports.

@morrownr

@morrownr
Copy link
Owner Author

morrownr commented May 9, 2024

@lwfinger

The problem is that the code used max(a,b), whereas it should have been max_t(u32,a,b). It now compiles cleanly on openSUSE Tumbleweed and Debian 12.

Awesome! Clean compile here.

FYI: I'll be moving to AP mode testing soon. So far, managed and monitor modes look really good but my AP mode testing will take me to another distro and ARM64.

@morrownr
Copy link
Owner Author

morrownr commented May 9, 2024

@dubhater @lwfinger

Here is a very minor nitpick:

Screenshot from 2024-05-09 14-58-12

When I run iperf3, I am seeing drop (in the statistics box) increase regularly. With other wireless devices I am more used to it not increasing or occasionally incrementing but not as regularly as I am seeing here. Do we have a buffer set slightly smaller than it needs to be?

Like I said, nitpick. I am having a difficult time finding any problems with managed and monitor modes.

I am off to test AP mode.

@morrownr

@lwfinger
Copy link

Do you see any WARNINGS in your logs like this "WARNING: CPU: 3 PID: 36 at net/mac80211/rx.c"? Your CPU and PID will be different. That may be the source of your drops.

I have a patch to silence the WARNINGS, but the drops are not fixed as the packets are malformed.

What is the utility that produced the screenshot? I am not familiar with anything like it.

@5kft
Copy link
Contributor

5kft commented May 10, 2024

@morrownr I'm using a Debian-based custom arm64/armhf distribution, and as such I can't build the rtw88 driver via @lwfinger's process (I didn't bother to try to address this further). Instead, I simply removed the original mainline (6.9-rc7) rtw88 driver source and replaced it completely with @lwfinger's version from his github.

Now, when building this new version of rtw88 I am getting errors relating to the PCI driver module support or something (see errors below). My kernel configuration does not enable CONFIG_PCI, just in case this might be related. I haven't debugged the new in-kernel rtw88 build process any further. I'm pointing this out just in case there is an oversight in this new rtw88 code for non-CONFIG_PCI and/or ARM builds (or something).

As a comparison, the mainline 6.9-rc7 rtw88 driver builds completely fine - without any errors - so there does appear to be a regression in this new version of the driver source.

In my kernel config I am only enabling the the 8821CU module, so it is kind of odd that the build is erroring out for driver sources that aren't even enabled:

CONFIG_RTW88=m
CONFIG_RTW88_CORE=m
CONFIG_RTW88_USB=m
CONFIG_RTW88_8821C=m
# CONFIG_RTW88_8822BS is not set
# CONFIG_RTW88_8822BU is not set
# CONFIG_RTW88_8822CS is not set
# CONFIG_RTW88_8822CU is not set
# CONFIG_RTW88_8723DS is not set
# CONFIG_RTW88_8723DU is not set
# CONFIG_RTW88_8821CS is not set
CONFIG_RTW88_8821CU=m
# CONFIG_RTW88_DEBUG is not set
# CONFIG_RTW88_DEBUGFS is not set

Build errors:

drivers/net/wireless/realtek/rtw88/rtw8822be.c:27:1: warning: data definition has no type or storage class
   27 | module_pci_driver(rtw_8822be_driver);
      | ^~~~~~~~~~~~~~~~~
drivers/net/wireless/realtek/rtw88/rtw8822be.c:27:1: error: type defaults to ‘int’ in declaration of ‘module_pci_driver’ [-Werror=implicit-int]
drivers/net/wireless/realtek/rtw88/rtw8822be.c:27:1: warning: parameter names (without types) in function declaration
drivers/net/wireless/realtek/rtw88/rtw8822be.c:19:26: warning: ‘rtw_8822be_driver’ defined but not used [-Wunused-variable]
   19 | static struct pci_driver rtw_8822be_driver = {
      |                          ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[7]: *** [scripts/Makefile.build:244: drivers/net/wireless/realtek/rtw88/rtw8822be.o] Error 1
make[7]: *** Waiting for unfinished jobs....
drivers/net/wireless/realtek/rtw88/rtw8822ce.c:31:1: warning: data definition has no type or storage class
   31 | module_pci_driver(rtw_8822ce_driver);
      | ^~~~~~~~~~~~~~~~~
drivers/net/wireless/realtek/rtw88/rtw8822ce.c:31:1: error: type defaults to ‘int’ in declaration of ‘module_pci_driver’ [-Werror=implicit-int]
drivers/net/wireless/realtek/rtw88/rtw8822ce.c:31:1: warning: parameter names (without types) in function declaration
drivers/net/wireless/realtek/rtw88/rtw8822ce.c:23:26: warning: ‘rtw_8822ce_driver’ defined but not used [-Wunused-variable]
   23 | static struct pci_driver rtw_8822ce_driver = {
      |                          ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[7]: *** [scripts/Makefile.build:244: drivers/net/wireless/realtek/rtw88/rtw8822ce.o] Error 1
make[6]: *** [scripts/Makefile.build:485: drivers/net/wireless/realtek/rtw88] Error 2
make[5]: *** [scripts/Makefile.build:485: drivers/net/wireless/realtek] Error 2
make[4]: *** [scripts/Makefile.build:485: drivers/net/wireless] Error 2
make[3]: *** [scripts/Makefile.build:485: drivers/net] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2

@5kft
Copy link
Contributor

5kft commented Aug 10, 2024

I took a quick look and rtw_rx_fill_rx_status is not in "sync" with rtw8821a_query_phy_status - when pkt_stat->signal_power is set, then the fill is correct - but the fill will return a signal value of zero when the phy query isn't performed;

[   37.287992] rtw_rx_fill_rx_status: rx_status->signal=-54
[   37.288507] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   37.288513] rtw_rx_fill_rx_status: rx_status->signal=-54
[   37.390806] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   37.390835] rtw_rx_fill_rx_status: rx_status->signal=-54
[   37.493196] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   37.493220] rtw_rx_fill_rx_status: rx_status->signal=-54
[   37.595676] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   37.595710] rtw_rx_fill_rx_status: rx_status->signal=-54
[   37.698080] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   37.698114] rtw_rx_fill_rx_status: rx_status->signal=-54
[   37.800470] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   37.800507] rtw_rx_fill_rx_status: rx_status->signal=-54
[   37.902951] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   37.902986] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.005265] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.005296] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.037262] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.041374] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.050195] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.107697] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.107739] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.210124] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.210157] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.284895] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.312507] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.312519] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.414755] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.414767] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.516503] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.517427] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.517443] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.574145] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.593261] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.619754] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.619772] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.629379] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.651378] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.722000] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.722007] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.739496] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.791004] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.808123] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.824505] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.824518] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.852873] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.885177] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.926905] rtw8821a_query_phy_status: pkt_stat->signal_power=-54
[   38.926939] rtw_rx_fill_rx_status: rx_status->signal=-54
[   38.930138] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.982125] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.986417] rtw_rx_fill_rx_status: rx_status->signal=0
[   38.999629] rtw_rx_fill_rx_status: rx_status->signal=0
[   39.003895] rtw8821a_query_phy_status: pkt_stat->signal_power=-44
[   39.003917] rtw_rx_fill_rx_status: rx_status->signal=-44
[   39.007788] rtw8821a_query_phy_status: pkt_stat->signal_power=-44
[   39.007806] rtw_rx_fill_rx_status: rx_status->signal=-44
[   39.012690] rtw8821a_query_phy_status: pkt_stat->signal_power=-44
[   39.012714] rtw_rx_fill_rx_status: rx_status->signal=-44

@dubhater
Copy link

dubhater commented Aug 10, 2024

That explains it. Now to find out why some frames don't have the PHY status. This is controlled by BIT_APP_PHYSTS in REG_RCR. As far as I can tell it's never cleared.

Is it the same with rtw8811a_fw.bin?

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821a.c b/drivers/net/wireless/realtek/rtw88/rtw8821a.c
index f69e60a06719..41fd7d82cb67 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821a.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821a.c
@@ -3974,7 +3974,7 @@ static const struct rtw_reg_domain coex_info_hw_regs_8821a[] = {
 const struct rtw_chip_info rtw8821a_hw_spec = {
 	.ops = &rtw8821a_ops,
 	.id = RTW_CHIP_TYPE_8821A,
-	.fw_name = "rtw88/rtw8821a_fw.bin",
+	.fw_name = "rtw88/rtw8811a_fw.bin",
 	.wlan_cpu = RTW_WCPU_11N,
 	.tx_pkt_desc_sz = 40,
 	.tx_buf_desc_sz = 16,

@5kft
Copy link
Contributor

5kft commented Aug 10, 2024

Is it the same with rtw8811a_fw.bin?

I'd be happy to try this, but I can't find rtw8811a_fw.bin anywhere. It's not in lwfinger/rtw88/firmware/, nor in the latest Debian firmware-realtek_20240709-1_all.deb package, and Google returns zero results when searching for this file... (I'm running Debian Bookworm...) Hope I'm not missing something obvious here...

@dubhater
Copy link

I'm not sure what happened to it. You can still find it here: https://github.com/lwfinger/rtw88/blob/8821au_8812au/rtw8811a_fw.bin

@a5a5aa555oo
Copy link

@dubhater

I checked commit history in one year, it looks like rtw8811a_fw.bin is never in the master branch.
You said rtw8811a_fw.bin is needed by RTL8811AU, should I add it into master branch? or you will add by yourself?

@a5a5aa555oo
Copy link

Note that my adapter shows as this (via lsusb):

Bus 004 Device 002: ID 0bda:0811 Realtek Semiconductor Corp. Realtek 8812AU/8821AU 802.11ac WLAN Adapter [USB Wireless Dual-Band Adapter 2.4/5Ghz]

I think we should inform the author of hwdata to correct it, your adapter has a RTL8811AU chip actually.
https://github.com/vcrhonek/hwdata/blob/master/usb.ids#L14015

@5kft
Copy link
Contributor

5kft commented Aug 11, 2024

@dubhater The "zero signal strength" problem actually occurs when signal strength is queried while wireless traffic is taking place. The same problem happens with the rtw8811a_fw.bin firmware as well - there is no change in behavior between the two firmwares.

I found that if I connect to the board via serial console (i.e., not via ssh over Wi-Fi), and then run iw wlan0 link, then the signal strength for the adapter is always correctly reported (i.e., non-zero). However, when Wi-Fi traffic is being sent over the adapter, then the signal strength is mostly reported as zero (sometimes it is correct, as noted above). I verified this by running a long iperf session over Wi-Fi while querying signal strength via the serial console.

If I ssh into the board via Wi-Fi and do the query, it is almost always reported as zero because Wi-Fi traffic is being transferred for the ssh session.

@morrownr
Copy link
Owner Author

I think we should inform the author of hwdata to correct it, your adapter has a RTL8811AU chip actually.

That is a good idea but there are likely several ID descriptions that need correcting. I authored the vid/pid files for the rtw_8812au and rtw8821/11au in Larry's rtw88 so I know they are accurate. Are you volunteering to handle this?

Here is the history in case you haven't been watching this for the last 10+ years: Realtek's original, and for a few versions, vendor driver was a combined driver for the rtl8812au, rtl8821au and rtl8811au chips. Then about 5 or so years ago, they released separate drivers which has led to a lot of confusion in the years since. The bug reports that I get these days are mostly ones when I have to send users to the other driver. This is confusion that needs to go away. Getting the drivers in mainline will help we still need the ID wordage to be accurate.

@dubhater
Copy link

@a5a5aa555oo rtw8821a_fw.bin has worked fine so far, so we don't need rtw8811a_fw.bin.

I opened a pull request to correct the description of 0bda:1a2b. It was rejected because that repository is not the right place for it. They directed me to http://www.linux-usb.org/usb-ids.html. I'm still waiting to hear back. The current list of IDs is from July, so there is hope.

@a5a5aa555oo
Copy link

@dubhater

I read the guideline and found it hard to correct them but im trying it with 0bda:1a2b and 0bda:2005~

@a5a5aa555oo
Copy link

a5a5aa555oo commented Aug 11, 2024

I submitted some change requests to that site, but I don't know if they will accept them. :(

https://usb-ids.gowdy.us/read/UD/0bda/2005
https://usb-ids.gowdy.us/read/UD/0bda/1a2b
https://usb-ids.gowdy.us/read/UD/0bda/0811

That is a good idea but there are likely several ID descriptions that need correcting. I authored the vid/pid files for the rtw_8812au and rtw8821/11au in Larry's rtw88 so I know they are accurate. Are you volunteering to handle this?

Here is the history in case you haven't been watching this for the last 10+ years: Realtek's original, and for a few versions, vendor driver was a combined driver for the rtl8812au, rtl8821au and rtl8811au chips. Then about 5 or so years ago, they released separate drivers which has led to a lot of confusion in the years since. The bug reports that I get these days are mostly ones when I have to send users to the other driver. This is confusion that needs to go away. Getting the drivers in mainline will help we still need the ID wordage to be accurate.

@morrownr
it looks like pretty hard to correct them, all we can do are just submitting the changes, and then wait, wait and wait...

@5kft
Copy link
Contributor

5kft commented Aug 11, 2024

@dubhater Regarding the signal strength issue, what do you think about the following fix for the 8821a (see diff below)? My thinking is this:

For the 8821a, most packets aren't reporting a PHY status even though BIT_APP_PHYSTS is set in REG_RCR. (E.g., I don't see this signal strength issue with my 8821cu adapter, so it appears PHY status reporting is working for that adapter.)

rtw_rx_fill_rx_status copies pkt_stat->signal_power to rx-status->signal regardless of the status of the packet. So, for the 8821a, why not simply cache the last signal strength value returned from a valid PHY status, and return this value when there is no PHY status present in the packet?

The fact that the signal value is always copied in rx.c regardless makes this logic actually pretty reasonable. Thoughts?

index 7031ca176..5e3b62ac4 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821a.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821a.c
@@ -1708,6 +1708,7 @@ static void rtw8821a_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc,
        u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz;
        struct ieee80211_hdr *hdr;
        u8 *phy_status = NULL;
+       static s32 prev_signal_power = 0;

        memset(pkt_stat, 0, sizeof(*pkt_stat));

@@ -1738,6 +1739,9 @@ static void rtw8821a_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc,
        if (pkt_stat->phy_status) {
                phy_status = rx_desc + desc_sz + pkt_stat->shift;
                rtw8821a_query_phy_status(rtwdev, phy_status, pkt_stat);
+               prev_signal_power = pkt_stat->signal_power;
+       } else {
+               pkt_stat->signal_power = prev_signal_power;
        }

        rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status, phy_status);

@dubhater
Copy link

@5kft That's what I was thinking too, but only if the missing PHY status is normal, if it's like that with the official driver too. I haven't checked yet.

(Also prev_signal_power has to go in a struct, rtw_dev, rtw_phy, something like that. Otherwise if you have two devices using this driver at the same time the signal strength will be incorrect.)

@5kft
Copy link
Contributor

5kft commented Aug 11, 2024

@dubhater Totally makes sense.

@dubhater
Copy link

@5kft It's the same with the official driver. Fortunately, not knowing the signal strength for some frames is very normal, not just for Realtek chips. mac80211 already supports this:

diff --git a/drivers/net/wireless/realtek/rtw88/rx.c b/drivers/net/wireless/realtek/rtw88/rx.c
index 66f9419588cf..4f9fce3f79b1 100644
--- a/drivers/net/wireless/realtek/rtw88/rx.c
+++ b/drivers/net/wireless/realtek/rtw88/rx.c
@@ -235,10 +235,14 @@ void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
 	else
 		rx_status->bw = RATE_INFO_BW_20;
 
-	rx_status->signal = pkt_stat->signal_power;
-	for (path = 0; path < rtwdev->hal.rf_path_num; path++) {
-		rx_status->chains |= BIT(path);
-		rx_status->chain_signal[path] = pkt_stat->rx_power[path];
+	if (pkt_stat->phy_status) {
+		rx_status->signal = pkt_stat->signal_power;
+		for (path = 0; path < rtwdev->hal.rf_path_num; path++) {
+			rx_status->chains |= BIT(path);
+			rx_status->chain_signal[path] = pkt_stat->rx_power[path];
+		}
+	} else {
+		rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
 	}
 
 	rtw_rx_addr_match(rtwdev, pkt_stat, hdr);

@5kft
Copy link
Contributor

5kft commented Aug 12, 2024

Fortunately, not knowing the signal strength for some frames is very normal, not just for Realtek chips. mac80211 already supports this

@dubhater This is perfect - very nice! I can confirm that this change works like a charm. Thank you!

@tukkek
Copy link

tukkek commented Aug 17, 2024

Hi fellas, I wrote my experiences with the rtw88 driver here: lwfinger/rtw88#231

I wasn't sure what would be helpful or not so I pretty much just put everything I could think of there. I won't subscribe to this issue here since it's pretty active (and I doubt I'd be of any help either) but I'll try to keep an eye for replies on the linked issue. Cheers!

@realskyquest
Copy link

realskyquest commented Aug 19, 2024

Hello, I have tried using https://github.com/morrownr/8821au-20210708 , I have found this in https://forums.linuxmint.com/viewtopic.php?t=376909

It works great, but i'm not sure about how good it works and my wifi speed is not great, so can't really do a wifi test speed with over 50 mbps.

neofetch

OS: Linux Mint 22 x86_64 
HOST: OptiPlex 790 01
Kernel: 6.8.0-40-generic
DE: Cinnamon 6.2.9

lsusb

Bus 002 Device 006: ID 0846:9052 NetGear, Inc. A6100 AC600 DB Wireless Adapter [Realtek RTL8811AU]

I have read tukkek post, it seems kinda lacking on os and other information, so I did not get any usefull information, also read several other ubuntu forums and linux forums, this was the most legit looking driver, althought it has some recent updates a less than year ago, I'm concerned a bit.

If you have any more questions, I will answer them.

EDIT: I did basic wifi speed test, I'm not that experienced to do other tests like mode switch or etc

@realskyquest
Copy link

New update on my driver issues, I randomly got a warning report that told me that there was a driver for my NetGear usb wifi adapter, so i'm switching to that. I swear that driver appeared randomly.

Screenshot from 2024-08-20 23-26-01

@javic-elec
Copy link

Hi,

I've just installed this on Ubuntu 22.04.5 kernel 6.8.0-45-generic after the current 8821au-20210708 stopped working since a kernel update yesterday and I could not make it work again. My adapter is a TP-Link Archer T2U.
This new one works well so far. For now, I can confirm that the green LED works. However, a speed test gives me 49Mbps/101Mbps, I believe I should be getting same download speed than upload.

@realskyquest
Copy link

@javic-elec Not sure why your 8821au-20210708 failed, maybe reinstall??.

I'm also using 8821au-20210708 on Pop!_OS 22.04 LTS x86_64, 6.9.3-76060903-generic for more than a month, My adapter (ID 0846:9052 NetGear, Inc. A6100 AC600 DB Wireless Adapter [Realtek RTL8811AU]
from lsusb command) works well, it dosen't reach to more than 30Mbps due to my ISP plan.

Prehaps a bit more testing??, not really sure.

@rola22
Copy link

rola22 commented Oct 8, 2024

I have TP-Link Archer T2U Plus on Linux Mint 22 with kernel 6.8.0-45 and driver from @morrownr also doesn't work ;/

@morrownr
Copy link
Owner Author

morrownr commented Oct 8, 2024

Show us the results of the following:

$ lsusb

@rola22
Copy link

rola22 commented Oct 8, 2024

lsusb:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0c45:8508 Microdia USB DEVICE
Bus 001 Device 003: ID 062a:3633 MosArt Semiconductor Corp. Full-Speed Mouse
Bus 001 Device 005: ID 12d1:108a Huawei Technologies Co., Ltd. VOG-L29
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 2357:0120 TP-Link Archer T2U PLUS [RTL8821AU]
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

and DKMS status:
rtl8821au/5.12.5.2, 6.8.0-45-generic, x86_64: installed

@morrownr
Copy link
Owner Author

morrownr commented Oct 8, 2024

@rola22

Well, that vid/pid does indicate your adapter has a rtl8821au chip so...

How about you start a new issue in this repo with a report regarding what the driver in this repo did while installing. We can look at the rtw88 driver later.

@rola22
Copy link

rola22 commented Oct 9, 2024

@morrownr can you guide me what exactly you want to see in this issue?
Right now i removed all installed drivers from my system.

You want me to install rtw88 again, and show all messages from terminal?

EDIT 2024-10-09 19:23:
I am really not smart. I realized i had secure boot on. After disabling it and installing driver again everything works fine

@morrownr
Copy link
Owner Author

That would explain it. Both drivers can work with secure mode but some distros can be problematic.

@dubhater
Copy link

dubhater commented Oct 28, 2024

Please test this patch, especially if your CPU has more than two core or it's not x86: lwfinger/rtw88#205 (comment)

Unrelated to that bug, someone once reported seeing "failed to get tx report from firmware" every five minutes or so. I found what was causing it and there will be a patch for that too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests