Nanopi R4S SqM, Set Higher Cores for it to work correctly

I’m running OpenWRT on a nanopi R4S with SQM on a 500/70 connection, I’ve read that I need to change some settings so SQM run on the higher CPU, I’m not family with the CMD but the GUI I’m okay.

I’ve tried doing it myself following guids but it’s just to much advanced for me to complete, I’ve contacted the guy who did the guild to change the required settings and he said he would do it via a remote link, but as I don’t know this person I’m unsure to proceed

Most of "good" SQM-s are single-core classifiers. Only fq_codel is somewhat multi-core.

Guide:
Disable SQM and reboot device
Measure https://www.waveform.com/tools/bufferbloat -> this good if you want link without IP to post here (alternative: https://speed.cloudflare.com)
Now take half of achieved upload bandwidth (megabit equals 1024 kilobits, not 1000) and set download to 0
Splice in half up until latency starts to rise and step back.
Repeat with download (note you have less control here, it may have jitter and stuff as provider's exchange points are overrun by your co-customer traffic)

Observe system load with e.g. htop and choose the script and scheduler to strictly keep all CPU-s under 100%

1 Like

Thank you for the detailed reply, I need to address the issue with SqM resetting after every save/reboot first, This is a known issue with the R4S

Config is saved (Save and apply) in uniform way in /etc/config or there is a bug?

Examples:

:!: If you restart or change settings with SQM, it will reset the CPU affinity and you will need to re-apply settings.

Putting the commands in rc.local should work, assuming the IRQ numbers are somewhat static, which they seem to be. You may want to double check the IRQ numbers in /proc/interrupts and then do a reboot and check again to make sure they stay the same.

That is not a sqm setting.

@BoltonUK add this to your startup

	find /sys/class/net/eth*/queues/[rt]x-[01]/[rx]ps_cpus -exec sh -c '[ -w {} ] && echo 30 > {} 2>/dev/null' \;
	;;

find /sys/devices/system/cpu/cpufreq/ -name scaling_governor | while read GOVERNOR ; do echo performance > $GOVERNOR ; done

then change this

	set_interface_core 4 "eth0"
	set_interface_core 8 "eth1"

	

as default they are set to core 10 and 20, you need these cores for the queue

use WinSCP, navigate to /etc/hotplug.d/net and change the affinity file, its easy to do then reboot router

For 500 Mb/s you should not hit any limits with the default settings, you can try These settings if you want to play around with things.
As already mentioned your cpu affinity settings is getting reset if you do changes to sqm, not the other way around, but if you apply the settings i linked you can just reboot and the affinity is applied again.

Well, that is something not really sqm thing.
Does irqbalance work on particular platform?

I think the issue is that SQM just reveals the consequence of a big little design, where the little cores have lower CPU IDs, at least that is my cursory analysis. Without receive packet steering both shaper instances not only end up on the same CPU but also on a "not so fast" one.
This would be same for similar loads, but sqm tends to be one obvious candidate for that specific load pattern that needs some manual help.

1 Like

This is what I’m struggling to achieve, when it comes to cmd everything just goes over my head, but with the Web gui im perfectly fine and know my way around.

echo 04 > /proc/irq/31/smp_affinity
echo 08 > /proc/irq/87/smp_affinity
echo 10 > /sys/class/net/eth0/queues/rx-0/rps_cpus
echo 20 > /sys/class/net/eth1/queues/rx-0/rps_cpus

find /sys/devices/system/cpu/cpufreq/ -name scaling_governor | while read GOVERNOR ; do echo performance > $GOVERNOR ; done

find /sys/class/net/eth*/queues/[rt]x-[01]/[rx]ps_cpus -exec sh -c '[ -w {} ] && echo 30 > {} 2>/dev/null' \;

copy that into your startup on luci then reboot, see if that helps

1 Like

Maybe you could start by showing your SQM settings, and run Waveform bufferbloat test before and after applying SQM and post links to the result.
Will make it much easier to help you move forward.

1 Like