aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2020-07-27 23:13:02 +0200
committerDavid Bauer <mail@david-bauer.net>2020-07-28 15:52:44 +0200
commit7a4fc8906cd2256e7381d1c043e19872eeb06883 (patch)
treef85408b758b4dfede12ba232976b421fb5c13a9f /target/linux
parent5a57a1ac1faaa8920ec36f070963b0a976a29525 (diff)
downloadupstream-7a4fc8906cd2256e7381d1c043e19872eeb06883.tar.gz
upstream-7a4fc8906cd2256e7381d1c043e19872eeb06883.tar.bz2
upstream-7a4fc8906cd2256e7381d1c043e19872eeb06883.zip
rockchip: distribute net interrupts
This adds a hotplug script for distributing interrupts of eth0 and eth1 across different cores. Otherwise the forwarding performance between eth0 and eth1 is severely affected. The existing SMP distribution mechanic in OpenWrt can't be used here, as the actual device IRQ has to be moved to dedicated cores. In case of eth1, this is in fact the USB3 controller. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity30
1 files changed, 30 insertions, 0 deletions
diff --git a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity
new file mode 100644
index 0000000000..ab3f954654
--- /dev/null
+++ b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+[ "$ACTION" = add ] || exit
+
+get_device_irq() {
+ local device="$1"
+
+ local line=$(grep -m 1 "${device}\$" /proc/interrupts)
+ echo $(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
+}
+
+case "$(board_name)" in
+friendlyarm,nanopi-r2s)
+ set_interface_core 2 "eth0"
+ set_interface_core 4 "eth1" "xhci-hcd:usb3"
+ ;;
+esac
+