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: Improve rtl8821/11cu rtw88 in-kernel driver. Need help... #115

Open
morrownr opened this issue Sep 13, 2023 · 264 comments
Open

Project: Improve rtl8821/11cu rtw88 in-kernel driver. Need help... #115

morrownr opened this issue Sep 13, 2023 · 264 comments

Comments

@morrownr
Copy link
Owner

morrownr commented Sep 13, 2023

Greetings to anyone that reads this message.

It was reported that the rtw88 in-kernel driver for the rtl8821cu/rtl8811cu chipsets was broken. So... we decided to make it better. Five patches have now gone into the Linux kernel (6.9) so things are better. While things are better, it is good to continue testing and make things very good.

If you are willing to help, here is a basic plan:

  • uninstall the driver in this repo using sudo sh remove-driver.sh.
  • install the driver at: https://github.com/lwfinger/rtw88 (follow the installation at that site)
  • try to use your adapter and report results... applicable lines in the log file may help.

The rtw88 repo shown above is a downstream repo from the Linux kernel. It focuses on the rtw88 driver series. If you have test results or questions, post in this issue.

Regards,

@morrownr

@henkv1
Copy link
Collaborator

henkv1 commented Sep 28, 2023

The repo https://github.com/lwfinger/rtw88 contains a backport of the latest wireless-next code for kernel 5.4 and newer. The driver really improved since the initial release in kernel 6.2 and works pretty well with my adapters. Except AP mode, which is still broken.

@morrownr
Copy link
Owner Author

@henkv1

Thanks for the info. I was aware of Larry's repo but did not know it was tracking wireless-next. I have been testing rtw88_8822bu and it has been making good progress in managed mode up through 6.5, which is the last version I have tested. I've had a couple of reports here about rtw_8821cu not working so I started testing my 8811cu adapter and it is not working. I've been in contact with some devs/users I know that have 8811cu adapters so as to get them to test. I'm trying to collect the info so as to try to determine what the problem is.

My overall goal is to shift my priority to helping with the mac80211 drivers, whether it be Mediatek or Realtek chipsets and I hope I can eventully sunset the 8822bu and 8821cu drivers here as I need to use my time on other things.

Cheers

@surfaceflinger
Copy link

Anything I can do as an end user with 8811cu to help? The exact device that I have is MERCUSYS AC650.

I've been testing every kernel release after 6.2 (and also that out-of-tree wireless-next port) to see if it's working but never really bothered to contact anyone...

I'll grab some dmesgs for you soon, I remember that logs were different between iwd and wpa_supplicant.

@morrownr
Copy link
Owner Author

morrownr commented Nov 10, 2023

@surfaceflinger

Due to some health problems, this issue has slipped lower on my priority list but I would like to see information flowing in so that maybe we can get to the point that we know where the important problems are. The rtl8812bu driver in rtw88 is in much better shape that the driver for rtl8811cu. It is not clear why which is why I posted this issue.

@surfaceflinger
Copy link

@morrownr
Attaching dmesg + lsusb below. First it blocked some things so GNOME was frozen before session started properly, then it couldn't upload firmware until I removed it from USB and connected again. Firmware was uploaded to the adapter but connections to actual networks got timed out.
It's the same between wpa_supplicant and iwd.

dmesg_wpasupplicant.log
lsusb.log

@Salz
Copy link

Salz commented Nov 16, 2023

I can't use the in kernel rtw88_8821cu driver either, it says it can't upload the firmware and keeps reconnecting. I compiled the driver with debug support, attaching the dmesg lines. Please tell me if I can help in any way.

lsusb.txt
dmesg.txt

@morrownr
Copy link
Owner Author

Hi @Salz

I took a look at the files you sent. What kernel version are you using? Also, have you checked the firmware?

https://github.com/morrownr/USB-WiFi/blob/main/home/How_to_Install_Firmware_for_Mediatek_based_USB_WiFi_adapters.md

The location of the Realtek firmware is a few lines from the top.

@Salz
Copy link

Salz commented Nov 20, 2023

I took a look at the files you sent. What kernel version are you using?

Linux 6.6.1 from kernel.org. In case it matters I also attached my
.config

Also, have you checked the firmware?

Just checked them, the files in /lib/firmware/rtw88 are identical to from the kernel firmware repository.

@alkisg
Copy link
Collaborator

alkisg commented Nov 26, 2023

I've just tested an 8821cu adapter (0bda:c811) with Kali Linux, kernel 6.5.0-kali3-amd64.
No device node (wlan0) was created, so I guess this issue also affects 8821cu devices.
The relevant parts of dmesg are:

