Distribute DSA across 2 different cores MR8300 SNAPSHOT

Hey Yall,

I've been looking at upgrading to 910Mbps Fiber and Im worried that I will have to move back to stock firmware to get the speeds I'm paying for.

At the moment I know that the current DSA implementation is limited to 1 core for wan to lan connections which means that speed is limited from wan to lan...

I have an MR8300 which is running OpenWrt 23.05-SNAPSHOT r23263-b7fac1bf8c.
I got about 400Mbps when using iperf3 from wan to my pc, but while doing iperf3 from my pc to the router I got 940mbps

Is there a way to bind the WAN interface to core 0 and eth0 to core 1 in hopes of getting at least 800mbps

After reading the documentation listed I can see that it is possible but I'm not sure OpenWrt can do this o rwhen it could be done

If anyone can share their thoughts on this I would appreciate it as I don't want to be limited to

a) you're expecting more than this hardware can deliver (around one third of your expectations are realistic).
b) this is not an issue for ipq40xx, it physically only has a single CPU port to the switch anyways (even if it were capable of routing at 1 GBit/s wire speed in the first place).

Interesting i didn't realise there was that much data being processed and considering the router is advertised as being able to handle 2.2Gbps I thought it would be able to, heck even the 1.2gbps that iperf gets internally made me believe it.

I can understand now that I was being unrealistic.

My isp is going to supply a mercku m6 when I order and from what I can gather it runs a custom version of OpenWrt.

if it manages to deliver 1gbps would I be better off giving up the "security" of double nat and just using my MR8300 in dumb ap or a switch mode?

What would you recommend?

@DJMalachite if you try a non DSA firmware for MR8300 (22.03.5) maybe you can reach near 900 Mbps.
Playing with packet steering or irqbalance could help to achive it.

I have a MR8300 but only 300 Mbps.of contracted fiber speed.

Okay, I'll give that a try

@Klingon @slh Done some testing

here is my setup

Downstream ISP router

  • MR8300
  • Laptop running Iperf

Upstream MR8300

  • PC running iperf

The route for data goes Laptop -> ISP Router -> MR8300 -> PC

With this, I did tests to see the speed difference between the snapshot and 23.03.5

While running DSA on OpenWrt 23.05-SNAPSHOT r23263-b7fac1bf8c I managed to get around 481Mbits/s with packet steering, Software flow offloading enabled and irqbalance and CPU governer on performance

I then swapped over to 23.03.5 and applied the same settings (packet steering, Software offloading enabled, irqbalance, performance)

and with the non DSA firmware I managed to receive about 908Mbits/s

When i get the new internet should I just stick to a non DSA firmware until there are performance improvements?

Because the MR8300 seems to be capable of getting close to gigabit wan speeds

1 Like

I should stay in 22.03.5, and in a near or far future change to DSA firmware once the performance issues were solved.

2 Likes

Another workaround possibility is hardware NAT. ipq4019 has it, but I think it's not implemented (yet) in OpenWrt.

With 22.03 I remember testing at about 800 Mbit/s (packet steering, software NAT).
I'm currently using 23.05.0-rc2 but with a 22 Mbit/s ADSL WAN. So I have obviously no routing performance issue with such a low bandwith.

interesting, any idea how to go about implementing it into OpenWrt?

I wouldn't mind helping to add it if I can.

After some thought ill probably stick to 22.03.5 once I get my new broadband too get as close to line speed as I can, or just use the isp router for routing and the MR8300 as a dumb ap/switch

hm ... no :sweat_smile:
This is way beyond my coding abilities. My days of coding hardware related parts goes back to the 8bits era.
Gather any docs about the matter first.
As ipq4019 is a rather popular SoC I guess that someone should have already done it. Apparently it isn't the case, so there may be a trick somehow. Well in any case if someone (you?) could implement this, a lot of people would appreciate.

Sounds reasonable.

And mine most likely XD

I'll look at finding docs but I don't think Ill be able to code it myself tho.

Ipq4019 target on swconfig openwrt easily routes 1gbit fdx between ports with core load around 60/60/0/0 percent (4 cores/threads, actually two operating).

On DSA though it's another story. There's no way to spread load across the cores (not that I know of any anyway) and one core maxes at around 600 Mbps while others are doing nothing.

So much about the DSA performance in the current state of affairs, compared to old swconfig.

At this point, i think the extra speed of swconfig outweighs the pros of having each port manageable on DSA

Sure I won't be able to see the current speed being used by an individual connection but at least I will have line speed.

Sometimes I get the impression we are moving backwards instead of forward.
(This is not an attack againts any developer, I love OpenWRT,).

i seem to get full wirespeed on my fritz 7530

iperf3 -c 192.168.1.1
Connecting to host 192.168.1.1, port 5201
[  5] local 192.168.1.170 port 39152 connected to 192.168.1.1 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   108 MBytes   904 Mbits/sec   58    406 KBytes       
[  5]   1.00-2.00   sec   112 MBytes   937 Mbits/sec    0    496 KBytes       
[  5]   2.00-3.00   sec   109 MBytes   915 Mbits/sec    0    563 KBytes       
[  5]   3.00-4.00   sec   110 MBytes   923 Mbits/sec    0    607 KBytes       
[  5]   4.00-5.00   sec   110 MBytes   926 Mbits/sec    0    612 KBytes       
[  5]   5.00-6.00   sec   108 MBytes   906 Mbits/sec    0    612 KBytes       
[  5]   6.00-7.00   sec   112 MBytes   937 Mbits/sec    0    613 KBytes       
[  5]   7.00-8.00   sec   107 MBytes   896 Mbits/sec    0    613 KBytes       
[  5]   8.00-9.00   sec   107 MBytes   896 Mbits/sec    0    613 KBytes       
[  5]   9.00-10.00  sec   110 MBytes   927 Mbits/sec    0    613 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.07 GBytes   917 Mbits/sec   58             sender
[  5]   0.00-10.01  sec  1.07 GBytes   915 Mbits/sec                  receiver

iperf Done.

iperf3 -c 192.168.1.1 --reverse
Connecting to host 192.168.1.1, port 5201
Reverse mode, remote host 192.168.1.1 is sending
[  5] local 192.168.1.170 port 56098 connected to 192.168.1.1 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   112 MBytes   944 Mbits/sec                  
[  5]   1.00-2.00   sec   113 MBytes   948 Mbits/sec                  
[  5]   2.00-3.00   sec   113 MBytes   948 Mbits/sec                  
[  5]   3.00-4.00   sec   113 MBytes   949 Mbits/sec                  
[  5]   4.00-5.00   sec   113 MBytes   948 Mbits/sec                  
[  5]   5.00-6.00   sec   113 MBytes   948 Mbits/sec                  
[  5]   6.00-7.00   sec   113 MBytes   948 Mbits/sec                  
[  5]   7.00-8.00   sec   113 MBytes   948 Mbits/sec                  
[  5]   8.00-9.00   sec   113 MBytes   948 Mbits/sec                  
[  5]   9.00-10.00  sec   113 MBytes   948 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.10 GBytes   949 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  1.10 GBytes   948 Mbits/sec                  receiver

iperf Done.

This is the script I got from somewhere else I didn't write it (can't remember where notengobattery or lga1150 maybe) at some time to set the irq affinity:

#!/bin/sh /etc/rc.common

START=99

start() {
        local mask=4
        for irq in $(grep -F ath10k_ahb /proc/interrupts | cut -d: -f1 | sed 's, *,,')
        do
                echo "$mask" > "/proc/irq/$irq/smp_affinity"
                [ $mask = 4 ] && mask=8
        done

        mask=1
        for irq in $(grep -F c080000.ethernet /proc/interrupts | cut -d: -f1 | sed 's, *,,')
        do
                echo "$mask" > "/proc/irq/$irq/smp_affinity"
                mask=$((mask << 1))
                [ $mask = 16 ] && mask=1
        done
}

if building
save that as target/linux/ipq40xx/base-files/etc/init.d/set-irq-affinity
then chmod +x target/linux/ipq40xx/base-files/etc/init.d/set-irq-affinity

if putting on an existing device just ssh in make:
/etc/init.d/set-irq-affinity
then chmod +x /etc/init.d/set-irq-affinity
then reboot

eg

cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
 26:    1687808     253321    1219632    2126840     GIC-0  20 Level     arch_timer
 30:          6          0          0          0     GIC-0 270 Level     bam_dma
 31:        103          0          0          0     GIC-0 239 Level     bam_dma
 32:          5          0          0          0     GIC-0 139 Level     msm_serial0
 34:      78919          0          0          0     GIC-0 133 Level     bam_dma
 51:         24          0          0          0     GIC-0 200 Level     ath10k_ahb
 68:         16          0          0          0     GIC-0 201 Level     ath10k_ahb
 69:    4309704          0          0          0     GIC-0  97 Edge      c080000.ethernet:txq0
 73:          0      39164          0          0     GIC-0 101 Edge      c080000.ethernet:txq4
 77:          0          0       2445          0     GIC-0 105 Edge      c080000.ethernet:txq8
 81:         16          0          0     739939     GIC-0 109 Edge      c080000.ethernet:txq12
 85:     363017          0          0          0     GIC-0 272 Edge      c080000.ethernet:rxq0
 87:          0        699          0          0     GIC-0 274 Edge      c080000.ethernet:rxq2
 89:          0          0      53733          0     GIC-0 276 Edge      c080000.ethernet:rxq4
 91:          0          0          0    2825086     GIC-0 278 Edge      c080000.ethernet:rxq6
102:          0          0          0          0   PCI-MSI   0 Edge      aerdrv
103:          0          0          0          0   msmgpio  42 Edge      keys
104:          0          0          0          0   msmgpio  41 Edge      keys
105:          0          0          0          0   msmgpio  43 Edge      keys
106:          0          0          0          0     GIC-0 164 Level     xhci-hcd:usb1
107:          1          0          0          0   PCI-MSI 524288 Edge      PTM SL
108:    2005920          0          0          0   PCI-MSI 524289 Edge      mei_cpe
109:    3525739          0          0          0   PCI-MSI 524290 Edge      aca-txo
110:    4534305          0          0          0   PCI-MSI 524291 Edge      aca-rxo
IPI0:          0          0          0          0  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:       6464       7775       8927       7441  Rescheduling interrupts
IPI3:     643107    3379704    1904225    1209210  Function call interrupts
IPI4:          0          0          0          0  CPU stop interrupts
IPI5:     252097     145323     232420     872087  IRQ work interrupts
IPI6:          0          0          0          0  completion interrupts
Err:          0

I don't use packet steering, tho maybe sometimes it's ok to enable just on eth0 or the first lower bridge device
I'm not sure if the threading is enabled by default either or if it's a benefit

echo 1 > /sys/class/net/eth0/threaded

etcetc

1 Like

Maybe I'm wrong, but your test seems not to be testing NAT (from 192.168.1.170 to 192.168.1.1).
The problem should be with internet or any other network requiring NAT translations.

1 Like

ahh, ok, i'll try that tomorrow and see what i get
It does prove that the actual DSA driver is capable of operating at max tho maybe it does use up more cpu cycles and then NAT is effected, though i'm interested to see myself
perhaps it's the bridging performance mainly, are you running with llvm toolchain enabled and the "bridger" daemon chosen in the base section of the menuconfig ?
also looks like it might be better to distrubute across cpus other than 0 as well, only 1-3 probably better

I see what you mean, I seem to get a bit better, turning on packet sterring for the lower bridge device seems to work slightly better.
for me that's echo f > /sys/class/net/dsa-switch/queues/rx-0/rps_cpus
results:

iperf3 -c 192.168.1.1
Connecting to host 192.168.1.1, port 5201
[  5] local 192.168.8.130 port 48868 connected to 192.168.1.1 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  63.9 MBytes   536 Mbits/sec  111    270 KBytes       
[  5]   1.00-2.00   sec  68.3 MBytes   573 Mbits/sec    5    298 KBytes       
[  5]   2.00-3.00   sec  61.7 MBytes   518 Mbits/sec    9    304 KBytes       
[  5]   3.00-4.00   sec  61.1 MBytes   513 Mbits/sec  119    260 KBytes       
[  5]   4.00-5.00   sec  64.9 MBytes   544 Mbits/sec    1    296 KBytes       
[  5]   5.00-6.00   sec  66.3 MBytes   556 Mbits/sec    1    358 KBytes       
[  5]   6.00-7.00   sec  66.1 MBytes   554 Mbits/sec    2    269 KBytes       
[  5]   7.00-8.00   sec  67.3 MBytes   565 Mbits/sec    1    294 KBytes       
[  5]   8.00-9.00   sec  67.4 MBytes   565 Mbits/sec    1    334 KBytes       
[  5]   9.00-10.00  sec  66.3 MBytes   556 Mbits/sec    1    342 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   653 MBytes   548 Mbits/sec  251             sender
[  5]   0.00-10.00  sec   651 MBytes   546 Mbits/sec                  receiver

iperf Done.

1 Like

The same test in 22.03.5 you will get almost the double speed transfer. It's something related to DSA.

Thanks for the test @wilsonyan and sharing it.

1 Like

Could you compare values - run those same tests again on the LAN side without setting the IRQ affinity values?

I'm interested to see how much difference there is between vanilla DSA and with your affinity tweak - the Fritzbox 7530 has a capable CPU. I have one that I have not yet installed openwrt on.