How to get gigabit internet speed on TP-Link Archer C7 with OpenWrt and

Few weeks ago, I got gigabit internet. After technician finished settings it up, I did plug-in my computer to new modem/router and able to see close to gigabit speed (around 920-940 megabits). Awesome. Then I did make sure that I made modem/router as dumb as can and connected my PC to my router. After that I did run speed test again. To my surprise I got about 260-280 megabits per second. What the hell? And I started investigation.

My current version was OpenWrt 18.06.4 and I started to check everything. To make long story short, at the end, I found out that CPU load is 100% during speed test. I used command top from SSH to confirm that and I also found that kworker process is consuming nearly 100% and sirq had 100% (you can see it at top right corner).

Then I started research and found out following. OpenWrt is Linux based and network stack for Linux is working in CPU mode. It means that every byte is going via CPU. Most consumer-grade router simply not able to achieve gigabit speed in that mode. Their CPU is simply not fast enough to transfer data at that rate. There are quite a lot of routers with price tag above $200 that can do this, but honestly, I do not want to buy such expensive router. There are multiple reasons:

  • They are expensive. If I will mess up $70 router, I can live with that. But If I will mess up $200 router, I will be really upset
  • These routers almost always hot. Power means heat in electronics. And my router is in room that has pretty much no ventilation
  • They are not that popular, so it will be way harder to find solution for any problem

Well, does it mean that I am stuck with ¼ of gigabit speed until I buy more expensive router? It would be quite bad. But after some research I found that next version of OpenWrt is based on Linux kernel 4.14 and OpenWrt team ported software offloading from 4.16. And software offloading can considerably increase speed. You can read little bit about that here:

Anyway, after I installed new version and enabled “Software flow offloading” in Network|Firewall and I got about 650-720 megabits. Still slower, but still almost 2.5-3 times faster than before. And during speed test, router’s CPU was close to 100% and not fully at 100%. I did read that some people able to get more than 900 megabits on the same router and I will continue my investigation. But anyway, it already looks way better.

But I must note that this feature is stated as experimental. It also is not compatible with many other OpenWrt features such as SQM and VPN if I remember correctly. Also, after I enabled “Software flow offloading” I could see “Hardware flow offloading” became visible. Please do not use it, as it could create problems, because it did not implement for Archer C7.

Funny enough, but most of consumer grade routers can achieve gigabit speed with their native firmware. How is possible? Well, most of these routers has special hardware that allow to transfer data with minimum of CPU involvement. Then why OpenWrt does not use it? Well, it is a good question. I will try to explain it.

Firstly, there are lot of such hardware modules. As result OpenWrt must develop and support a lot of code for different type of routers. This requires a lot of resources that OpenWrt team simply does not have. Secondly, very often there is no documentation available on how to use it. And thirdly, sometimes vendors went extra mile to ensure that nobody will use their modules. They use patents and other meanings to stop open source from using these modules.

As result, we will still support for some hardware modules, but I believe that support will be limited at least at the beginning. Perhaps with faster internet and growing demand from community it will change, but for now only one such module is supported.

And while we are talking about CPU speed, VPN is another thing that kill performance considerably. I remember long time ago I enabled VPN for whole home and speed dropped like ten times. I did not understand why and decided not to use it. But now I know why. Encryption is CPU bound and requires a really powerful CPU. For Archer C7 it also about 10 times drop according to tests.

I hope it helps someone