[  156.990720] rtw_8821cu 1-7:1.0: firmware: failed to load rtw88/rtw8821c_fw.bin (-2)
[  156.990730] rtw_8821cu 1-7:1.0: firmware: failed to load rtw88/rtw8821c_fw.bin (-2)
[  156.990732] rtw_8821cu 1-7:1.0: Direct firmware load for rtw88/rtw8821c_fw.bin failed with error -2
[  156.990734] rtw_8821cu 1-7:1.0: failed to request firmware
[  156.994141] rtw_8821cu 1-7:1.0: failed to load firmware
[  156.994142] rtw_8821cu 1-7:1.0: failed to setup chip efuse info
[  156.994143] rtw_8821cu 1-7:1.0: failed to setup chip information
[  156.994536] rtw_8821cu: probe of 1-7:1.0 failed with error -22
[  156.994552] usbcore: registered new interface driver rtw_8821cu

While the driver from this repository (8821cu-20210916) worked fine.

@alkisg
Copy link
Collaborator

alkisg commented Nov 26, 2023

Testing on an older ArchLinux with kernel 6.4.5-arch1-1, there were various errors in dmesg but the adapter was working.

There was no attempt to load the rtw8821c_fw.bin firwmare. Is that firmware really needed, or not, and the attempt to load it is what's causing the issue?

@alkisg
Copy link
Collaborator

alkisg commented Nov 26, 2023

Sorry, my bad.
apt install firmware-realtek did the trick; the firmware files were missing from a default Kali installation.

@morrownr
Copy link
Owner Author

I was able to do a little more testing here a couple of days ago. I was using Debian 12. Base Debian 12 comes with kernel 6.1 lts but they do release later kernels at times. I uploaded kernel 6.5. Interestingly, the firmware was in place but kernel 6.1 did not have the driver. Kernel 6.5 fixed that. What I saw with that setup is that driver loaded and an interface was formed. When trying to connect, it would fail and it looked like a problem with security. Interestingly, the in-kernel driver for the 8812bu chipset does connect and work well. I really need more time to document the details of the failure and time to start looking around in the code of rtw88.

One thing I have noticed using the rtw88 driver for the 8812bu chipset is that rtw88 is not full featured yet. However, these out-of-kernel drivers are also missing features. My opinion is that the best supported chipsets overall for Linux users is the mt7610u, mt7612u and mt7921au. We should have adapters based on the new mt7925 chipset (wifi 7) soon since the driver is now in the Linux kernel. I'd say we may see them available at some point in the second half of 2024.

@Jibun-no-Kage
Copy link
Collaborator

2024? Really? Wow.

@wandou2018
Copy link

wandou2018 commented Dec 14, 2023

I can't use the in kernel rtw88_8821cu driver either, it says it can't upload the firmware and keeps reconnecting. I compiled the driver with debug support, attaching the dmesg lines. Please tell me if I can help in any way.

lsusb.txt dmesg.txt

Hello, i have the same issue on linux kernel 6.2.0 and pi 400 with linux kernel6.6.6-v8(built by myself).
My hardware is a usb wireless card rtl8811cu, i use rtw88 in-kernel driver for the rtl8811cu.

➜  ~ uname -a
Linux root 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 18:01:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

➜  ~ lsusb | grep realtek -i
Bus 001 Device 006: ID 0bda:c811 Realtek Semiconductor Corp. 802.11ac NIC

➜  ~ cat ./drivers/net/wireless/realtek/rtw88/rtw8821cu.c | grep 8811CU -rinw -C 1
drivers/net/wireless/realtek/rtw88/rtw8821cu.c-24-      { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc811, 0xff, 0xff, 0xff),
drivers/net/wireless/realtek/rtw88/rtw8821cu.c:25:        .driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8811CU */
drivers/net/wireless/realtek/rtw88/rtw8821cu.c-26-      { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x8811, 0xff, 0xff, 0xff),
drivers/net/wireless/realtek/rtw88/rtw8821cu.c:27:        .driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8811CU */

➜  ~ lsmod| grep -E "rtw|802"
rtw88_8821cu           16384  0
rtw88_8821c            90112  1 rtw88_8821cu
rtw88_usb              24576  1 rtw88_8821cu
rtw88_core            344064  2 rtw88_8821c,rtw88_usb
mac80211             1617920  3 iwlmvm,rtw88_core,rtw88_usb
libarc4                16384  1 mac80211
cfg80211             1241088  4 iwlmvm,rtw88_core,iwlwifi,mac80211

➜  ~ iwconfig wlan1
wlan1     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          Retry short limit:4   RTS thr:off   Fragment thr:off
          Power Management:on

➜  ~ tail -f /var/log/kern.log
Dec 14 01:33:58 n-hop kernel: [16054.139380] wlan1: authenticate with e8:9f:80:7d:5b:f1
Dec 14 01:33:58 n-hop kernel: [16054.171908] wlan1: send auth to e8:9f:80:7d:5b:f1 (try 1/3)
Dec 14 01:33:59 n-hop kernel: [16055.163045] wlan1: send auth to e8:9f:80:7d:5b:f1 (try 2/3)
Dec 14 01:34:00 n-hop kernel: [16056.156415] wlan1: send auth to e8:9f:80:7d:5b:f1 (try 3/3)
Dec 14 01:34:01 n-hop kernel: [16057.175452] wlan1: authentication with e8:9f:80:7d:5b:f1 timed out

➜  ~ cat /var/log/kern.log  | grep "Firmware version"
Dec 13 02:51:23 root kernel: [  146.751339] rtw_8821cu 1-2:1.0: Firmware version 24.8.0, H2C version 12
Dec 13 03:36:30 root  kernel: [ 2853.426466] rtw_8821cu 1-2:1.0: Firmware version 24.11.0, H2C version 12

➜  ~ md5sum /usr/lib/firmware/rtw88/rtw8821c_fw.bin*
2638a40042a27e98df2f7929c8eee760  /usr/lib/firmware/rtw88/rtw8821c_fw.bin
f58626e7b13e6f146c7c4dfed12beab9  /usr/lib/firmware/rtw88/rtw8821c_fw.bin.src

I don't see the log failed to download firmware so I think it loaded successfully, and I do see an additional wireless card named wlan1.

I tried two versions of rtw8821c_fw.bin, and both had the authentication with xxxx timed out issue.

Add i tried to capture the authentication packet on the other pc(windows), but no authentication packet was captured, so I guess the kernel sent the packet to the wifi network card, but the wifi network card did not send it. The software i use to capture packets is Mircosoft Network Monitor, i was able to capture authentication packets from other sta, so I thought the software was being used correctly.

Do you have any other updates?

@morrownr
Copy link
Owner Author

@Jibun-no-Kage

2024? Really? Wow.

Right now I'm thinking that we will see cards (PCIe) in the first half of 2024 and usb adapters in the second half of 2024. That applies to the mt7925 chipset from Mediatek. I noticed a WiFi 7 PCIe card based on an Intel chipset for sale yesterday. The Intel driver is also already in the kernel. I forget which kernel it was first included in. I am still not seeing any information regarding Realtek and WiFi 7 for usb. The only thing for sure is that Realtek can't continue with out-of-kernel drivers, such as this one, as they will no longer work starting with WiFi 7.

@morrownr
Copy link
Owner Author

@wandou2018

Thanks for the additional information.

but no authentication packet was captured

This is consistent with what I am seeing. My latest test is with kernel 6.5. The driver loads, an interface is created but I cannot get a connection. The lack of an authentication packet would cause this.

I also have an adapter based on the rtl8812bu chipset, which is also supported in rtw88. It works as expected. Maybe we can compare code and find the difference?

@lwfinger

Larry, I am adding you to this message in the hopes that maybe you have an idea how we need to proceed.

I started this issue in my rtl8821cu repo with the goal of finding out why the rtw88 support for the rtl8821cu chipset is broken. What we have discovered so far:

With kernel 6.2 and later, rtw88_8821cu is loading and an interface is being formed. When a connection is attempted, it fails. It appears that no authentication packet is being sent.

Any help appreciated.

@morrownr

@lwfinger
Copy link

Since you have packet capture, could you please attach it to this issue.

@morrownr
Copy link
Owner Author

@wandou2018

The above message from lwfinger is requesting a packet capture file. Could you be so kind as to attach a packet capture file in a reply?

I added lwfinger to this issue as he maintains a downstream repo for rtw88 and might be able to provide some guidance based on what we are seeing.

Thanks.

@morrownr

@Smackd0wn
Copy link

Hi, I'm chiming in and add my observations.

I have two 88x1cu cards. Both tested on Arch Linux with kernel 6.6.7. One is 8821cu (0bda:c820), the one with bluetooth support. It works very well with the rtw88 driver. Bluetooth works okay as well (with the in-kernel btusb driver) and BT can work simultaneously with Wi-Fi. Almost felt too good to be true...

The other is 8811cu (0bda:c811 after modeswitch), and it does not work with rtw88. Haven't tested 8821cu from this repository, but it works okay on Windows. With rtw88, the symptom is the same--sending auth to AP for 3 times before authentication timed out.

I have not done any packet capture myself, but I believe it should be the same issue as @wandou2018. I think what he meant was that while his monitor setup is okay, there was not a single packet sent by the 8811cu in the capture. In other words, 8811cu was not sending any packets, or the power was way too low to be captured, maybe? Either way, RX seems okay, but TX is not working at all.

@morrownr
Copy link
Owner Author

@Smackd0wn

and BT can work simultaneously with Wi-Fi.

BT and WiFi can work simultaneously in the same adapter but the WiFi has to be limited to USB2 or there will be interference with BT. Since your card is USB2, it works. Where the problem comes in is if an adapter has a AC1200 or later chipset and is capable of USB3 WiFi. If makers turn on BT support, they have to limit WiFi to USB2 which is a serious limitation on AC1200 or later chipsets.

The other is 8811cu (0bda:c811 after modeswitch), and it does not work with rtw88.

I have two adapters that are 8811cu chips and vid/pid 0bda:c811 and they are single-state so no need for usb_modeswitch. Neither work with rtw88... from Mainline. I tested kernel 6.7 rc6 this morning. The situation is as many 8811cu users have reported: A wifi interface is created. An attempt to connect is made and the connection fails. I've tested with numerous distros and kernels. This has been reported by numerous users. It is interesting that your multi-function 8821cu based adapter does work. Maybe that is another hint as to what the problem is.

@morrownr

@Jibun-no-Kage
Copy link
Collaborator

Been tracking this... unfortunately I don't have any additional variants of ICs, so have not commented as yet. But am tracking, in case I can help in any way, just let me know.... Oh, and happy holidays!

@wandou2018
Copy link

@lwfinger @morrownr

Add i tried to capture the authentication packet on the other pc(windows), but no authentication packet was captured, so I guess the kernel sent the packet to the wifi network card, but the wifi network card did not send it

Sorry, it means that I can't capture any packets sent from the rtl8811cu, but I can capture packets from other intel wireless cards . so I can't provide the packets.

@wandou2018
Copy link

wandou2018 commented Dec 19, 2023

Hi, I'm chiming in and add my observations.

I have two 88x1cu cards. Both tested on Arch Linux with kernel 6.6.7. One is 8821cu (0bda:c820), the one with bluetooth support. It works very well with the rtw88 driver. Bluetooth works okay as well (with the in-kernel btusb driver) and BT can work simultaneously with Wi-Fi. Almost felt too good to be true...

The other is 8811cu (0bda:c811 after modeswitch), and it does not work with rtw88. Haven't tested 8821cu from this repository, but it works okay on Windows. With rtw88, the symptom is the same--sending auth to AP for 3 times before authentication timed out.

I have not done any packet capture myself, but I believe it should be the same issue as @wandou2018. I think what he meant was that while his monitor setup is okay, there was not a single packet sent by the 8811cu in the capture. In other words, 8811cu was not sending any packets, or the power was way too low to be captured, maybe? Either way, RX seems okay, but TX is not working at all.

Yes, my rtl8811cu works fine on Windows. And on linux, RX works because it has wifi list information. So I think this should be a firmware issue with rtw8821c_fw.bin, not a hardware issue.

@Smackd0wn
Copy link

Yes, my rtl8811cu works fine on Windows. And on linux, RX works because it has wifi list information. So I think this should be a firmware issue with rtw8821c_fw.bin, not a hardware issue.

I am not sure if it's a firmware issue, as I made several more tests with my 8811cu, all on Arch Linux 6.6.7:

  1. With driver rtw88, Firmware version 24.11.0, H2C version 12 (from linux-firmware): no TX.
  2. With driver 8821cu-20210916 and its array_mp_8821c_fw_nic firmware: works okay.
  3. With driver rtw88, firmware from 8821cu-20210916 (same as 2nd test, shown as Firmware version 24.8.0, H2C version 12): no TX.

My 8821cu card works okay on all 3 conditions.

@lwfinger
Copy link

It is clearly not a firmware issue. The standard firmware extracted from your listed header file is identical with the one currently in rtw88.

I do not have a copy of 8821cu-20210916. Could you please post your tarball? Thanks.

@morrownr
Copy link
Owner Author

I do not have a copy of 8821cu-20210916. Could you please post your tarball?

https://github.com/morrownr/8821cu-20210916

This thread is in Issues in the above repo.

Background: I started this issue a few months ago after seeing a fairly constant flow of users having problems with rtw88. Why would users of the 8821cu/8811cu chipset be reporting problems with rtw88 in a repo that is the out-of-kernel driver? Because I actively encourage the users of this repo to try rtw88. This flow of problem reports caused me to take the time to test rtw88 and I found it not to be working. For me, a wifi interface is created. When I try to connect, the connection fails. This seems to be common. It was a surprise to me when the above user said his 8821cu (multi-function chipset) was working with rtw88.

I agree that this does not seem to be a firmware issue.

Many Linux users are not familiar with in-kernel (AKA in-tree) drivers and how they different from what they have experienced with installing drivers for Windows or installing the out-of-kernel Linux drivers so here is a short blurb for those that are following along:

