[GCC 7.2 BUILD] Optimized TP-Link Archer C7 V2 AC1750 LEDE Firmware

@hobbsAU Ok that's at least something, but not good enough compared to vanilla LEDE. I'll look into this further, but it will probably take some time, not sure if I can make it before next weekend.

Could you take a screenshot of top while doing iperf? I'm curious if it's soft irq or something else causing the limitations.

@r00t no worries thanks for looking into it.

#cat /proc/interrupts
           CPU0       
  4:        532      MIPS   4  eth0
  5:      60031      MIPS   5  eth1
  7:     155725      MIPS   7  timer
 11:         26      MISC  serial
 41:      43313  AR724X PCI   ath10k_pci
 47:          0     dummy  ath9k
 48:          0     dummy  ehci_hcd:usb1
 49:          0     dummy  ehci_hcd:usb2
ERR:         13

#cat /proc/softirqs 
                    CPU0       
          HI:          0
       TIMER:     141704
      NET_TX:       2718
      NET_RX:     133109
       BLOCK:          0
BLOCK_IOPOLL:          0
     TASKLET:        267
       SCHED:          0
     HRTIMER:          0
         RCU:      32099

Mem: 89844K used, 35832K free, 1120K shrd, 8852K buff, 28608K cached
CPU:   1% usr   0% sys   0% nic   0% idle   0% io   0% irq  98% sirq
Load average: 0.40 0.15 0.16 2/91 6409
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
    3     2 root     RW       0   0%  95% [ksoftirqd/0]
 2357     1 tor      S     5648   4%   1% /usr/sbin/tor --runasdaemon 0
 2845     1 root     S     3948   3%   1% /usr/sbin/collectd -f
  104     2 root     SW       0   0%   1% [kworker/0:1]
 6202  6122 root     S     1544   1%   0% top
 6409  5822 root     R     1544   1%   0% top
 5604     1 root     S     4216   3%   0% /usr/sbin/hostapd -s -P /var/run/wifi
 2727     1 root     S     2688   2%   0% /usr/sbin/uhttpd -f -h /www -r LEDE -
 2973     1 nobody   S     2032   2%   0% /usr/sbin/dnscrypt-proxy /var/etc/dns
 2070     1 root     S     1892   2%   0% /sbin/netifd
    1     0 root     S     1720   1%   0% /sbin/procd
 2102     1 root     S     1616   1%   0% /usr/sbin/odhcpd
 1999     1 root     S     1616   1%   0% /sbin/rpcd
 2495  2070 root     S     1528   1%   0% udhcpc -p /var/run/udhcpc-eth0.2.pid
 3032     1 root     S <   1528   1%   0% /usr/sbin/ntpd -n -N -S /usr/sbin/ntp
 5822  5821 root     S     1528   1%   0% -ash
 6122  6121 root     S     1528   1%   0% -ash
 1990     1 root     S     1384   1%   0% /sbin/logd -S 64
  573     1 root     S     1348   1%   0% /sbin/ubusd
 2582     1 dnsmasq  S     1312   1%   0% /usr/sbin/dnsmasq -C /var/etc/dnsmasq

@hobbsAU Thanks for all your help, I appreciate it! I pushed another build. Basically I'm now including kernel settings that should increase performance, although I normally use those on servers, so I might have to fine tune them for smaller hardware later on in case you run out of RAM with too many open connections or something. Also this uses cake for qdisk instead of fq_codel now. It's a pretty random attempt to increase network performance, but hey, maybe we're lucky this time.. :slight_smile:

@r00t Thanks happy to help.

Seems as though it's still problematic..

C7v2(C5 hardware) r00t’s LEDE Optimised Build 20170319_v4
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 395 MBytes 331 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 395 MBytes 331 Mbits/sec receiver

Mem: 86244K used, 39432K free, 956K shrd, 8908K buff, 27712K cached
CPU:   0% usr   0% sys   0% nic   0% idle   0% io   0% irq  99% sirq
Load average: 0.23 0.35 0.20 2/88 4190
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
    3     2 root     RW       0   0%  97% [ksoftirqd/0]
 2088     1 tor      S     6304   5%   1% /usr/sbin/tor --runasdaemon 0
  104     2 root     SW       0   0%   1% [kworker/0:1]
 1790     1 root     S     1616   1%   0% /usr/sbin/odhcpd
 4190  4179 root     R     1536   1%   0% top
 4178  1875 root     S     1308   1%   0% /usr/sbin/dropbear -F -P /var/run/dro
 3924     1 root     S     4588   4%   0% /usr/sbin/hostapd -s -P /var/run/wifi
 2328     1 root     S     4056   3%   0% /usr/sbin/collectd -f
 2187     1 root     S     2712   2%   0% /usr/sbin/uhttpd -f -h /www -r LEDE -
 1855     1 nobody   S     2032   2%   0% /usr/sbin/dnscrypt-proxy /var/etc/dns
 1761     1 root     S     1860   1%   0% /sbin/netifd
    1     0 root     S     1720   1%   0% /sbin/procd
 1690     1 root     S     1628   1%   0% /sbin/rpcd
 2232  1761 root     S     1528   1%   0% udhcpc -p /var/run/udhcpc-eth0.2.pid
 2488     1 root     S <   1528   1%   0% /usr/sbin/ntpd -n -N -S /usr/sbin/ntp
 4179  4178 root     S     1528   1%   0% -ash
 1681     1 root     S     1384   1%   0% /sbin/logd -S 64
  579     1 root     S     1348   1%   0% /sbin/ubusd
 2394     1 dnsmasq  S     1316   1%   0% /usr/sbin/dnsmasq -C /var/etc/dnsmasq
 1875     1 root     S     1240   1%   0% /usr/sbin/dropbear -F -P /var/run/dro

