#!/bin/sh #set -x if [ $# -eq 0 ]; then echo "usage: msixbind.sh INTERFACE [CPU#]" exit 1; fi eth=$1 mask=$2 echo "Binding interface $eth" pid=`pgrep irqbalance` if [ $? -eq 0 ]; then echo "irqbalance is running! Pid = $pid" echo "it will undo anything done by this script" echo "Please kill it and re-run this script" exit fi done=0 i=0 slice=0 start=0 num_slices=`grep "${eth}" /proc/interrupts | wc -l` while [ $done != 1 ] do # one of the following, depending on which version of the driver is installed irq_data=`grep "${eth}:slice-${slice}" /proc/interrupts` if [ $? != 0 ]; then if [ $i != 0 ]; then exit fi irq_data=`grep "${eth}" /proc/interrupts` if [ $? != 0 ]; then exit fi fi irq=`echo $irq_data | awk '{print $1 ; }' | sed -e 's/://g'` file="/proc/irq/${irq}/smp_affinity" printf "Binding slice %2d to CPU %2d: writing mask 0x%08x to $file\n" $slice $mask $mask printf "%x" $mask > $file i=`expr $i + 1` slice=`expr $slice + 1` if [ $slice -eq $num_slices ]; then exit fi done