Low USB3 speed

Hi,
We testing a Quectel (RM520N-GL) modem on a Habanero (IPQ40XX) module using the USB3 interface the Max speed we have seen is 250Mbs on this combination. When we move the modem to a raspberryPi we get more than 800Mbs (also running OpenWrt). Any thoughts are appreciated?
The usages of the used CPU is 100% during this speedtest. IPQ40XX has 4 CPUs
The network is not an issue and the modem have a proven throughput of more than 1.2Gbs.
Our thoughts are USB3 driver is not configured properly like buffersizes, DMA etc. but it not clear how to configure this. OpenWrt version 23-05-RC3

2 Likes

My thought is you max out the CPU....

1 Like

This thing?

ARM Cortex-A7, quad-core (717 MHz) IPQ4019/IPQ4029

Might wanna read this

Is the RPi overclocked to 2Ghz?? If so...even though it's the same arm chip...it's clocked to 2-3x the speed

With that said...the data sheet is pretty daggum nice...even with a slow speed (was digging for a way to overclock??!??)
[https://drive.google.com/file/d/1R_a1nTq_a59-EuQpVAdg8PbLWRdOpyoe/view?pli=1]( 8DEV6000 HABANERO FEATURES spec sheet on google drive )

Yes, I have the same and that's why I ask for DMA configuration, buffer size etc.

No the RPi is clocked at 1.8Ghz and is only using 20% of the CPU. In my minds it does not make sense to add an USB3 interface if the HW does not support at least a better performance than USB2. This is why I would expect one of the three DMA controllers could do the job, but the default config in OpenWrt only enables the PIO control on the USB interfaces.

Is this performance difference reproducable using some other Linux platform?

Yes it is.

We see this constantly in ROOter with MT7621 routers and now in the MT7981 as well.

ROOter use the completely standard OpenWrt USB packages without any changes yet we have 5G modems that top out at 250-300 Mbps with MT7621 and 500 Mbps with the MT7981. This is with modems and connections that should be producing over 800 Mbps.

We seem to have tracked this down to the USB system as the same modem and connection in a M.2 to Ethernet adapter will give the higher speeds. Put it in the USB based M.2 interface and you get the lower speeds.

The other thing that we see is that the factory firmware will give the higher speeds as well on different routers using the MT7621 or MT7981 chips set. These firmware are mostly based on a hacked up version of 17.01 with the MT7981 using 21.02. In some cases they will give speeds twice as fast.

I have been told that 19.07 will give the higher speeds but have yet to have that confirmed. It appears that something in the USB system was changed after 17.01 (or possibly 19.07) but none of the people that are involved in tracking this down have a clue what it is.

But it is a real problem that appears on different chip sets when high speed 5G modems that use the USB system are present.

2 Likes

We are facing this issue in Arcadyan AW1000 also which uses IPQ807x soc.

We can see through htop, every time we run ookla speedtest, the core0 will spike to 100% meanwhile the other 3 cores are like doing nothing which we believe what causes the bottleneck. The speed can't go beyond 700mbps.

To check what processes are maxing out the core0, we looked at /proc/interrupts and found that xhci-hcd:usb3 is the culprit.

To verify this, we set the irq of xhci-hcd:usb3 to run in the other cores, for exampe, core1 as so:

echo 2 > "/proc/irq/$(grep usb3 /proc/interrupts | awk -F: '{print $1}' | sed 's/^ //')/smp_affinity"

Indeed, core1 maxes out to 100% of usage each time we run ookla speedtest. Interestingly, even if we echo f in the command above which means to be run in all cores, xhci-hcd:usb3 still running in only 1 core.

In conclusion, we believe that the usb3 driver (we are not sure if this is the right term) doesn't support multithreading which causes the speed being capped below 700mbps.

As a workaround, we write this script to increase the speed until somebody can fix the usb3 driver at the kernel level.

#!/bin/sh
#script by Abi Darwish

INTERRUPT=$(ls /proc/irq/ | sed '/default/d')
USB3_NUMBER=$(grep usb3 /proc/interrupts | awk -F: '{print $1}' | sed 's/^ //')

for I in ${INTERRUPT}; do
	if [[ ${I} = ${USB3_NUMBER} ]]; then
        	echo 2 > /proc/irq/${I}/smp_affinity 2>/dev/null
        else
        	echo 1 > /proc/irq/${I}/smp_affinity 2>/dev/null
        fi
        printf "%-10s" ${I}:
        cat /proc/irq/${I}/smp_affinity
done
4 Likes

This is the fact. I have also encountered low performance problems using the 301W ipq8072a. especially usb3

Sorry, but this community doesn't work like this, if you have a solution please share it, otherwise there is no need to even advertise you have it.

flagged the posts, hopefully we'll get them removed.

2 Likes

The USB script provided above does not solve the problem. At least in my case.

I hope that someone will come up with a solution to this problem and share it with the community.

I think I have found the cause of the issue and some fix, at least on my arcadyan aw1000 IPQ807x.

As we already know, when we do speedtest, we can see that the speed cannot go beyond 700mbps. After some troubleshootings, we can see that the CPU core0 is maxing out while other cores look like doing nothing.

Therefore, I write a patch so that the CPU, especially, core0 runs more efficiently and not spike to 100% all the time which causes what I call a speed cap.

This patch needs more testing and tuning so that the cpu becomes more efficient.

Here a quick video to demo before and after the patch:

1 Like

Hi All :wave:

Has anyone else tested the script presented by @abidarwish ?

I wonder if we are going in the right direction or if we are looking for the problem in the right place. @Dairyman wrote above that recent OpenWrt releases reduce the performance of LTE-A/5G modems by about 20-30%.

In the video presented by @abidarwish , we can see that the CPU load is distributed across all cores, but we don't see a "big increase in connection speed".
Unless I'm wrong and please correct what I wrote.

1 Like

Well, the speed in the video is the maximum speed I can get at the location.

The purpose of the video is to demo how inefficient cpu load on a default installation and how a patch could resolve the issue.

Regarding speed, my team have tested it and got more than 1gbps.

I share a video made by one of my tester demoing the potential of the modem after the patch:

2 Likes

Can you please share the patch, anyone. I also want to do a test. As mentioned above, the latest openwrt main has a 20-30% speed drop in 5G/LTE.
How to solve the problem of slow 5G speed using USB3 as M2.
Thank you all very much for exploring.

Hi @abidarwish ,

I asked for tests and I received them.. Wow..
Looking at your speed results, my internet is fast as a turtle.
Out of shame, I should delete my github account and not admit that I use mobile internet.

Will you share "magic solution" with the Community or keep the secret to yourself?

because your speed is lower ... ?

I get 800 mbit with a 5G modem sitting in my basement, the 1.2gbit isn't very surprising (to me).

:open_mouth:

Exactly. It's a shame where 5G is in my country.

Not really your fault then, is it ?
,)