How can we make the lantiq xrx200 devices faster

There was some speed decrease after 4.14.100 too it seems it is just because of some additional code checks.

Now that lantiq targets got 4.19 kernel, do this patch needs to be updated?

Most likely it needs one, gonna go look at it.

Edit: yeah you need to set a new structure member or the kernel will crash.

Can we expect anytime - i hope soon - to have these patches included in openwrt?

I think @pc2005 was working on that because I am part of that mailing list. But I dont really know how much progress has been made so far.

Edit: @pc2005 Can you please send the patches again? I think they are not being applied anymore or maybe they got deleted from my build system.

I'm back! :smiley:
Adding the WAN interface into this driver was hell! (and assuring it won't be so slow). I've rewritten the driver like two times, but now it seems it is working. It is still VERY -pre but it is not crashing anymore. So some description:
The lantiq SoC supports an additional interface (WAN) which is used by only one modem supported by openwrt. The data for WAN interface will either need one DMA FIFO (original driver) or one DMA FIFO will need to shared by LAN interface (my driver) ... (or there will be no WAN - my original driver, 2 months back :smiley: ). Sharing one DMA resource means synchronizations, which means locking, which means lower speeds.

So how bad is it? Well it is still lots of faster then original driver, but about 10% down from only-LAN driver (there is the room for some improvements, but not much).

BTW I've managed to find an option which speeds up even original driver. It is located in /sys/class/net/eth0/queues/rx-0/rps_cpus and basically it says how the receive queue needs to balanced on SMP system. The value is a bitmask which CPUs can use it. On my setup the value is nonzero. If you write a special value "0" the RPS will be disabled and the packet will be processed by the same CPU it arrived (which gets the IRQ). It seems the "0" will speed up the network a little bit (overhead of transfering the received packet to the other core is probably high).

Now some benchmarks:
Original driver
Original driver with fastest RPS settings
Updated SMP driver
Script used for testing

And finally, the patch, based on the current openwrt with kernel 4.19.65:
As usual copy the patch under the correct name to target/linux/lantiq/patches-4.19 and reconfigure the kernel. There maybe needed an empty line at the end of the file (pastebin can eat it). The SMP IRQ support is in a separate thread. You need to map IRQs to VPEs manually.

offtopic: if you put usb flash into the modem, start to read data (something like cat /dev/sda > /dev/null) and if you remove the usb flash during the copy... will your kernel crash? (try it multiple times, but be carefull to not damage the usb flash :smiley: )

P.S. I've found a way to speed the system a little more, but don't have time to implement that. I may post some testing app when this news are done.


If someone is feeling particularly adventurous and has enough spare time, there is also the option of letting Linux and Asterisk handle telephony by interfacing the SLIC with DAHDI instead of sacrificing one VPE. Daniel Golle talked a bit about it in (the patch there is unrelated, though). AFAIK there is no code for this yet, so this will require writing a DAHDI driver from scratch.

Hi everybody,
I was looking the current openwrt has reached kernel 5.4 (experimental testing option) so I've updated the ethernet driver for that too.


(the numbering is a little bit off probably, you shouldn't use my old patches together with this one anyway :slight_smile: )

Obligatory benchmarks:
Vanilla ethernet driver with vanilla DMA
New ethernet driver with vanilla DMA
New ethert driver with optimized DMA
Benchmarking script
(The speeds may be a little low as I'm using lately lots of computation power for BOINC)


0904-backport-vanilla-eth-driver.patch isn't available anymore. Did you remove it on purpose?

You need to use new patches now depending on your system. I did not add/remove anything.

My bad I was just looking at the wrong post.

For the 4.14 kernel I would need the patches published in Feb '19?

Yes you can try those. If it doesn't work for you then please post here again with the errors.

Got ready tplink w8970 image with @pc2005 patch if someone need it . Based on kernel 5.4 No problem with compatibility and stability so far for me .
But one thing. My WAN ( vdsl + vlan + pppoe ) to WiFi performance is only ~40Mbit .LAN -WiFi tops on 140Mbit with great range. I have full 55Mbit WAN -> LAN easy with SFQ cake

I would like to know how did you compile it with kernel 5.4. I could not find a thing.

Edit: Nevermind, I checked the source and OpenWrt master branch is already at v5.4.

FYI, do a make menuconfig, select Global Build Settings, select "Use the testing kernel version"

Testing Kernel 5.4.28 on XRX200, mine is a BT Home Hub 5a. Works mostly fine, except when I have a USB memory stick installed at boot time. I do not use extroot.

First link below is to boot log from a build of trunk made today. The device boots without the USB stick installed. It comes fine with no usage problems afaics. I then insert the USB stick and grab logread output.

logread without USB stick installed at boot

Booting with a USB memory stick results in a device that comes up but it does not provide an ip address over 2.4Ghz wifi or via ethernet, 5GHs wifi does function ok.

logread with USB memory stick installed at boot.

I notice this specific error

Tue Apr 7 14:00:58 2020 daemon.crit dnsmasq[1332]: bad option at line 1 of /mnt/sda1/syslog1.log

syslog1.log happens to be the first logread output files. I have no idea why dnsmasq opens it at all.

Maybe there is a bug with dnsmasq somewhere trying to output directly to the log file.


Thanks for testing.

What is your SFQ configuration?

Did you split the two ethernet TX rings to the separate VPEs?
The interrupts are /proc/interrupts and /proc/irq/.

BTW when you start reading/writing on USB stick and pull it out, will you get kernel panic? (around 30% chance)

I Just forgot to play with irq config . Currently both xrx200-net TX's use CPU0 as I'm not using eth WAN .
Pushing wlan0 to CPU1 got me arround full speed wan->wlan but need to test more.

root@W8970:~# cat /etc/config/sqm

config queue 'eth1'
        option qdisc 'fq_codel'
        option qdisc_advanced '0'
        option enabled '1'
        option download '0'
        option debug_logging '0'
        option verbosity '5'
        option interface 'dsl0.35'
        option linklayer 'ethernet'
        option overhead '34'
        option upload '8400'
        option script 'piece_of_cake.qos'