Help with increase speed for 5G modem

Hi

I am currently working on a custom board, which main feature is a modem (quectel rm520n-gl) and a router (8device Habanero) connected via USB3.
The main problem we are having, is that we don't see the 5G speed we know the modem can handle. We have tested the modem on a evaluation board and a windows PC with quectel own driver. Here we see speed up to 700 Mbps.

When we are doing a speed test on our custom board we a getting max 250 Mbps and the modem is connected to the same network cell and is using the same band as when doing the test on the eva borad.

We have tried 2 version of Openwrt, 19 and 22.
The version 19 is our custom image, which has some of our own software running on it. We thought, maybe it was do to old USB driver that we didn't get the speed, so we tried version 22 but with no luck.

We know that the Habanero modules USB3 can handle the speed. It has been tested with a USB3 HDD.

Does anyone has suggestion to where the limit can be in our system? Can it be the Openwrt that has the limit?
What we need to confirm is that USB3 between the Habanero and the modem is make proper. Is it possible to make some kind of write/read test to the modem? (I know that this may not be the right place to ask this, but maybe some one know something about it).

We are using ModemManager on both version to control the modem.

Openwrt version 19 USB driver:
kmod-usb-core - 4.14.171-1
kmod-usb-dwc3 - 4.14.171-1
kmod-usb-dwc3-of-simple - 4.14.171-1
kmod-usb-phy-qcom-dwc3 - 4.14.171-1
kmod-usb-storage - 4.14.171-1
kmod-usb3 - 4.14.171-1

Openwrt version 22 USB driver:
kmod-usb-core - 5.15.85-1
kmod-usb-dwc3 - 5.15.85-1
kmod-usb-dwc3-qcom - 5.15.85-1
kmod-usb-net - 5.15.85-1
kmod-usb-net-qmi-wwan - 5.15.85-1
kmod-usb-serial - 5.15.85-1
kmod-usb-serial-option - 5.15.85-1
kmod-usb-serial-qualcomm - 5.15.85-1
kmod-usb-serial-wwan - 5.15.85-1
kmod-usb-wdm - 5.15.85-1
kmod-usb-xhci-hcd - 5.15.85-1
kmod-usb3 - 5.15.85-1
libusb-1.0-0 - 1.0.26-3
usbutils - 014-1

Use Ethernet instead of USB.

Did you check the CPU load?

When you say use ethernet instead of USB, do you means between Habanero and the modem? because the modem can only use USB or PCIe.

The CPU since not to have any problem, we have tried and make the USB run on it own core, without any change to the speed.

I'm assuming you are currently using an M.2 (NGFF) to USB adapter, I recommend using an M.2 (NGFF) to Ethernet adapter (with USB as an option). For your router the modem will act like an external router or bridge.

Below you can see how the Habanero and the modem are connected. So there are no USB adapter.

Habanero:

Modem/M.2 connector:

Well, if your router has an onboard M.2 connector then you have no USB adapter :wink:
In this case your alternative options are PCI (on the same M.2 connector, assuming all the necessary lines are there and all the driver support is available) and Ethernet connection with an external adapter as I described above.

Thanks for the suggestion. I will have to look some more in to the USB3, so I hopefully could make something work.

You probably won't get max speed out of the modem unless you enable some sort of packet aggregation on the USB link. Either by using mbim or qmux. I don't think the latter is used by modemmanager. By default at least. Mbim is definitely easier since it just works. But it can be done with qmi_wwan too if that's a requirement

The QMI support is selected in the menuconfig of the image. So I would assume it is enabled, but I am not sure. Is there a way to check if it is enabled?

If I want to try the Mbim, should it just be included in the image and it is good to go, or should it be enabled when the device is running? and if so how?

The QMI support is there, but configuring muxing/aggregation on a qmi link is non-trivial and probably not supported by default.

Switching to MBIM is a persistent vendor specifc firmware config thing. You should only do it if you're comfortable with that kind og cheanges, and it doesn't sound like you are. But if you do try, then you will have to build an image with MBIM support too.

For completeness: I suspect the speed issue is caused by the device and/or host failing to keep the USB link busy due to the high number of relatively "short" transfers. QMI default is one IP packet or ethernet frame at a time. The simple solution is to bundle more than one IP packet into each USB transfer. This is part of the MBIM protocol and enabled by default in the cdc_mbim driver. It's also semi-supported by qmi_wwan. But that setup requires a rather complex confguration exchange with the modem firmware. And I'm not sure how well supported newer modems are. You might have to use the "rmnet" driver, with "qmi_wwan" only providing the USB transport channel. Which makes it even more complicated.

I now hopefully managed creating an image with MBIM enabled and switch the modem to use MBIM.

When I do a "ifup wan" the modem connects to the internet, unfortunately the download speed are still low.
Is there some configuration I need to do for the MBIM to work proper?

No additional config should be required. Too bad this didn't help. I have no idea what to try next.

You can configure the MBIM aggragation policies using settings in /sys/class/net/wwan0/cdc_ncm/ but there's no reason to expect any changes will help. There's some docs at https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net-cdc_ncm if you want to play with it anyway.

Thanks for the suggestion, I really appreciate your help.

I have the same problem as you, I also use USB3 as 5G RM520NGL. Use M2 to convert USB3 interface.
Anyway I can get 800mbps download speed using windows computer.
But when I use openwrt I only get 250mbps download speed.
Whether it is qmi or mbim dialing. It seems to have nothing to do with cpu load.
I hope someone can find and solve the problem. Or provide ideas.
I use ECM and let the RM520NGL dial by itself. The USB is only used as a data network transmission, and the speed is still the same.

We have found, on our system, that it is the CPU core that the USB is running on is max out.
When i has looking in the "top" command, i look at the overall CPU usage and saw no problem, but if I look at the core separately one of them max out.

we have seen try to switch over to use PCie and here we get speed up to 520Mbps, but the CPU core also max out.

Do you have solution for this issue?
because i also facing same issue in my device.

Low USB3 speed - #8 by abidarwish This problem is very similar to here