Linux in-kernel wifi drivers consist of one or more driver files and one or more firmware files. The driver, actually called module if we are to be correct with the terminology, is never only one file. What we normally call the driver files are in the kernel. The firmware files are in the distro. When a new kernel kernel flows into your system during a update/upgrade, the driver is automatically updated because the driver is part of the kernel. A new kernel does not update/upgrade the firmware files. The firmware can be updated by the maintainers of your distro and it will flow in just like new kernels do but will have a name similar to Firmware for bla bla. Users can also upgrade the firmware files on their own.

Larry, I have an extra 8811cu based adapter if you are interested. I can mail it to you if you want. I really would like to see this fixed and I am not yet familiar enough with in-kernel programming to be much help but it is on my to-do list to work on.

Regards,

@morrownr

@lwfinger
Copy link

Do a 'git pull' and 'sudo cp rtw_8821c_fw.bin /lib/firmware/rtw88/.'. Does that change the actions of the 8811 modules?

@lwfinger
Copy link

The chip 8821ce is not a very good one. I even had to domate an RTL8192CU dongle to my neighbor whose 8821ce would not work even in Windows.
I will try the spare 8811cu. Send me an E-mail at [email protected] and I will send you my mailing address.

@Dapeva
Copy link

Dapeva commented Jan 28, 2024

Thanks to your contribution my Comfast usb wifi adapter (rtl8821cu) came back to life in Linux Mint. Greetings!.

@Matthaiks
Copy link

Kernel 6.8-rc3 + Mercusys MU6H (RTL8811CU): no TX.

@dubhater
Copy link

@5kft I don't think that will fly. Anyway, the hardware-controlled blinking I implemented for 8821au is temporary. It tells me if the chip thinks it's transmitting something, which has been useful a few times. But there is a downside: the LED blinks all the time in AP mode because it's transmitting beacons all the time.

(By the way, that old problem is fixed now. It is transmitting beacons. AP mode should work better now.)

The other problem is there is no way to turn off the LED.

The proper solution is to register the LED with the kernel's LED subsystem, which will allow the user to turn it off, and to tell mac80211 to make the LED blink.

@gtisan I guess the connection is not as stable as it appears. Try the latest commit.

@5kft
Copy link
Contributor

5kft commented Jul 24, 2024

@dubhater Makes sense - thanks 👍

@henkv1
Copy link
Collaborator

henkv1 commented Jul 24, 2024

The latest commit lwfinger/rtw88@4a1ee64 fixes AP mode. The connection looks stable now. Thanks all for the hard work.

@gtisan
Copy link

gtisan commented Jul 24, 2024

I can confirm that AP is working fine now also for 8822cu. Thanks a lot !

@dubhater
Copy link

@5kft Remind me again what kind of board you were testing here? #115 (comment) I want to mention it and the before/after numbers in the RX aggregation commit message.

@dubhater
Copy link

@5kft Also, can you test the speed again with RX aggregation disabled?

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index 3e30e6169729..e7473dff9c14 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -1281,6 +1281,7 @@ static void rtw8821c_rx_aggregation(struct rtw_dev *rtwdev, bool enable)
 	u8 size, timeout;
 	u16 val16;
 
+	return;
 	rtw_write32_set(rtwdev, REG_RXDMA_AGG_PG_TH, BIT_EN_PRE_CALC);
 	rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN);
 	rtw_write8_clr(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7));

I want to see if this commit by itself has an effect on the speed: lwfinger/rtw88@98de16f

@5kft
Copy link
Contributor

5kft commented Jul 28, 2024

@5kft Remind me again what kind of board you were testing here? #115 (comment) I want to mention it and the before/after numbers in the RX aggregation commit message.

@dubhater Sure, this is an ARM Cortex-A53-based board (based on the NanoPi NEO Core2), running arm64 Debian and stable Linux kernel 6.10.x.

@5kft
Copy link
Contributor

5kft commented Jul 28, 2024

I want to see if this commit by itself has an effect on the speed: lwfinger/rtw88@98de16f

@dubhater Here you go (iperf3 -w 512K -P 4 -i 10 -R) -

Test with RX aggregation disabled (i.e., addition of the "return" statement as requested above, results are consistent over several runs):

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-10.00  sec  8.84 MBytes  7.41 Mbits/sec
[  7]   0.00-10.00  sec  7.68 MBytes  6.44 Mbits/sec
[  9]   0.00-10.00  sec  8.25 MBytes  6.92 Mbits/sec
[ 11]   0.00-10.00  sec  8.76 MBytes  7.35 Mbits/sec
[SUM]   0.00-10.00  sec  33.5 MBytes  28.1 Mbits/sec

Downloads are capped at ~3MB/s as well:

linux-6.10.2.tar.xz                      12%[========>                                                                       ]  17.24M  3.02MB/s    eta 40s

