nss-packages-qosmio/wwan/utils/quectel-cm/files/smp-affinity-qmi-usb.sh
Sean Khan cb16855b9a wwan: Fix formatting in scripts using shfmt
Executed shfmt with the following options:

shfmt -ln bash -i 0 -bn -s -d wwan/**.sh

Signed-off-by: Sean Khan <datapronix@protonmail.com>
2025-07-09 23:51:34 -04:00

25 lines
591 B
Bash

#!/bin/sh
[ "$ACTION" = add ] || exit
echo "$INTERFACE" | grep -q "wwan" || exit
core_count="$(grep -c "processor" "/proc/cpuinfo")"
irq_path="/sys/class/net/$INTERFACE/queues"
devnum="$(echo "${INTERFACE%_*}" | grep -Eo "[0-9]+")"
core="$((devnum % (core_count - 1) + 1))"
if [ "$INTERFACE" != "${INTERFACE%_*}" ]; then
if [ "$core" -lt "$((core_count - 1))" ]; then
let core++
else
core="1"
fi
fi
irq="$(printf "%x" "$((1 << core))")"
echo "$irq" >"$irq_path/rx-0/rps_cpus"
echo "4096" >"$irq_path/rx-0/rps_flow_cnt"
echo "2000" >"/proc/sys/net/core/netdev_max_backlog"
exit 0