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

News: [PATCH v5 00/11] RTW88: Add support for USB variants (several Realtek in-kernel drivers coming soon) #155

Open
morrownr opened this issue Nov 29, 2022 · 22 comments

Comments

@morrownr
Copy link
Owner

The subject patch series, which was posted yesterday, is designed to add in-kernel driver support to the following usb chipsets:

rtw8822bu
rtw8812bu
rtw8821cu
rtw8811cu
rtw8822cu
rtw8812cu
/rtw8723du

The drivers:

/rtw88/rtw8723du.ko
/rtw88/rtw8821cu.ko
/rtw88/rtw8822bu.ko
/rtw88/rtw8822cu.ko

This latest patch set is v4. I have watched this year as improvements have been made. While I have not had time to test, indications are that these drivers are in reasonable shape at this point and could possibly be merged to mainline in the not so distant future. This code should not go to staging as many drivers must as they mature because this patch set is being applied to the existing in-kernel driver called rtw88 which supports the PCIe (and other) variants of the same chipsets so this patch set is simply to add usb support. This support would cover the modern Realtek AC1200 and AC600 chipsets as mentioned above which would dramatically increase the variety of usb wifi adapters that are supported with in-kernel Linux drivers.

Nick

@morrownr
Copy link
Owner Author

morrownr commented Dec 8, 2022

Update:

11 patches applied to wireless-next.git, thanks.

1d8966049440 wifi: rtw88: print firmware type in info message
69020957bcb7 wifi: rtw88: Call rtw_fw_beacon_filter_config() with rtwdev->mutex held
d57ca103e54e wifi: rtw88: Drop rf_lock
1e2701f4079a wifi: rtw88: Drop h2c.lock
8647f7f0b908 wifi: rtw88: Drop coex mutex
78d5bf925f30 wifi: rtw88: iterate over vif/sta list non-atomically
a82dfd33d123 wifi: rtw88: Add common USB chip support
aff5ffd718de wifi: rtw88: Add rtw8821cu chipset support
45794099f5e1 wifi: rtw88: Add rtw8822bu chipset support
07cef03b8d44 wifi: rtw88: Add rtw8822cu chipset support
87caeef032fc wifi: rtw88: Add rtw8723du chipset support

It appears that this coming faster than I expected it to happen.

@morrownr morrownr changed the title News: [PATCH v4 00/11] RTW88: Add support for USB variants News: [PATCH v5 00/11] RTW88: Add support for USB variants (several Realtek in-kernel drivers coming soon) Dec 8, 2022
@981213
Copy link

981213 commented Dec 10, 2022

I made a fork of https://github.com/lwfinger/rtw88 with all the rtw88_usb patches applied: https://github.com/981213/rtw88
If anyone wants to test the driver on linux 5.4+, you can try this without rebuilding your kernel :)

update: My PR has been merged into the original repo: lwfinger/rtw88#107

@morrownr
Copy link
Owner Author

Confirmation:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=fba119cee141

It looks like the patch is going into kernel 6.2

@bjlockie
Copy link

bjlockie commented Dec 12, 2022 via email

@morrownr
Copy link
Owner Author

@bjlockie

How is the quality of that driver?

Unknown. I have been planning on testing once it made it into the mainline kernel so maybe in a couple of weeks when rc1 comes out. I downloaded the above and went so far as to compile it but I stopped there as I'm right is the middle of trying to bring a new out-of-kernel for the 8821cu online so I don't need two messes going at the same time. I will say that compiling and installing that link should only be tried by those with a 3rd degree black belt in compiler dev because the README (docs) will do little more than confuse most people...and it will make a mess of some systems as well. Remember, sudo is a weapon of mass destruction.

Maybe @981213 can comment on the quality.

@FelixSchwarz
Copy link

I just tried kernel 6.2 rc1 on Fedora 36 with a Realtek Semiconductor Corp. 802.11ac NIC (0bda:c811), set CONFIG_RTW88_8821CU but no dice:

sudo modprobe  -v rtw88_8821cu

journalctl:

rtw_8821cu 1-4:1.0: Firmware version 24.11.0, H2C version 12
rtw_8821cu 1-4:1.0: rfe 38 isn't supported
rtw_8821cu 1-4:1.0: failed to setup chip efuse info
rtw_8821cu 1-4:1.0: failed to setup chip information
usbcore: registered new interface driver rtw_8821cu

I don't see a wifi interface afterwards. I saw some recommendations to use usb_modeswitch (at least with the vendor driver) but sudo usb_modeswitch --std-eject --verbose --default-vendor=0bda --default-product=c811 only says:

Access device 005 on bus 001
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
 with class 255
Error: can't use storage command in MessageContent with interface 0; interface class is 255, expected 8. Abort

@morrownr
Copy link
Owner Author

0bda:c811

If you get that device id and the adapter is a multi-state adapter then usb_modeswitch has already done its job. I'm not aware of any mainstream distros that don't start usb_modeswitch with systemd. If an adapter is a multi-state adapter that is not being switched, it will have a device id. There are a few that are used but you will get a CD or flash driver icon on the desktop.

I compiled 6.2-rc1 here on Monday and was able to do some testing. It worked here on Xubuntu 22.10. The performance was slow. I had to break off testing to work on other things but will take another look when I can.

If you have the 8821cu driver that I have here installed, remove it as it will blacklist the in-kernel driver.

@FelixSchwarz
Copy link

I compiled 6.2-rc1 here on Monday and was able to do some testing. It worked here on Xubuntu 22.10.