root@LEDE:~# cat /proc/interrupts 
           CPU0       
  4:        154      MIPS   4  eth0
  5:      15670      MIPS   5  eth1
  7:      42305      MIPS   7  timer
 11:         26      MISC  serial
 41:       7417  AR724X PCI   ath10k_pci
 47:          0     dummy  ath9k
 48:          0     dummy  ehci_hcd:usb1
 49:          0     dummy  ehci_hcd:usb2
ERR:          1
root@LEDE:~# cat /proc/softirqs 
                    CPU0       
          HI:          0
       TIMER:      38350
      NET_TX:        685
      NET_RX:      28688
       BLOCK:          0
BLOCK_IOPOLL:          0
     TASKLET:        115
       SCHED:          0
     HRTIMER:          0
         RCU:      15954

@hobbsAU Ok, thanks for testing this. I'll give up for today then - spent the better part of my day on this. Doesn't seem like there's an easy fix unfortunately. Maybe someone has some suggestions about what could cause this, else I'll need to revert all customizations piece by piece to narrow it down.

Thanks @r00t hope you find it soon.

The Vanilla LEDE release doesn't have any SQM installed correct? This may be causing the perf decrease compared to vanilla/stock. Perhaps compare it to Vanilla+SQM, or use root's build, and delete the SQM package, reboot and test.

So SQM could be "active" even though it's not actually enabled in settings? That would be a very easy fix indeed and would explain the quite huge difference in throughput.

My builds are basically default config; only difference from upstream LEDE at this point (apart form my builds being somewhat outdated) is the enabling of the WiFi intermediate queues for ath10k. This could be a reason for the different bandwidth for 5ghz WiFi, I suppose. Never did get to the bottom of that...

It's configured only for eth1. i tried removing SQM and deps, rebooted but no difference.

I did find a few interesting things though..

I tried removing all the link layer iptables components. Gives a reasonable speed boost.

REMOVING kmod-ebtables, kmod-ebtables-watchers kmod-ebtables-ipv4 kmod-ebtables-ipv6
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 454 MBytes 381 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 453 MBytes 380 Mbits/sec receiver
Looking better!

REMOVING kmod-ipt-extra —autoremove (removes kmod-br-netfilter)
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 541 MBytes 454 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 541 MBytes 454 Mbits/sec receiver
Better again!

REMOVING kmod-arptables kmod-ipt-raw mod-ipt-raw6
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 543 MBytes 455 Mbits/sec 616 sender
[ 4] 0.00-10.00 sec 541 MBytes 454 Mbits/sec receiver
No difference..

I've finally made the Archer C7(C5) scream..

Test setup
Host A (iperf3 client) —> WiFi —> Ethernet LAN Bridge —> Host B (iperf3 server)

C7v2(C5 hardware) Custom Patched LEDE 17.01.0 Build
I've optimized for mips74kc, used gcc 6.3, binutils 2.27 and applied gwlim's patches - well some of the performance oriented ones - and built a fairly vanilla LEDE build. It certainly doesn't have functional parity with @r00t's build but it's almost as fast as stock firmware on WiFi.

You can try it out yourself, build instructions on github. Just make sure you select Archer C7 on the first make menuconfig and also select any packages on the second make menuconfig (e.g. Luci is all i normally select).

https://github.com/hobbsAU/mips74k-ar71xx-lede-patch

iperf3 -c 192.168.1.125 -b 1000M
Connecting to host 192.168.1.20, port 5201
[ 4] local 192.168.1.10 port 56080 connected to 192.168.1.20 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 54.5 MBytes 457 Mbits/sec 0 2.59 MBytes
[ 4] 1.00-2.00 sec 84.5 MBytes 709 Mbits/sec 0 2.86 MBytes
[ 4] 2.00-3.00 sec 77.0 MBytes 646 Mbits/sec 0 2.86 MBytes
[ 4] 3.00-4.00 sec 81.5 MBytes 684 Mbits/sec 0 2.86 MBytes
[ 4] 4.00-5.00 sec 76.1 MBytes 638 Mbits/sec 0 2.86 MBytes
[ 4] 5.00-6.00 sec 83.0 MBytes 696 Mbits/sec 0 2.86 MBytes
[ 4] 6.00-7.00 sec 81.0 MBytes 680 Mbits/sec 0 2.86 MBytes
[ 4] 7.00-8.00 sec 84.2 MBytes 707 Mbits/sec 0 2.86 MBytes
[ 4] 8.00-9.00 sec 82.0 MBytes 688 Mbits/sec 0 2.86 MBytes
[ 4] 9.00-10.00 sec 74.1 MBytes 622 Mbits/sec 0 2.86 MBytes


[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 778 MBytes 653 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 778 MBytes 653 Mbits/sec receiver

5 Likes

Thanks for today's posts, @hobbsAU! I'll look into the details as soon as I got time. Good catch regarding the netfilter modules. I didn't know they could affect performance when no actual rules are in place. Will surely check out your build & patches too!

Can you test your NAT?

I only did one test and I think it was ~350Mbits/sec TCP sitting right in front of the router. Although I didn't apply any of your hardware specific NAT patches.

Clock frequency is 720 right?
Based on my WDR4300 overclocked to 730MHZ I can get around 450Mbps with all my patches
Actually your C7 should be able to take all my patches you just need to change the menuconfig to C7 that is all.

Yes 720Mhz stock. I'll try all your patches - should they be applied to lede-17.01 branch or 17.01.0 snapshot?

The latest kernel 4.4.46 broken the disable netlink patch you will need to fix that manually.
You can enable qca-ssdk as well should work out of the box
I usually go by branch with all the updates

Any chance of getting a sysupgrade img of hobbsAU's build?

@kyledawg92 I've added to the repo under /bin

1 Like