This ensures that packets on sun are processed on a particular CPU and not randomly on one, which causes expected SAs not to get created or other weird things.
29 lines
623 B
Bash
Executable File
29 lines
623 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Sets the CPU affiniy of the IRQ handling inbound messages on the given
|
|
# network interface
|
|
|
|
IFACE=$1
|
|
AFFINITY=$2
|
|
|
|
if [ -z "$IFACE" -o -z "$AFFINITY" ]
|
|
then
|
|
exit 1
|
|
fi
|
|
|
|
PCI_ADDR=$(ethtool -i ${IFACE} | grep bus-info | sed -e 's/bus-info: //')
|
|
if [ -z "$PCI_ADDR" ]
|
|
then
|
|
exit 2
|
|
fi
|
|
|
|
IRQ=$(grep "MSIX-${PCI_ADDR}.*input" /proc/interrupts | awk -F ':' '{print $1}' | awk '{print $1}')
|
|
if [ -z "$IRQ" ]
|
|
then
|
|
exit 3
|
|
fi
|
|
|
|
PREV=$(cat /proc/irq/${IRQ}/smp_affinity_list)
|
|
echo "Setting affinity for IRQ ${IRQ} of ${IFACE}@${PCI_ADDR} to ${AFFINITY}, was ${PREV}"
|
|
echo ${AFFINITY} > /proc/irq/${IRQ}/smp_affinity_list
|