NanoPI R6S with OpenWRT

So you boot from eMMC?
How many partition observed after flashing image?

This may or may not help you, but here is what I have:
I have attempted to write use a MicroSD, but also I can't get my OpenWRT image to boot and the partitions look like in the screenshot below.
The image was generated for a NanoPC T6 after modifying the scripts from as poseted here: NanoPC-T6 is a ultimate device than R4S R5S R6S - #26 by mihaibuba
Also here is the documentation on the boot flow:
https://opensource.rock-chips.com/wiki_Boot_option#Boot_flow

And here is a screenshot of the partition layout of a MicroSD which has a Debian image that is booting from here: https://github.com/inindev/nanopc-t6

I don't know if this helps anyone. But I wrote this script to set CPU affinity so I that I could do cake SQM with the R6S on my 1400Mbps connection. I am open to suggestions on improving the script.

Before the cpu affinity optimization I could only push up to 800 Mbps with Cake SQM turned on. After, I could do 1400Mbps easily which is close the the max my ISP provides.

I still can't figure out how to make these change survive on reboot via rc.local. But they do survive on sqm changes. I posted my issue here https://github.com/StarWhiz/NanoPi-R6S-CPU-Optimization-for-Gigabit-SQM/issues/1

Update: I've solved it!!! You can see the update in the same GitHub link https://github.com/StarWhiz/NanoPi-R6S-CPU-Optimization-for-Gigabit-SQM/tree/main

Maybe you should post this to "For Developers" categories for wider audience?
BTW, NanoPi R4S has official support and having same CPU affinity thing, the OpenWrt Wiki also mentioned about it, not sure if there is any setting that can survive the SQM setting change.

1 Like

Oh, the partition layout of my compiled one is the same as you, with one named "kernel" and one named "rootfs", but that's weird that it can't boot from SD card.

I have cleared the eMMC of my R6S (previously played with DietPi + Proxmox and wiped it) so let me think how to make it work again

Edit: I just used FriendlyElec SD image to boot and write my compiled image to eMMC, still unable to boot, I don't know what extra steps needed.....

Update: Now it can't boot any more, even with mask rom button + FriendlyElec SD card it won't boot any more....need to buy a cable to do recovery (just noticed that eMMC is soldered so I cannot remove and let it boot from SD card)

1 Like

ah yes I recovered someone's bricked R6S with a USB-A to USB-A Cable with the method outlined in https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6S#Option_3:_Install_OS_via_USB

I did have to try a couple times with the Mask button but after a couple tries I got it to recognize on the USB-A to USB-A cable and do the re-flashing.

I don't know if it's a gotcha for you but I had one point thought the reset button was the mask button. But it turns out the "mask" button is indeed it's own button next to the microSD reader. The second gotcha is to make sure you use the blue USB 3.0 port when doing that.

Note: I also permanently solved my original problem with the CPU Affinity!

	set_interface_core 1 "eth0"
	echo 2 > /sys/class/net/eth0/queues/rx-0/rps_cpus
	echo 2 > /sys/class/net/eth0/queues/tx-0/xps_cpus
	set_interface_core 4 "eth1-0"
	set_interface_core 4 "eth1-16"
	set_interface_core 4 "eth1-18"
	echo 10 > /sys/class/net/eth1/queues/rx-0/rps_cpus
	echo 20 > /sys/class/net/eth1/queues/tx-0/xps_cpus
	set_interface_core 8 "eth2-0"
	set_interface_core 8 "eth2-16"
	set_interface_core 8 "eth2-18"
	echo 40 > /sys/class/net/eth2/queues/rx-0/rps_cpus
	echo 80 > /sys/class/net/eth2/queues/tx-0/xps_cpus
	;;

Give the above a try, ive found these to work best IMHO

1 Like

I saw some very cheap USB-A to A cable, I guess nothing special required by R6S recovery?

Also I didn't mixed up those 2 buttons, the one next to SD slot is MASK button, once I pressed it, RED light becomes always on, I have no idea why

