2020-07-27 21:13:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
[ "$ACTION" = add ] || exit
|
|
|
|
|
|
|
|
get_device_irq() {
|
|
|
|
local device="$1"
|
|
|
|
|
|
|
|
local line=$(grep -m 1 "${device}\$" /proc/interrupts)
|
2020-08-17 21:13:57 +00:00
|
|
|
echo ${line} | sed 's/:.*//'
|
2020-07-27 21:13:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$(board_name)" in
|
|
|
|
friendlyarm,nanopi-r2s)
|
|
|
|
set_interface_core 2 "eth0"
|
|
|
|
set_interface_core 4 "eth1" "xhci-hcd:usb3"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|