How can we make the lantiq xrx200 devices faster

I read this topic for several months and now I would like to test all this patchset on my main DSL router. TD-W8970v1. Sadly it lacks wave300 5GHz onboard. Where can i find precompiled image?
@pc2005 thank you for your work.

This topic does not relate with wave300 wifi. It is more related to CPU stability and Lan speed improvement.

Anyway you need the full source code to build firmware with these patches, otherwise you can not use them. I use this with my W8980 and HomeHub 5A and it's really good.

Also @pc2005 was working for integrating these patches into mainstream OpenWrt. I have no idea when will that happen and there's no info on any progress yet. If the integration is done then you'll just need to use the Snapshots in future to avail these benefits but for now you have to compile from source.

@ahmar16 Thank you for your explanations and also for your support and testing.
But as for me - due some circumstances i can not prepare buildtree based on current master to build image with this patches so i want to kindly ask you to build and share image for tdw8970 if you can.
Thank You in advance.

I'll see if I can build one for you. What packages do you want to use with the build? How much flash does your router have? Do you plan to use ExtRoot? What filesystem would you want to use for it?

That is stock TP-LINK TD-W8970 without any hw mods. With zram-swap, no extroot. Now it is running on my custom SMP enabled early LEDE build for years and is very stable.

root@TDW8970:~# uname -a
Linux TDW8970 4.4.32 #0 SMP Mon Nov 21 15:15:34 2016 mips GNU/Linux
root@TDW8970:~# free
             total       used       free     shared    buffers     cached
Mem:         59160      36092      23068       1276       3268       8172
-/+ buffers/cache:      24652      34508
Swap:        28668        152      28516
root@TDW8970:~# uptime
 21:04:10 up 29 days,  1:28,  load average: 0.00, 0.21, 0.16

So it will be very interesting to test @pc2005 patches on field for stability.
If you can, include please some extra packages: luci, luci-app-ddns, kmod-carl9170, kmod-usb-core, kmod-usb-dwc2, carl9170-firmware, iperf3.
Thank you.

I created the firmware before so I was not able to add carl9170 but everything else is there, but not included in the firmware itself. You can see for yourself: https://1drv.ms/u/s!Au9VmMwLylkznvFOdS7kngv6yUQm2g

Firmware itself includes LuCI and minimal packages for USB support, there are more packages added but they are in different folders and you can install them afterwards.

1 Like

I'm actually doing other work, but I hope I will be available to make the non RFC patches soon. Wifi driver (wave300) shouldn't be used for "production" and because of absolute no warranty/on your own risk you should compile it yourself. Maybe in the future when we develop better driver from the scratch :wink: .

3 Likes

pc2005: Thank you in advance for this, looking forward for testing some new version available for my TD-W8970 :slight_smile:

I had some spare time to test perfomance difference between three different LEDE/OpenWrt builds on Tp-link TD-W8970. There is ancient LEDE 4.4.32 r2281-SMPmod, current OpenWrt 4.14.114 r9933-snapshot and 4.14.114 r9908 pc2005-patched @ahmar16 build.
Network througput was tested both on 1Gbit ethernet cable link and WiFi. Distance ~1,5 meters between router and HP EliteBook G3 laptop running Ubuntu 16.04.

To make long story short quick results are noted in this table.

Mbits/sec, Retr 4.4.32 r2281-SMPmod 4.14.114 r9933-snapshot 4.14.114 r9908 pc2005-patched
WiFi 1,5m receiver 89,9 /50 retr 68,8 /41 retr 86,9 /0 retr
WiFi 1,5m sender 32,0 /1 retr 42,5 /0 retr 46,7 /22 retr
1Gbit eth receiver 119 /377 retr 93,5 /196 retr 123 /50 retr
1Gbit eth sender 62,6 /0 retr 41,9 /0 retr 241 /0 retr

Conclusions: Current snapshot has significant throughput regression compared to ancient LEDE 4.4.32 kernel. @pc2005's performance patches makes it more than 1,3x faster on ethernet receiving speed and more than 5,7x (!) faster on sending speed.
Great ethernet performance increase noted.
This patches also gives ~10-25% WiFi performance increase.

Now about dark side. DSL driver is found extremely unstable on both current snapshots, patched and unpatched. DSL traffic fully stops in few minutes uptime. This traffic stall can be fixed on next few minutes by
ifconfig dsl0 down ; ifconfig dsl0 up

2 Likes

@pc2005 great thanks i do a short try on my Easybox-904xDSL with

-march=mips32r2 -mmt -mdsp -mtune=34kc

It looks fine, but more builds and more test take a littlebit time i will do it the next weeks

1 Like

I've had the problems with DSL when I've tried to use different firmware version (it must be probably matched with driver version).

After reconfiguring DSL part from scratch it seems to handle stable connection for more than 24h. I think this problem gone away. Did you had time to seek for a reason of the speed regression in recent kernels? I saw only 123/241 Mbps instead of noted 350/260 Mbps on earlier kernels on iperf3 tcp tests.

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:
0904-xrx200-net-smp-frags-support.patch
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.

8 Likes

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 https://patchwork.ozlabs.org/patch/731164/ (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.

0904-xrx200-net-smp-frags-support.patch
0906-xrx200-dma-speedup.patch

(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)

3 Likes