2020-07-29 19:02:51 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
[ "$ACTION" = add ] || exit
|
|
|
|
|
|
|
|
get_device_irq() {
|
|
|
|
local device="$1"
|
2021-10-08 16:22:39 +08:00
|
|
|
local line
|
2022-08-01 16:02:39 +08:00
|
|
|
local seconds
|
2021-10-08 16:22:39 +08:00
|
|
|
|
|
|
|
# wait up to 10 seconds for the irq/device to appear
|
2022-08-01 16:02:39 +08:00
|
|
|
for seconds in $(seq 0 9); do
|
2021-10-08 16:22:39 +08:00
|
|
|
line=$(grep -m 1 "${device}\$" /proc/interrupts) && break
|
2022-08-01 16:02:39 +08:00
|
|
|
sleep 1
|
2021-10-08 16:22:39 +08:00
|
|
|
done
|
2021-03-14 11:52:00 +08:00
|
|
|
echo ${line} | sed 's/:.*//'
|
2020-07-29 19:02:51 +08: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
|
2024-08-18 21:30:36 +08:00
|
|
|
armsom,sige1|\
|
2024-09-18 14:05:09 +08:00
|
|
|
armsom,sige3|\
|
2024-09-24 15:15:27 +08:00
|
|
|
armsom,sige7|\
|
2024-08-18 21:30:36 +08:00
|
|
|
hinlink,opc-h28k|\
|
|
|
|
radxa,e20c|\
|
|
|
|
widora,mangopi-m28k|\
|
|
|
|
widora,mangopi-m28k-pro)
|
|
|
|
set_interface_core 4 "eth0"
|
|
|
|
;;
|
|
|
|
firefly,rk3568-roc-pc|\
|
|
|
|
friendlyarm,nanopi-r5c)
|
2022-08-01 16:02:39 +08:00
|
|
|
set_interface_core 2 "eth0"
|
|
|
|
set_interface_core 4 "eth1"
|
|
|
|
;;
|
2021-10-08 16:22:39 +08:00
|
|
|
friendlyarm,nanopi-r2c|\
|
2021-03-30 14:03:34 +08:00
|
|
|
friendlyarm,nanopi-r2s|\
|
2021-12-22 23:29:37 +08:00
|
|
|
xunlong,orangepi-r1-plus|\
|
|
|
|
xunlong,orangepi-r1-plus-lts)
|
2020-07-29 19:02:51 +08:00
|
|
|
set_interface_core 2 "eth0"
|
|
|
|
set_interface_core 4 "eth1" "xhci-hcd:usb3"
|
|
|
|
;;
|
2021-11-08 12:55:54 +08:00
|
|
|
friendlyarm,nanopi-r4s|\
|
2022-08-01 16:02:39 +08:00
|
|
|
friendlyarm,nanopi-r4se|\
|
2021-11-10 23:30:09 +08:00
|
|
|
sharevdi,guangmiao-g4c)
|
2020-12-21 18:45:26 +08:00
|
|
|
set_interface_core 10 "eth0"
|
|
|
|
set_interface_core 20 "eth1"
|
|
|
|
;;
|
2024-08-18 21:30:36 +08:00
|
|
|
friendlyarm,nanopi-r5s|\
|
|
|
|
friendlyarm,nanopi-r6s)
|
|
|
|
set_interface_core 2 "eth0"
|
|
|
|
set_interface_core 4 "eth1"
|
|
|
|
set_interface_core 8 "eth2"
|
2022-08-14 06:53:39 +00:00
|
|
|
;;
|
2020-07-29 19:02:51 +08:00
|
|
|
esac
|
|
|
|
|