LANG=C;export LANG;
service irqbalance stop >/dev/null 2>&1;
chkconfig irqbalance off;
bondslist=$(ip -o link |awk '{print $2}'|grep bond |sed 's/\://g');
if [ -z ${bondslist} ];
then echo 'The system is not configured for bonding.'; exit 1;
else
for bondname in ${bondslist};
do
for ETHERNET in $(cat /proc/net/bonding/${bondname} |grep "Slave Interface:" |awk '{print $NF}');
do
CPUS=$(cat /proc/cpuinfo |grep -w processor |wc -l);
cpuid=0;
for irqid in `cat /proc/interrupts |grep ${ETHERNET}| awk -F ':' '{printf "%s\n" ,$1}'`;
do
if [ ${cpuid} -eq ${CPUS} ];
then cpuid=0;
fi;
echo ${cpuid} >/proc/irq/${irqid}/smp_affinity_list;
echo -e "${ETHERNET}-${irqid}\t${cpuid}\t"; cpuid=$(expr ${cpuid} + 1);
done;
done;
done;
fi