I have posted recovery information starting here:

Yes I saw that, currently I don't have the cable (since R6S needs A-to-A!) and need to buy one.

I see that you assigned

7654 3210 <- CPU #s
0000 0010 - 1 slow core on both eth0 rx tx queues
0001 0000 - 1 fast cores on eth1 rx queue
0010 0000 - 1 fast cores on eth1 tx queue
0100 0000 - 1 fast cores on eth2 rx queue
1000 0000 - 1 fast cores on eth2 rx queue

0000 0001 - 1 slow core on eth0 IRQ
0000 0100 - 1 slow core on eth1 IRQ
0000 1000 - 1 slow core on eth2 IRQ

I did a comparison between mods here: https://youtu.be/RhVtOiiB2Yk

I like yours since you basically almost assigned a single core per task which helps me isolate things.

Yours had most of the load was on CPU6 (a fast core). Because my connection is asymmetrical at around 1400mbps down / 35 mbps up. It makes sense that the utilization is on CPU6 was high since it's the core assigned to the eth2 rx queue

Now I think to optimize for my assymetrical connection I should focus the big cores on ingress queues and put slow cores on all egress queues.

Maybe yours is more optimal for a symmetrical connection?

As for the IRQ assignments I'll have to figure that one out.

On the mods I had most of the load was on CPU3 a slower core and it's unclear why since it's not isolated.

Thanks for sharing! I'm going to play around with it for a bit! Maybe...

	set_interface_core 1 "eth0"
	echo 2 > /sys/class/net/eth0/queues/rx-0/rps_cpus
	echo 2 > /sys/class/net/eth0/queues/tx-0/xps_cpus
	set_interface_core 4 "eth1-0"
	set_interface_core 4 "eth1-16"
	set_interface_core 4 "eth1-18"
	echo 10 > /sys/class/net/eth1/queues/rx-0/rps_cpus
	echo 20 > /sys/class/net/eth1/queues/tx-0/xps_cpus
	set_interface_core 8 "eth2-0"
	set_interface_core 8 "eth2-16"
	set_interface_core 8 "eth2-18"
	echo c0 > /sys/class/net/eth2/queues/rx-0/rps_cpus
	echo 80 > /sys/class/net/eth2/queues/tx-0/xps_cpus
	;;

Here I replace 40 with c0 because of my asymmetrical connection CPU6 could use help from CPU7?

1 Like
	set_interface_core 1 "eth0"
	#echo 2 > /sys/class/net/eth0/queues/rx-0/rps_cpus
	#echo 2 > /sys/class/net/eth0/queues/tx-0/xps_cpus
	set_interface_core 4 "eth1-0"
	set_interface_core 4 "eth1-16"
	set_interface_core 4 "eth1-18"
	#echo 10 > /sys/class/net/eth1/queues/rx-0/rps_cpus
	#echo 20 > /sys/class/net/eth1/queues/tx-0/xps_cpus
	set_interface_core 8 "eth2-0"
	set_interface_core 8 "eth2-16"
	set_interface_core 8 "eth2-18"
	#echo 40 > /sys/class/net/eth2/queues/rx-0/rps_cpus
	#echo 80 > /sys/class/net/eth2/queues/tx-0/xps_cpus
	find /sys/class/net/eth*/queues/[rt]x-[01]/[rx]ps_cpus -exec sh -c '[ -w {} ] && echo f0 > {} 2>/dev/null' \;
	;;

I have a PPPOE 980mb / 120mb connection, i used a NanoPI R4S before, and found that assigning irq to the slower cores and queues to the faster gave me better performance, hopefully it helps. The above will allocate all queues onto the fast cores, which may perform better in your case as it should spread the load over the 4 faster cores. Im not using eth0 hence placing both on cpu1 and cpu 2.

try adding the below also in your startup -

#CPU Performance 
find /sys/devices/system/cpu/cpufreq/ -name scaling_governor | while read GOVERNOR ; do echo performance > $GOVERNOR ; done
#below needed if default cpu scaling used (not performance)
find /sys/devices/system/cpu/cpufreq/ -name scaling_min_freq | while read MINFREQ ; do echo 816000 > $MINFREQ ; done

also i am using

(https://github.com/jeverley/dscpclassify)

for my SQM, which works well for my needs.

2 Likes

I see I see in that case I think I will do the following below since I plan on using eth0 with my gigabit switch. If eth1 is not in use that means the faster cores will operate on eth0 and eth2 instead right?

I gave the extra slower core to the WAN port IRQs.

friendlyelec,nanopi-r6s)
	set_interface_core 1 "eth0"
	echo c0 > /sys/class/net/eth0/queues/rx-0/rps_cpus
	echo 30 > /sys/class/net/eth0/queues/tx-0/xps_cpus
	set_interface_core 2 "eth1-0"
	set_interface_core 2 "eth1-16"
	set_interface_core 2 "eth1-18"
	echo c0 > /sys/class/net/eth1/queues/rx-0/rps_cpus
	echo 30 > /sys/class/net/eth1/queues/tx-0/xps_cpus
	set_interface_core c "eth2-0"
	set_interface_core c "eth2-16"
	set_interface_core c "eth2-18"
	echo c0 > /sys/class/net/eth2/queues/rx-0/rps_cpus
	echo 30 > /sys/class/net/eth2/queues/tx-0/xps_cpus
	;;

https://openwrt.org/docs/guide-user/advanced/load_balancing_-_tuning_smp_irq

Interrupts can only be set one per core.

set_interface_core c "eth2-0"

so i think you can only set the_interface_core to a specific cpu as per the below

set_interface_core 4 "eth1-0"

unless this is differnet on the R6S. you can only spread the queues over multiple cpu's

1 Like

So my cheap cable arrived today, well it's simple and worked, now my R6S comes back and will think about how to make a bootable image again.

You might want an USB UART cable as well. This works to recover any router trough serial access:

I couldn't find mine which I had used years ago to recover a router, so I actually ended up ordering one off ebay

Hello all,

may it be that dnsmasq won't work in a VLAN Setup togehther with PBR.

I tried 6.1 Kernel and 6.6 Kernel on R6S on MJ with openwrt.
Currently I run:
OpenWrt SNAPSHOT r0-8945857 / LuCI Master git-23.365.47501-032f305

I've setup VLANs between Client and Server.
When I manually assign an IP address to the client the it gets connectivity to the environment.

I did set up a DHCP (dnsmasq) on the server to serve that VLAN, but when I want to get an IP with DHCP it shows the following

Wed Jan 10 21:14:59 2024 daemon.info dnsmasq-dhcp[1]: DHCP, IP range 192.168.30.100 -- 192.168.30.249, lease time 5m
Wed Jan 10 21:14:59 2024 daemon.info dnsmasq-dhcp[1]: DHCP, sockets bound exclusively to interface br-lan.30
.
.
Wed Jan 10 21:16:36 2024 daemon.info dnsmasq-dhcp[1]: BOOTP(br-lan.30) c8:f7:50:31:6f:05 no address configured

When I create a static lease for the abovemntioned MAC I do not get connectivity through dnsmasq.
Does someone have a clue?
Thank you

Glad it worked out for you. I wrote down the process in case I ever needed to do that again as well. Figured out how to change RKFlasher to English for example!

1 Like

I think you made a small mistake in the text of the instructions. The selected language should be 2, but you are writing:

Change the language by editing config.ini and changing the "Selected" portion from 2 to 1

2 Likes

Just figured it out so far.

I've installed Openwrt above the friendlywrt elec image.
This resulted in messed up NIC assignements (e.g. NIC 1 wrong Led) and other NIC driver issues.
Started over with a fresh Friendywrt image evrything works a s expected.
One caveat was then new.
I connected the bridge interface to my managed switch.
1 NIC was fine. As soon as I connected the 2nd NIC my network went inoperable. I think there have been broadcast storms.
I then activated STP on the Managed Switch and the br-lan device.
Now it works as expected.