Same test run with RX aggregation enabled (added "return" statement removed):

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-10.00  sec  13.3 MBytes  11.2 Mbits/sec
[  7]   0.00-10.00  sec  12.9 MBytes  10.8 Mbits/sec
[  9]   0.00-10.00  sec  14.3 MBytes  12.0 Mbits/sec
[ 11]   0.00-10.00  sec   235 MBytes   197 Mbits/sec
[SUM]   0.00-10.00  sec   275 MBytes   231 Mbits/sec

Downloads reach ~30MB/s+ (an order of magnitude faster than with RX aggregation disabled):

linux-6.10.2.tar.xz                          93%[===================================================================================>       ] 128.75M  31.1MB/s    eta 1s

Thanks again for these changes!

@dubhater
Copy link

@5kft Thanks for testing again. By the way, does your adapter have bluetooth?

@5kft
Copy link
Contributor

5kft commented Jul 28, 2024

By the way, does your adapter have bluetooth?

Alas, it does not have BT - it's Wi-Fi only (EDUP AC600M)

@morrownr
Copy link
Owner Author

@dubhater

I have one usb wifi adapter that has bluetooth capability and it is powered by a rtw_8822cu chip.

What can I test for you?

FYI: Sorry about the delay in testing AP mode for rtw_8812au. I seem to have had a hardware failure in my AP mode test system and am having to sort that out. Not sure when I will be back in business for that but I can handle other things like managed, monitor and P2P mode testing.

@dubhater
Copy link

@morrownr It's okay, I only needed to know what to write in the commit message, RTL8821CU or RTL8811CU.

@belzerus
Copy link

