As @mercygroundabyss said, I've explained a lot on that post that he suggested! You can also check the wiki and other posts of this thread like my older posts which have a little bit more info and also @walmartshopper posts, since he is the person who actually shared the initial information\findings about the cpu affinity for the R4S like the commands, some tests and etc! I've only tested more, did some more research, figure out some new stuff and expanded upon it...
Anyway if you want to see the current affinity, you can use the following command in shell to see the queues:
cat /sys/class/net/eth0/queues/rx-0/rps_cpus
cat /sys/class/net/eth1/queues/rx-0/rps_cpus
Mine is hex 3f, which is the hex for all 6 cores! Yours and if you did not change anything or enabled package steering, will be 00.
And you can use these ones, to find out about the IRQ:
1 -> grep eth /proc/interrupts
2 ->
cat /proc/irq/27/smp_affinity
cat /proc/irq/232/smp_affinity
As you can see above its hex 10 for eth0 and hex 20 for eth1, in other words, IRQ affinity for eth0 is using core 4 and IRQ affinity for eth1 is using core 5.
The layout of the CPU of the nanopi r4s in openwrt is like this by default:
The first core is 0 and the last one is 5 since its a 6 core cpu, now for which one of those are the a53 and a72 we have the following:
Core 0 = a53
Core 1 = a53
Core 2 = a53
Core 3 = a53
Core 4 = a72
Core 5 = a72
As @walmartshopper explained before:
"The number you echo into the file defines which CPUs to use. It's basically a binary number where each bit represents one CPU, then convert that to hex. Rightmost bit is CPU 0."
Binary = hex = cpu core
000001 = hex 1 = cpu core 0
000010 = hex 2 = cpu core 1
000100 = hex 4 = cpu core 2
001000 = hex 8 = cpu core 3
010000 = hex 10 = cpu core 4
100000 = hex 20 = cpu core 5
001111 = hex f = cpu cores 0, 1, 2 and 3
111111 = hex 3f = cpu cores 0, 1, 2, 3, 4 and 5.
110000 = hex 30 = cpu cores 4 and 5
Just use binary and covert it to hex, 1 = select that cpu core and 0 = unselect that cpu core.
Examples:
#ETH0 irq on core 4(a72 core)
echo 10 > /proc/irq/IRQ-NUMBER/smp_affinity
#ETH1 irq on core 5(a72 core)
echo 20 > /proc/irq/IRQ-NUMBER/smp_affinity
#ETH0 queues on all 6 cores(0, 1, 2, 3, 4 and 5)
echo 3f > /sys/class/net/eth0/queues/rx-0/rps_cpus
#ETH1 queues on all 6 cores(0, 1, 2, 3, 4 and 5)
echo 3f > /sys/class/net/eth1/queues/rx-0/rps_cpus
Just keep in mind that only the queues will spread to as many cores as you selected, the IRQ won't! You need to pick 1 core for the IRQ of each eth and thats the reason why i keeped mine on core 4 for eth0 and core 5 for eth1
I am still researching about this matter, cause yesterday i just saw someone using a different way of setting up the affinity in a rk3399 cpu: