target/rockchip/rk35xx: update network smp affinity
This commit is contained in:
parent
878ea47461
commit
5c9f46c0ef
@ -3,6 +3,9 @@
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
NPROCS="$(grep -c "^processor.*:" /proc/cpuinfo)"
|
||||
PROC_MASK="$(( (1 << $NPROCS) - 1 ))"
|
||||
|
||||
rename_iface() {
|
||||
ip link set $1 down && ip link set $1 name $2
|
||||
}
|
||||
@ -17,19 +20,29 @@ set_iface_cpumask() {
|
||||
local device="$3"
|
||||
local irq
|
||||
local seconds
|
||||
local mq
|
||||
local queue_mask=$(( $PROC_MASK ^ 0x${core_mask} ))
|
||||
queue_mask="$(printf %x "$queue_mask")"
|
||||
|
||||
[[ -z "${device}" || "${device}" = "${interface}-0" ]] && ip link set dev "${interface}" up
|
||||
[[ -d "/sys/class/net/${interface}" ]] || return 1
|
||||
|
||||
[[ -n "${device}" && "${device}" = "${interface}-*" ]] && mq=1
|
||||
|
||||
[[ -z "${mq}" || "${device}" = "${interface}-0" ]] && ip link set dev "${interface}" up
|
||||
|
||||
[[ -z "${device}" ]] && device="$interface"
|
||||
|
||||
for seconds in $(seq 0 2); do
|
||||
for seconds in $(seq 0 1); do
|
||||
irq=$(grep -m1 " ${device}\$" /proc/interrupts | sed -n -e 's/^ *\([^ :]\+\):.*$/\1/p')
|
||||
if [ -n "${irq}" ]; then
|
||||
echo "${core_mask}" > /proc/irq/${irq}/smp_affinity
|
||||
[[ -z "${mq}" ]] && echo "${queue_mask}" > /sys/class/net/$interface/queues/rx-0/rps_cpus
|
||||
[[ -z "${mq}" ]] && echo "${queue_mask}" > /sys/class/net/$interface/queues/tx-0/xps_cpus
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
board_fixup_iface_name() {
|
||||
@ -108,27 +121,48 @@ board_set_iface_smp_affinity() {
|
||||
;;
|
||||
friendlyelec,nanopi-r5s)
|
||||
set_iface_cpumask 2 eth0
|
||||
if ethtool -i eth1 | grep -Fq 'driver: r8169'; then
|
||||
set_iface_cpumask 4 "eth1"
|
||||
set_iface_cpumask 8 "eth2"
|
||||
else
|
||||
set_iface_cpumask 4 "eth1" "eth1-0" && \
|
||||
set_iface_cpumask 4 "eth1" "eth1-16" && \
|
||||
set_iface_cpumask 2 "eth1" "eth1-18" && \
|
||||
set_iface_cpumask 8 "eth2" "eth2-0" && \
|
||||
set_iface_cpumask 8 "eth2" "eth2-18" && \
|
||||
set_iface_cpumask 1 "eth2" "eth2-16"
|
||||
fi
|
||||
;;
|
||||
lyt,t68m|\
|
||||
fastrhino,r68s|\
|
||||
hinlink,opc-h68k)
|
||||
set_iface_cpumask 1 "eth0"
|
||||
set_iface_cpumask 2 "eth1"
|
||||
set_iface_cpumask 4 "eth2" "eth2-0"
|
||||
set_iface_cpumask 4 "eth2" "eth2-16"
|
||||
set_iface_cpumask 2 "eth2" "eth2-18"
|
||||
set_iface_cpumask 8 "eth3" "eth3-0"
|
||||
set_iface_cpumask 8 "eth3" "eth3-18"
|
||||
set_iface_cpumask 1 "eth3" "eth3-16"
|
||||
if ethtool -i eth2 | grep -Fq 'driver: r8169'; then
|
||||
set_iface_cpumask 4 "eth2"
|
||||
set_iface_cpumask 8 "eth3"
|
||||
else
|
||||
set_iface_cpumask 4 "eth2" "eth2-0" && \
|
||||
set_iface_cpumask 4 "eth2" "eth2-16" && \
|
||||
set_iface_cpumask 2 "eth2" "eth2-18" && \
|
||||
set_iface_cpumask 8 "eth3" "eth3-0" && \
|
||||
set_iface_cpumask 8 "eth3" "eth3-18" && \
|
||||
set_iface_cpumask 1 "eth3" "eth3-16"
|
||||
fi
|
||||
;;
|
||||
fastrhino,r66s|\
|
||||
hinlink,opc-h66k)
|
||||
set_iface_cpumask 4 "eth0" "eth0-0"
|
||||
set_iface_cpumask 4 "eth0" "eth0-16"
|
||||
set_iface_cpumask 2 "eth0" "eth0-18"
|
||||
set_iface_cpumask 8 "eth1" "eth1-0"
|
||||
set_iface_cpumask 8 "eth1" "eth1-18"
|
||||
set_iface_cpumask 1 "eth1" "eth1-16"
|
||||
if ethtool -i eth0 | grep -Fq 'driver: r8169'; then
|
||||
set_iface_cpumask 4 "eth0"
|
||||
set_iface_cpumask 8 "eth1"
|
||||
else
|
||||
set_iface_cpumask 4 "eth0" "eth0-0" && \
|
||||
set_iface_cpumask 4 "eth0" "eth0-16" && \
|
||||
set_iface_cpumask 2 "eth0" "eth0-18" && \
|
||||
set_iface_cpumask 8 "eth1" "eth1-0" && \
|
||||
set_iface_cpumask 8 "eth1" "eth1-18" && \
|
||||
set_iface_cpumask 1 "eth1" "eth1-16"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ BOARDNAME:=RK3568 boards (64 bit)
|
||||
|
||||
KERNEL_PATCHVER=4.19
|
||||
|
||||
DEFAULT_PACKAGES+=kmod-r8125
|
||||
DEFAULT_PACKAGES+=kmod-r8125 ethtool
|
||||
|
||||
define Target/Description
|
||||
Build firmware image for Rockchip RK3568 devices.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user