morrownr / USB-WiFi

USB WiFi Adapter Information for Linux
2.74k stars 179 forks source link

Comfast CF-953AX MT7921AU can't go above 3Mbit upload #214

Closed ViRb3 closed 1 year ago

ViRb3 commented 1 year ago

System specs:

Tested setup:

Consistent results:

root@raspberrypi:~# ./speedtest-go
Latency: 2.520892658s
Download Test: ...........
Upload Test: ...........

Download: 89.10 Mbit/s
Upload:  3.00 Mbit/s

I have to note, going through the hub the device is stuck in USB2 mode. When it was directly connected to Pi USB3 port, it could reach 220 Mbit download, though still only 3Mbit upload. Any way to force USB3 mode like in the old Realtek drivers?

@morrownr this is likely one for you :)

Thanks!

morrownr commented 1 year ago

@morrownr this is likely one for you :)

Okay, I'll give it a try but anyone else should feel free to jump in.

I may wear you out with questions.

./speedtest-go

I need more info about. Where does one get a copy?

I am assuming you are somehow testing with an internet server?

I ask because I always first test with iperf3 which is testing locally. There are so many variables once you get beyond you local lan that it is best to test yur local lan first if possible. Are you running OpenWRT on your router? Do you have an extra RasPi4B?

Upload: 3.00 Mbit/s

What were you expecting?

I have to note, going through the hub the device is stuck in USB2 mode. When it was directly connected to Pi USB3 port, it could reach 220 Mbit download, though still only 3Mbit upload. Any way to force USB3 mode like in the old Realtek drivers?

The in-kernel drivers, such as the mt7612u and mt7921u, that support adapters that are capabile of USB3 do their work automatically. If everything that needs to be place for USB3 operation, then they turn on USB3 support. The logic in the drivers seems to be impeccable as I have never seen an error. There is likely something that the driver is seeing that is causing it to limit you to USB2.

When you upgraded to the 6.11 kernel via rpi-update, did you also upgrade the rest of the driver (the firmware files) to the latest? There was a new release in January.

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

Be careful because the mt7921au firmware is now in section 2 on that page because mt7922 is now the latest.

Side note; Remember that upgrading the kernel only upgrades part of the driver, the in-kernel part, mt7921u. The firmware files are also part of the driver but are not part of the kernel so it is up to you or the distro maintainer to handle that and it is highly uplikely the RasPi folks are upgrading as fast as updates are coming.

Through USB3 powered hub

Powered hubs on a RasPi... hmmm... good start to a scary novel. I recommend you leave the hubs out of this until we get this sorted out.

A solution that I use that works well with the CF-951AX (same chipset as yours) on a RasPi4B:

https://www.amazon.com/dp/B07S6B5X76

See https://github.com/morrownr/USB-WiFi/issues/139 for information on what the mt7921au chipset and driver can do. That test is with iperf3 in clean air.

Would you mind sharing the following info with us as there has been a some conflicting info about the CF-952AX:

$ lsusb

@morrownr

ViRb3 commented 1 year ago

I need more info about. Where does one get a copy?

https://github.com/showwin/speedtest-go https://github.com/showwin/speedtest-go/releases/download/v1.4.0/speedtest-go_1.4.0_Linux_arm64.tar.gz

It's a CLI for https://speedtest.net. On my other SD Card with RTL8822BU USB card plugged in same port, I get:

root@raspberry:~/ # ./speedtest-go
Latency: 16.889302ms
Download Test: ...............
Upload Test: ....

Download: 209.81 Mbit/s
Upload: 119.48 Mbit/s

When you upgraded to the 6.11 kernel via rpi-update, did you also upgrade the rest of the driver (the firmware files) to the latest? There was a new release in January.

I did not know this is a thing, will re-test now with updated firmware!

Powered hubs on a RasPi... hmmm... good start to a scary novel. I recommend you leave the hubs out of this until we get this sorted out.

I'm aware, this is why I tested without powered hub too, and the upload is literally glued to 3Mbit. The RTL8822BU card does great, so I don't think it's a hub issue. FWIW, my ethernet is 1Gbit up/down, and I can get about 600Mbit up/down from my laptop over WiFi.

Would you mind sharing the following info with us as there has been a some conflicting info about the CF-952AX:

$ lsusb
Bus 003 Device 004: ID 0e8d:7961 MediaTek Inc. Wireless_Device
ViRb3 commented 1 year ago

Well, this is awkward... Turns out that for whatever reason, the problem was in the speedtest app, as you properly suggested. Running either of these alternatives produce vastly different results:

Sadly the results vary a lot from run to run, but seems like I'm getting about 200/200 on USB2 and 500/200 on USB3! The speeds should be symmetrical, but I suppose that upload will suffer with small devices like this. Is this correct?

Also turns out the problem was not in my USB3 hub, but rather the USB3 extension cable that follows it; directly attaching the Comfast to the hub properly joins USB3 mode.

All in all, very happy with the results so far! I think I'll wait for kernel 6.1 to hit stable in Raspberry Pi OS (should be very, very soon, perhaps even this month), but definitely switching to the Comfast after that.

ViRb3 commented 1 year ago

Comfast iperf3 results, USB3 mode:

-P 1

Connecting to host 192.168.1.101, port 5201
[  5] local 192.168.1.118 port 54250 connected to 192.168.1.101 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  29.7 MBytes   250 Mbits/sec    0   1.43 MBytes
[  5]   1.00-2.00   sec  33.8 MBytes   283 Mbits/sec    0   2.77 MBytes
[  5]   2.00-3.00   sec  35.0 MBytes   294 Mbits/sec    0   3.24 MBytes
[  5]   3.00-4.00   sec  33.8 MBytes   283 Mbits/sec    0   3.45 MBytes
[  5]   4.00-5.00   sec  32.5 MBytes   273 Mbits/sec    0   3.64 MBytes
[  5]   5.00-6.00   sec  33.8 MBytes   283 Mbits/sec    0   3.64 MBytes
[  5]   6.00-7.00   sec  32.5 MBytes   273 Mbits/sec    0   3.83 MBytes
[  5]   7.00-8.00   sec  33.8 MBytes   283 Mbits/sec    0   3.83 MBytes
[  5]   8.00-9.00   sec  35.0 MBytes   294 Mbits/sec    0   3.83 MBytes
[  5]   9.00-10.00  sec  31.2 MBytes   262 Mbits/sec    0   3.83 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   331 MBytes   278 Mbits/sec    0             sender
[  5]   0.00-10.06  sec   330 MBytes   275 Mbits/sec                  receiver

iperf Done.

-P 10

[SUM]   0.00-10.00  sec   340 MBytes   285 Mbits/sec  213             sender
[SUM]   0.00-10.03  sec   315 MBytes   264 Mbits/sec                  receiver

TP-Link Archer T4U iperf3 results, USB2 mode:

-P 1

Connecting to host 192.168.1.101, port 5201
[  5] local 192.168.1.106 port 42318 connected to 192.168.1.101 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  28.6 MBytes   240 Mbits/sec    0   1.23 MBytes
[  5]   1.00-2.00   sec  25.0 MBytes   210 Mbits/sec    0   1.66 MBytes
[  5]   2.00-3.00   sec  26.2 MBytes   220 Mbits/sec    0   1.75 MBytes
[  5]   3.00-4.00   sec  26.2 MBytes   220 Mbits/sec    0   1.85 MBytes
[  5]   4.00-5.00   sec  26.2 MBytes   220 Mbits/sec    0   1.94 MBytes
[  5]   5.00-6.00   sec  26.2 MBytes   220 Mbits/sec    0   2.04 MBytes
[  5]   6.00-7.00   sec  27.5 MBytes   231 Mbits/sec    0   2.04 MBytes
[  5]   7.00-8.00   sec  26.2 MBytes   220 Mbits/sec    0   2.04 MBytes
[  5]   8.00-9.00   sec  26.2 MBytes   220 Mbits/sec    0   2.25 MBytes
[  5]   9.00-10.00  sec  27.5 MBytes   231 Mbits/sec    0   2.37 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   266 MBytes   223 Mbits/sec    0             sender
[  5]   0.00-10.02  sec   264 MBytes   221 Mbits/sec                  receiver

-P 10

[SUM]   0.00-10.00  sec   274 MBytes   230 Mbits/sec    0             sender
[SUM]   0.00-10.02  sec   259 MBytes   217 Mbits/sec                  receiver

I think this answers all my questions... Now I just need a working extension cable so I can raise my adapter off the ground, will probably improve speeds significantly. Thanks for all the help!

morrownr commented 1 year ago

It sounds like things are headed in the right direction. Good.

Bus 003 Device 004: ID 0e8d:7961 MediaTek Inc. Wireless_Device

I appreciate you posting this. I am trying to sort out some inconsistent information about the Comfast CF-952AX. Another user that bought the 952AX said that it indeed does have the mt7921au chipset but that it used a device ID that was not one of the standard Mediatek provided device IDs so he submitted a patch to Linux wireless. In this case, I am seeing a standard Mediatek device ID so I am very puzzled.

Can I get you to send me the link you used to buy the product?

Can you confirm that the adapter is indeed the CF-952AX and not the CF953AX?

I need to get the details right or it can cause confusion.

I wish I had a good solution for a cable but I don't. It seems that getting a good USB3 cable that will work with a specific adapter is trial and error. I will suggest you measure and buy the shortest cable that will do the job.

Thanks

ViRb3 commented 1 year ago

Whops, you're right, my model is the CF-953AX, not CF-952AX. Purchased from here:

morrownr commented 1 year ago

Thanks

ViRb3 commented 1 year ago

@morrownr FYI kernel 6.1 landed in apt upgrade for Raspberry Pi OS. This driver is now built-in, so it's completely plug-n-play. Everything seems very stable, getting consistent 180/150 Mbit speeds. Only issue is the device is stuck in USB2 mode no matter what I do. I tried moving it around every port of my hub, with and without extension cable, but it can't go in USB3 for the life of me. I am sure it worked first try before, maybe the difference is that now I am using this card from initramfs? Any recommendations?

EDIT: I moved the card to my other (identical) hub, which is just on the other USB3 port on the Raspberry Pi, and woe and behold, I got 550/570 Mbits!!!

Any clues why this would be happening? I tried to swap the ports on the Raspberry Pi where the hubs are plugged in, but the lsusb -t does not change. Could it be one of the other devices plugged into the hub that "pulls up" the card to USB3? For reference, here's my two setups:

Bad:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 3: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 2: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 5, If 2, Class=Wireless, Driver=, 480M
            |__ Port 1: Dev 5, If 0, Class=Wireless, Driver=btusb, 480M
            |__ Port 1: Dev 5, If 3, Class=Vendor Specific Class, Driver=mt7921u, 480M
            |__ Port 1: Dev 5, If 1, Class=Wireless, Driver=btusb, 480M

Good:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 4: Dev 6, If 3, Class=Vendor Specific Class, Driver=mt7921u, 5000M
        |__ Port 4: Dev 6, If 1, Class=Wireless, Driver=btusb, 5000M
        |__ Port 4: Dev 6, If 2, Class=Wireless, Driver=, 5000M
        |__ Port 4: Dev 6, If 0, Class=Wireless, Driver=btusb, 5000M
    |__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 3: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 2: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M

EDIT2: My current theory is that the device gets stuck to either USB2 or USB3 the first time it is plugged in to power, and then it has no mechanism to upgrade the protocol. Therefore, if you plug in the card to the hub while the Pi is off, it will default to USB2 and get stuck there. My "fix" is to re-plug the device once the Pi is operational, then it gets stuck to USB3 mode even after the Pi is rebooted or powered off. Oh, and also my extension cable (2M, Amazon Basics, 2015) works for USB2 mode but not USB3 mode. I just ditched it.

bjlockie commented 1 year ago

How do you test the mode? I have a Raspberry Pi with the latest RaspbianOS and the same adapter. I get 1201mbps link speeds for both upload and download.

morrownr commented 1 year ago

@ViRb3

Your message above contains good info and an interesting situation. Let me recommend that you copy it and start a new issue. Maybe some minor mods to clarify some things in a new issue. The reason I say this is that we need more eyes on this than what will happen in this old issue. Let me ponder this and reply in the new issue.

@bjlockie

How do you test the mode?

lsusb -t

I get 1201mbps link speeds for both upload and download.

That is good but it does not mean your adapter is in USB3 mode. You can see 1200 Mbps link speeds in USB2.

bjlockie commented 1 year ago
I get 1201mbps link speeds for both upload and download.

That is good but it does not mean your adapter is in USB3 mode. You can see 1200 Mbps link speeds in USB2.

Should it show a faster link speed than the USB interface can do? That doesn't seem very logical to me.

Class=Vendor Specific Class, Driver=mt7921u, 5000M

morrownr commented 1 year ago

Class=Vendor Specific Class, Driver=mt7921u, 5000M

5000M means your adapter is in USB3 mode.

Should it show a faster link speed than the USB interface can do?

Sure. WiFi link speeds and USB mode are separate issues.

However, if you have a link speed of 1200 and the adapter is in USB2 mode in clean air, you probably won't see iperf3 speeds of more than 300 Mbps whereas the same situation in USB3 mode, you can see 650 Mbps. This is AC, 5 GHz testing.

So, USB2 can slow these fast adapters down a lot depending on the situation. However, it only matters if it matters. If a person is only using the adapter for internet access and their max ISP speed is 100 Mbps, then it does not matter.