summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2009-05-20 16:13:34 -0700
committerBob Gilligan <gilligan@vyatta.com>2009-05-20 16:13:34 -0700
commit864906c888eeb83dfc4063033d44801114a45426 (patch)
treedffc8fbeb6395f13a2e2aa7bb4f02484944e6567 /scripts
parent8e3b81d1a13f35d4b419fe9af6da2e0b7fa64a64 (diff)
downloadvyatta-cfg-864906c888eeb83dfc4063033d44801114a45426.tar.gz
vyatta-cfg-864906c888eeb83dfc4063033d44801114a45426.zip
Bugfix 4427: Handle multiqueue NICs.
Added code to deal with NICs that utilize more than one IRQ. The "set" sub-command of this script will now assign the requested affinity mask to all IRQs that are associated with the NIC.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-irqaffin59
1 files changed, 34 insertions, 25 deletions
diff --git a/scripts/vyatta-irqaffin b/scripts/vyatta-irqaffin
index 1959a30..bdbc541 100755
--- a/scripts/vyatta-irqaffin
+++ b/scripts/vyatta-irqaffin
@@ -21,14 +21,18 @@
# Provides sub-commands to:
# - Check the validity of an interface name and affinity mask value
-# - Set the affinity mask to the IRQ being used by an interface
-# - Reset the affinity mask of the IRQ being used by an interface to the
+# - Set the affinity mask to the IRQs being used by an interface
+# - Reset the affinity mask of the IRQs being used by an interface to the
# system default value of all-ones.
-# - Print the affinity mask of the IRQ being used by an interface
+# - Print the affinity mask of the IRQs being used by an interface
+#
+# If the NIC in question supports multiple IRQs, the "set" sub-command
+# sets all IRQs to the same mask. The "print" sub-command displays
+# the mask of each IRQ individually.
#
-# Max number of hex characters in an IRQ affinity mask. Support up to 16 CPUs.
-MAX_MASK=4
+# Max number of hex characters in an IRQ affinity mask. Support up to 64 CPUs.
+MAX_MASK=16
# Set up some global values...
numcpus=`grep -c -e "^processor" /proc/cpuinfo`
@@ -45,10 +49,10 @@ print_usage()
echo -e "\t$0 print <ifname>"
}
-get_irqnum()
+get_irqnums()
{
- irqnum=`cat /sys/class/net/$1/device/irq`
- if [ -z "$irqnum" ]; then
+ irqnums=`grep $1 /proc/interrupts | awk -F ': ' '{ print $1 }'`
+ if [ -z "$irqnums" ]; then
echo "Invalid interface name: $1"
return 1
fi
@@ -118,7 +122,7 @@ case "$1" in
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
@@ -138,7 +142,7 @@ case "$1" in
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
@@ -146,7 +150,9 @@ case "$1" in
exit 1
fi
- echo $mask > /proc/irq/$irqnum/smp_affinity
+ for irqnum in $irqnums ; do
+ echo $mask > /proc/irq/$irqnum/smp_affinity
+ done
if [ $? -ne 0 ]; then
echo "Couldn't assign smp_affinity. Exit status: $?"
@@ -159,15 +165,17 @@ case "$1" in
print_usage
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
- echo $maxmaskhex > /proc/irq/$irqnum/smp_affinity
- if [ $? -ne 0 ]; then
- echo "Couldn't assign smp_affinity. Exit status: $?"
- exit 1
- fi
+ for irqnum in $irqnums ; do
+ echo $maxmaskhex > /proc/irq/$irqnum/smp_affinity
+ if [ $? -ne 0 ]; then
+ echo "Couldn't assign smp_affinity for IRQ $irqnum. Exit status: $?"
+ exit 1
+ fi
+ done
;;
@@ -176,19 +184,20 @@ case "$1" in
print_usage
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
- mask=`cat /proc/irq/$irqnum/smp_affinity`
+ for irqnum in $irqnums ; do
+ mask=`cat /proc/irq/$irqnum/smp_affinity`
- if [ -z $mask ]; then
- echo "Couldn't get smp_affinity for interface $2, irq $irqnum"
- exit 1
- fi
+ if [ -z $mask ]; then
+ echo "Couldn't get smp_affinity for interface $2, irq $irqnum"
+ exit 1
+ fi
- echo "Interface $2 is using IRQ: $irqnum"
- echo "SMP affinity mask for IRQ $irqnum is: $mask"
+ echo "Interface: $2 IRQ: $irqnum Mask: $mask"
+ done
;;
*)