rockchip: reliably distribute net interrupts
authorRonny Kotzschmar <ro.ok@me.com>
Wed, 6 Jul 2022 13:14:21 +0000 (15:14 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Thu, 7 Jul 2022 11:13:26 +0000 (13:13 +0200)
On the NanoPI R4S it takes an average of 3..5 seconds for the network devices
to appear in '/proc/interrupts'.
Wait up to 10 seconds to ensure that the distribution of the interrupts
really happens.

Signed-off-by: Ronny Kotzschmar <ro.ok@me.com>
target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity

index 9e4a4cf4fceb42abfb5f4de0426fd4c128205cd1..c76e62a23a347b9832f224788a82d50b11a1f31e 100644 (file)
@@ -4,8 +4,15 @@
 
 get_device_irq() {
        local device="$1"
-
-       local line=$(grep -m 1 "${device}\$" /proc/interrupts)
+       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/:.*//'
 }