DORMANTno replies

[PATCH] Naming interrupt vectors/script

From: Robert Olsson <hidden>
Date: 2008-11-25 15:54:03


And a bash script attempt to set for RX/TX CPU affinity

Cheers.
				--ro


#! /bin/bash
# 
# Setting up irq affinity according to /proc/interrupts
# 2008-11-25 Robert Olsson
#
# > Dave Miller:
# (To get consistent naming in /proc/interrups)
# I would suggest that people use something like:
#	char buf[IFNAMSIZ+6];
#
#	sprintf(buf, "%s-%s-%d",
#	        netdev->name,
#		(RX_INTERRUPT ? "rx" : "tx"),
#		queue->index);
#
#  Assuming a device with two RX and TX queues.
#  This script will assign: 
#
#	eth0-rx-0  CPU0
#	eth0-rx-1  CPU1
#	eth0-tx-0  CPU0
#	eth0-tx-1  CPU1
#

set_affinity()
{
    MASK=$((1<<$VEC))
    echo $DEV mask=$MASK for /proc/irq/$IRQ/smp_affinity 
    echo $MASK > /proc/irq/$IRQ/smp_affinity 
}

#
# Set up the desired devices. 
# 

for DEV in eth0 eth1 eth2
do
  for DIR in  rx tx
  do
     for VEC in `seq 0 1 12`
     do
	IRQ=`cat /proc/interrupts | grep $DEV-$DIR-$VEC"$"  | cut  -d:  -f,1`
	if [ -n  "$IRQ" ]; then
	  set_affinity
	fi
     done
  done
done
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help