Last active
July 12, 2023 18:43
-
-
Save Arie/26f19f898ea34dd904573640c6f2ee74 to your computer and use it in GitHub Desktop.
NanoPi R6S net-smp-affinity for gigabit with layer cake SQM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
get_device_irq() { | |
local device="$1" | |
local line | |
local seconds="0" | |
# wait up to 10 seconds for the irq/device to appear | |
while [ "${seconds}" -le 10 ]; do | |
line=$(grep -m 1 "${device}\$" /proc/interrupts) && break | |
seconds="$(( seconds + 2 ))" | |
sleep 2 | |
done | |
echo ${line} | sed 's/:.*//' | |
} | |
set_interface_core() { | |
local core_mask="$1" | |
local interface="$2" | |
local device="$3" | |
[ -z "${device}" ] && device="$interface" | |
local irq=$(get_device_irq "$device") | |
echo "${core_mask}" > /proc/irq/${irq}/smp_affinity | |
} | |
set_interface_core 2 "eth0" | |
echo f0 > /sys/class/net/eth0/queues/rx-0/rps_cpus | |
echo f0 > /sys/class/net/eth0/queues/rx-1/rps_cpus | |
set_interface_core 4 "eth1" | |
echo f0 > /sys/class/net/eth1/queues/rx-0/rps_cpus | |
set_interface_core 8 "eth2" | |
echo f0 > /sys/class/net/eth2/queues/rx-0/rps_cpus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment