TD-W8970/XRX200: Huge performance loss when going from LEDE 17.01 to OpenWrt 18.06 or 19.07

I wanted to test switching performance of my old LEDE router to see if it would be better on OpenWrt (knowing that it will probably be cpu-bound).

I cleared the configuration, started from scratch and configured the WAN interface using my ISP data and it works, albeit a bit slow:
Using MS Edge (86.073 kbps download, 94.040 kbps upload)
Using Firefox (95.853 kbps download, 52.963 kbps upload)

Note that it should be more than 100.000, normally hovers around 124,000

Then I upgraded to OpenWrt 19.07(.4) and I got this, which is way slower:
(64.136 kbps download, 64.806 kbps upload)

The results are consistent, with very little variability.

So I went back to OpenWrt 18.06(.9) and I get similar results.

I've noticed that running top while benchmarking yields vastly difference CPU usages between LEDE and OpenWrt. With OpenWrt, the CPU usage never gets above 50%, and with LEDE it goes to 89%.

What is going on? Is there something that can be done?

Here's my /etc/config/network:

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr ''
	option netmask ''

config globals 'globals'
	option ula_prefix 'fd3a:17f6:7522::/48'

config dsl 'dsl'
	option annex 'a'
	option tone 'av'
	option xfer_mode 'ptm'
	option ds_snr_offset '0'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0.1'
	option proto 'static'
	option netmask ''
	option ip6assign '60'
	option ipaddr ''

config interface 'wan'
	option proto 'pppoe'
	option ipv6 '1'
	option username ''
	option password ''
	option _orig_ifname 'ptm0'
	option _orig_bridge 'false'
	option ifname 'eth0.100'

config device 'wan_dev'
	option name 'ptm0'
	option macaddr 'e8:de:27:2e:ca:51'

config interface 'wan6'
	option ifname '@wan'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option vid '1'
	option ports '0 2 5 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '4t 6t'
	option vid '100'

PS: I had to remove image as I'm a newbie

AFAIK it's a known issue for XRX200[]=hh5a#openwrt_18_and_later_slow_wan_to_lan_throughput

1 Like

Copying from the old thread [18.06.4] speed fix for BT HomeHub 5a, since this won't be changed for 18.06.X or 19.07.X as it's a "performance fix" the quickest way on an existing device is just to;

$ rm /etc/hotplug.d/net/20-smp-tune

This won't affect currently up interfaces until a restart or you manually echo 0 to their rps_cpus and xps_cpus proc entries.

If building from git master then no action is required as it's already fixed. For a HH5 to further improve performance, I would suggest adding the SMP IRQ patches, now just one 0901-add-icu-smp-support.patch for git master which really should be commited, and then use the irqbalance daemon or manually set IRQ assignments in /etc/rc.local.

1 Like

Thanks @maurer and @Reiver, I should have dug deeper before asking :slight_smile:

Removing that hotplug script works, it's faster at around 86.824 Kbps

I've tried setting up irqbalance but I can't see its effect. interrupts look like this:

# cat /proc/interrupts
           CPU0       CPU1
  7:      61869      62335      MIPS   7  timer
  8:       1676       1370      MIPS   0  IPI call
  9:      14004      50392      MIPS   1  IPI resched
 22:     123016          0       icu  22  spi_rx
 23:      19939          0       icu  23  spi_tx
 24:          0          0       icu  24  spi_err
 62:          0          0       icu  62  1e101000.usb, dwc2_hsotg:usb1
 72:      12430          0       icu  72  vrx200_rx
 73:      20079          0       icu  73  vrx200_tx
 75:          0          0       icu  75  vrx200_tx_2
 91:          0          0       icu  91  1e106000.usb, dwc2_hsotg:usb2
112:        184          0       icu 112  asc_tx
113:          0          0       icu 113  asc_rx
114:          0          0       icu 114  asc_err
126:          0          0       icu 126  gptu
127:          0          0       icu 127  gptu
128:          0          0       icu 128  gptu
129:          0          0       icu 129  gptu
130:          0          0       icu 130  gptu
131:          0          0       icu 131  gptu
144:      82179          0       icu 144  ath9k
161:          0          0       icu 161  ifx_pcie_rc0
ERR:          1

Does this table make sense?

You'd need to build OpenWRT from source with the mentioned patch for master or these two for the 19.07 branch.

For my ADSL2 use case(s), I just just set the following in /etc/rc.local to split the load assuming wireless usage will be either 2.4GHz ath9k or 5GHz ath10k at a time. If no DSL, split the wireless instead perhaps. YMMV.

# Manual IRQ balancing
# ath9k
echo 2 > /proc/irq/30/smp_affinity
# vrx200_rx
echo 2 > /proc/irq/72/smp_affinity
# ath10k
echo 2 > /proc/irq/144/smp_affinity

1 Like

Unfortunately those patches have been removed from pastebin, while the other ones that work give me errors like:

Applying /home/user/openwrt/target/linux/lantiq/patches-5.4/0901-add-icu-smp-support.patch using plaintext:
(Stripping trailing CRs from patch; use --binary to disable.)
patching file arch/mips/lantiq/irq.c
Hunk #1 FAILED at 49.
Hunk #2 FAILED at 62.
Hunk #3 FAILED at 81.
Hunk #4 FAILED at 92.
Hunk #5 FAILED at 104.
Hunk #6 FAILED at 158.
Hunk #7 succeeded at 255 with fuzz 2 (offset 52 lines).
Hunk #8 FAILED at 241.
Hunk #9 FAILED at 261.
patch unexpectedly ends in middle of line
Hunk #10 FAILED at 305.
9 out of 10 hunks FAILED -- saving rejects to file arch/mips/lantiq/irq.c.rej
Patch failed!  Please fix /home/user/openwrt/target/linux/lantiq/patches-5.4/0901-add-icu-smp-support.patch!

Tried both master and 19.07 branches, but I think I'm missing something. Crap, I hate being a newbie.