Sorry for seeing this late, been travelling.. @dubhater great work with the rx aggregation. I will give it a spin using my lm842 (8822CU) adapter on my slow i.MX6SX board that I have reported issue on before that seems to have been related to lack of tx/rx aggregation (8821AU started to work fine after aggregation was added). Will keep you posted. I will try it on my mainline kernel, is it enough to cherry-pick the 4 patches about this from wirelss-next (https://lore.kernel.org/linux-wireless/[email protected]/T/#t)?

BTW @dubhater I can donate a 8822CU adapter (LM842) if you are lacking such a device, good to be able to test bluetooth also..

@morrownr
Copy link
Owner Author

@belzerus

I will try it on my mainline kernel, is it enough to cherry-pick the 4 patches about this from wirelss-next...

An alternative to cherry-picking patches is to use our dev repo where the patches are in place before they go upstream:

https://github.com/lwfinger/rtw88

If you aren't familiar with the dev repo, just blacklist existing in-kernel drivers such as rtw88_8821cu and install the dev repo. It uses different driver names so as not to conflict... rtw_8821cu. That would make it as easy as a git pull to keep up while testing.

@belzerus
Copy link

@belzerus

I will try it on my mainline kernel, is it enough to cherry-pick the 4 patches about this from wirelss-next...

An alternative to cherry-picking patches is to use our dev repo where the patches are in place before they go upstream:

https://github.com/lwfinger/rtw88

If you aren't familiar with the dev repo, just blacklist existing in-kernel drivers such as rtw88_8821cu and install the dev repo. It uses different driver names so as not to conflict... rtw_8821cu. That would make it as easy as a git pull to keep up while testing.

Sure, I can try it on the dev repo also. I have used that repo for troubleshooting issues seen in the mainline kernel from time-to-time and to do benchmarks, so I'm quite familiar with it.

@dubhater
Copy link

@belzerus Thank you for your offer. I believe one of those LM842 is on its way to me right now.

@gtisan
Copy link

gtisan commented Sep 11, 2024

Just a short update regarding 8822cu (lm842).

I reverted the commit "wifi: rtw88: Avoid using macid 0 in AP mode" and add the patch "wifi: rtw88: assign mac_id for vif/sta and update to TX desc" from mailing list.
Now I have almost the same bitrate from iperf3 on both Rx(45,5 Mbps) and Tx(48.9 Mbps) using AP in 2 GHz.

How is going with this repo, will be updated in future ?

@henkv1
Copy link
Collaborator

henkv1 commented Sep 11, 2024

I can confirm that replacing "wifi: rtw88: Avoid using macid 0 in AP mode" with "wifi: rtw88: assign mac_id for vif/sta and update to TX desc" solves the connection speed issue.

@morrownr
Copy link
Owner Author

@gtisan @henkv1

How is going with this repo, will be updated in future ?

That is unknown. Before Larry passed away, he gave dubhater and I admin rights so as to finish the project we were working on which included getting some drivers up to speed and adding drivers for rtl8821au, rtl8812au and rtl8814au. The work on the first 2 is under review by the Realtek Linux wifi gatekeeper. He had requested a lot of cleanup so dubhater has been busy with that. What was unknown when this project started was just how many problems there were in rtw88. We have seen a steady flow of small patches to fix little things this entire year and they are still going in. Is rtw88 (in kernel) much better now than it was? Oh, yes.

To address the issue of 2 patches both of you speak of, I have lost track of where we are. What you might do is check wireless-next to see what the resolution was on those two patches as I am pretty sure this was resolved the result was applied.

Back to the question about the future of the rtw88 repo; I do not have time to maintain this repo going forward. What I might be willing to do if it appears there is a need for it is fork it to this github site and set up admin right for the fork for 1, 2 or 3 folks that have the skills and desire to maintain it. I could help some.

@gtisan
Copy link

gtisan commented Sep 12, 2024

These 2 patches fixes AP mode and are in linux-next-20240911

  1. wifi: rtw88: Fix USB/SDIO devices not transmitting beacons
  2. wifi: rtw88: assign mac_id for vif/sta and update to TX desc

1 is already in our repo and 2 is a replacement for the commit "wifi: rtw88: Avoid using macid 0 in AP mode" from our repo.
realtek guy replaced the commit.

Does anybody ran AP mode in 5 Ghz ? Station mode for 5 Ghz works well.

I use hostapd 2.11 with this settings:
interface=wlan0
driver=nl80211
logger_syslog=-1
logger_syslog_level=1
logger_stdout=0
ctrl_interface=/var/run/wiffy/hostapd
ssid=testAP
country_code=US
ieee80211d=1
ieee80211n=1
hw_mode=a
ht_capab=[HT40+][HT40-][SHORT-GI-20][SHORT-GI-40][RX-STBC1][MAX-AMSDU-7935][DSSS_CCK-40]
ieee80211ac=1
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42
vht_capab=[MAX-MPDU-11454][SHORT-GI-80][SU-BEAMFORMEE][MU-BEAMFORMEE][HTC-VHT]
channel=36
dtim_period=1
wmm_enabled=1
wpa_key_mgmt=WPA-PSK
wpa_group_rekey=0
wpa_ptk_rekey=0
wpa_psk_file=/var/run/wiffy/hostapd.psk
wpa=2
wpa_passphrase=hello
wpa_pairwise=CCMP

The log from starting hostapd :
/usr/bin/hostapd -dd /var/run/wiffy/hostapd.conf -P/var/run/wiffy/hostapd.pid -e/var/run/wiffy/hostapd.entropy -B
random: Added entropy from /var/run/wiffy/hostapd.entropy (own_pool_ready=2)
random: Trying to read entropy from /dev/random
Get randomness: len=20 entropy=1
random: Updated entropy file /var/run/wiffy/hostapd.entropy (own_pool_ready=2)
Configuration file: /var/run/wiffy/hostapd.conf
nl80211: Kernel version: Linux 6.6.14-rt21 (#1 PREEMPT_RT @1725972532; ppc)
nl80211: Maximum supported attribute ID: 326
nl80211: Initialize interface wlan0 (driver: rtw_8822cu)
nl80211: TDLS supported
nl80211: TDLS external setup
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supported cipher 00-0f-ac:13
nl80211: Supported cipher 00-0f-ac:11
nl80211: Supported cipher 00-0f-ac:12
nl80211: Using driver-based off-channel TX
nl80211: Driver-advertised extended capabilities (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Driver-advertised extended capabilities mask (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: key_mgmt=0x1ff0f enc=0xfef auth=0x7 flags=0x240005105b1bfae0 flags2=0x103 rrm_flags=0x30 probe_resp_offloads=0x0 max_stations=0 max_remain_on_chan=5000 max_scan_ssids=4
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 5 iftype 3 (AP)
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0xe8c5b0
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0xe8c5b0 match= multicast=0
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0xe8c5b0 match= multicast=0
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0xe8c5b0 match= multicast=0
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0xe8c5b0 match= multicast=0
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0xe8c5b0 match= multicast=0
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0xe8c5b0 match= multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=04 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=0501 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=0503 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=0504 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=06 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=08 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=09 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=0a multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=11 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xe8c5b0 match=7f multicast=0
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: Add own interface ifindex 5 (ifidx_reason -1)
nl80211: if_indices[16]: 5(-1)
nl80211: Do not open EAPOL RX socket - using control port for RX
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Previous country code 00, new country code US
Continue interface setup after channel list update
ctrl_iface not configured!
wlan0: IEEE 802.11 Configured channel (36) or frequency (5180) (secondary_channel=1) not found from the channel list of the current mode (2) IEEE 802.11a
wlan0: IEEE 802.11 Hardware does not support configured channel

"iw phy0 info" give me these freq in band2:
Frequencies:
* 5180 MHz [36] (20.0 dBm) (no IR)
* 5200 MHz [40] (20.0 dBm) (no IR)
* 5220 MHz [44] (20.0 dBm) (no IR)
* 5240 MHz [48] (20.0 dBm) (no IR)
* 5260 MHz [52] (20.0 dBm) (no IR, radar detection)
* 5280 MHz [56] (20.0 dBm) (no IR, radar detection)
* 5300 MHz [60] (20.0 dBm) (no IR, radar detection)
* 5320 MHz [64] (20.0 dBm) (no IR, radar detection)
* 5500 MHz [100] (20.0 dBm) (no IR, radar detection)
* 5520 MHz [104] (20.0 dBm) (no IR, radar detection)
* 5540 MHz [108] (20.0 dBm) (no IR, radar detection)
* 5560 MHz [112] (20.0 dBm) (no IR, radar detection)
* 5580 MHz [116] (20.0 dBm) (no IR, radar detection)
* 5600 MHz [120] (20.0 dBm) (no IR, radar detection)
* 5620 MHz [124] (20.0 dBm) (no IR, radar detection)
* 5640 MHz [128] (20.0 dBm) (no IR, radar detection)
* 5660 MHz [132] (20.0 dBm) (no IR, radar detection)
* 5680 MHz [136] (20.0 dBm) (no IR, radar detection)
* 5700 MHz [140] (20.0 dBm) (no IR, radar detection)
* 5720 MHz [144] (20.0 dBm) (no IR, radar detection)
* 5745 MHz [149] (20.0 dBm) (no IR)
* 5765 MHz [153] (20.0 dBm) (no IR)
* 5785 MHz [157] (20.0 dBm) (no IR)
* 5805 MHz [161] (20.0 dBm) (no IR)
* 5825 MHz [165] (20.0 dBm) (no IR)

@henkv1
Copy link
Collaborator

henkv1 commented Sep 12, 2024

@gtisan, 5GHz works fine here. It looks like your wireless regulatory database is not working properly. Do you have a signed wireless-regdb installed?

@gtisan
Copy link

gtisan commented Sep 12, 2024

I think yes, but looking at the kernel boot log it seems that is not working :

1399576044.382267 INFO 0 0 [kernel]: cfg80211: Loading compiled-in X.509 certificates for regulatory database
1399576044.382275 INFO 0 0 [kernel]: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
1399576044.382283 INFO 0 0 [kernel]: Loaded X.509 cert 'wens: 61c038651aabdcf94bd0ac7ff06c7248db18c600'
1399576044.382291 WARN 0 0 [kernel]: platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
1399576044.382299 WARN 0 0 [kernel]: platform regulatory.0: Falling back to sysfs fallback for: regulatory.db
1399576101.833971 INFO 0 0 [kernel]: cfg80211: failed to load regulatory.db

@dubhater
Copy link

-2 means „file not found”.

@gtisan
Copy link

gtisan commented Sep 12, 2024

I put regulatory.db in /lib/firmware, is it wrong ?

@morrownr
Copy link
Owner Author

@gtisan

I think the files go in:

/usr/lib/firmware

They are users space files for a reason.

@gtisan
Copy link

gtisan commented Sep 13, 2024

According to the Makefile from here https://git.kernel.org/pub/scm/linux/kernel/git/wens/wireless-regdb.git/tree/Makefile,
regulatory.db should be in /lib/firmware.

I put the files in these locations, but I still have the same errors. Does anybody has a hint ?

ls /usr/lib/crda/ -R

/usr/lib/crda/:
pubkeys regulatory.bin

/usr/lib/crda/pubkeys:
wens.key.pub.pem

ls /lib/firmware/regulatory*

/lib/firmware/regulatory.db /lib/firmware/regulatory.db.p7s

@dubhater
Copy link

dubhater commented Sep 13, 2024

Did you reboot after you added the files? If that didn't help, try putting them in /usr/lib/firmware. :)

And you also need to set the country code with iw reg set <country>.

Your distro doesn't provide these files in a package?

@morrownr
Copy link
Owner Author

Here is where the files are in the system I am working at currently: (Debian 12)

/usr/lib/firmware$ ls -l | grep reg
lrwxrwxrwx  1 root root      31 Jul 30  2022 regulatory.db -> /etc/alternatives/regulatory.db
-rw-r--r--  1 root root    4492 Jul 30  2022 regulatory.db-debian
lrwxrwxrwx  1 root root      35 Jul 30  2022 regulatory.db.p7s -> /etc/alternatives/regulatory.db.p7s
-rw-r--r--  1 root root    1225 Jul 30  2022 regulatory.db.p7s-debian
-rw-r--r--  1 root root    1182 Jul 30  2022 regulatory.db.p7s-upstream
-rw-r--r--  1 root root    4492 Jul 30  2022 regulatory.db-upstream

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