Which device did you test? I have a "Techkey AC600M (dual band wireless adapter model 5B10)" which triggered the "rfe 38 isn't supported" error. Ping-Ke proposed a patch which works for me though I could not establish a wireless connection afterwards.

@morrownr
Copy link
Owner Author

Hi @FelixSchwarz

My adapter shows: ID 0bda:c811 Realtek Semiconductor Corp. 802.11ac NIC

It is a single state, wifi only adapter made by Edup. To be specific, it is an EDUP EP-AC1635.

I have seen rfe errors with 8821cu adapters on several occasions. Here is what I think is a good idea:

I am going to add your name to a private repo where myself and some others are working on an updated 8821cu out-of-kernel driver based on newer source than the driver I currently have up. You will get an invitation email in a little while. Post a message in issues once you are there restating this issue so that others know. I will then point you to the rfe documentation and suggest where you should start. I think this will allow you to tighten down exactly what the problem is so that the info can be reporte to Sasha.

Nick

@981213
Copy link

981213 commented Jan 4, 2023

Maybe @981213 can comment on the quality.

I only performed a 1-minute iperf3 test using this driver and nothing blows up during that :) The upstream driver is missing the USB3.0 mode switch. My card starts in USB2.0. Without the mode switch I'm stuck in this mode and the iperf speed is about 100Mbps.

@morrownr
Copy link
Owner Author

morrownr commented Jan 4, 2023

The upstream driver is missing the USB3.0 mode switch.

The one in the kernel?

Which chipset does your adapter use?

@981213
Copy link

981213 commented Jan 4, 2023

The upstream driver is missing the USB3.0 mode switch.

The one in the kernel?

Yes.

Which chipset does your adapter use?

I guess it's an RTL8812BU because the USB PID is B812 and I was using the 88x2bu driver before this upstream one.

@morrownr
Copy link
Owner Author

morrownr commented Jan 4, 2023

I guess it's an RTL8812BU because the USB PID is B812 and I was using the 88x2bu driver before this upstream one.

Okay. We were talking about adapters that use a chipset that can't do USB3 so I had to scratch me head when you said there is no USB3 switch.

With in-kernel drivers, there is no switch for USB3. If the driver detects that all is good for USB3 it uses USB3 without any switch. If you want to limit the adapter to USB2, plug it into a USB2 port.

@981213
Copy link

981213 commented Jan 5, 2023

Okay. We were talking about adapters that use a chipset that can't do USB3 so I had to scratch me head when you said there is no USB3 switch.

It can. When using https://github.com/morrownr/88x2bu-20210702 with rtw_switch_usb_mode=1, the adapter appears as a USB2.0 device, immediately ejected by the driver and reappears as a USB3.0 device.
BTW the card I was using is Comfast CF-924AC.

@ThiloteE
Copy link

ThiloteE commented May 23, 2023

I tried to find 8812bu in the rtw88 driver and found my device TP-LINK Archer T3U Plus defaulting to the in-kernel rtw8822bu driver, as can be seen here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/realtek/rtw88/rtw8822bu.c?h=v6.4-rc3&id=59a3a312009723e3e5082899655fdcc420e2b47a

I have not yet tried the in-kernel drivers, but will do so at one point. Until now I have been using your out-of kernel driver 88x2bu-20210702 driver.

It is very confusing. Why is 8812bu never mentioned in the in-kernel driver anywhere?

@bjlockie
Copy link

bjlockie commented May 23, 2023 via email

@morrownr
Copy link
Owner Author

Anything to confuse users us worth doing. Just kidding.

The realtek out-of-kernel driver that I maintain here is called rtw8812bu. The module it makes is called 8812bu.ko. You can see it with lsmod but it won't show the ,ko.

The internal driver goes by the name rtw88_8812bu and the module iscalled rtw88_8812bu.ko.

The in-kernel driver went in with kernel 6.2 but I'd recommend waiting until kernel 6.3 to try it.

With kernel 6.3, it is a pretty good driver and is getting better. My driver will automatically blacklist the in-kernal driver so you need to use my remove-driver.sh script to remove my driver and allow the in-kernel driver to work.

FWIW: I had nothing to do with naming in the out-of-kernel driver. That is all on Realtek.

@ThiloteE
Copy link

@morrownr
Copy link
Owner Author

I still cannot find 8812...

Oh, you won't. The 8812 is just a variant of the 8822 that does not include bluetooth. I probably messed up in my previous message as I forget about that because you almost never see an adapter based on the 8822bu chipset because if bluetooth is active, the adapter is limited to USB2 and who wants that on an adapter that is capable of USB3.

@ThiloteE
Copy link

Ah, I get it. Thank you :-)

@ThiloteE
Copy link

ThiloteE commented May 23, 2023

Maybe this should be commented in the code somewhere or there should be a separate "fake" file for such chipsets.
The realtek website lists 8812bu as separate chipset.
As somebody who sometimes as hobby answers community questions for OpenWrt the first thing I do when people ask if a certain device and chipset is supported by OpenWrt or will be supported in the future, i check OpenWrt commits and if i want to know more details, I go to kernel.org and check if there have been any commits for this chipset. If i cannot find any commits (just like for 8812bu), then my first response will be that the chipset is likely not or not very well supported. Now I know better, but for beginners it's hard to follow all the specifics.

@morrownr
Copy link
Owner Author

@ThiloteE

Have you ever had a bad day? I need to be quiet when I don't have time to think before answering.

The out-of-kernel driver for the 8822bu and 8812bu is:

NAME="rtl88x2bu"
MODULE_NAME="88x2bu"

Now, I should be quiet until I have time to think about my answers.

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

5 participants