From ab75c62a0c22d95512cf7792370f5552ac5da39e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 27 Oct 2010 10:26:39 -0700 Subject: IRQ affinity update 1. Move scripts to vyatta-cfg-system 2. Use syntax to check for legal values 3. Don't fail on UP --- .../ethernet/node.tag/smp_affinity/node.def | 32 +++++++--------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'templates') diff --git a/templates/interfaces/ethernet/node.tag/smp_affinity/node.def b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def index a6498f88..671a28f0 100644 --- a/templates/interfaces/ethernet/node.tag/smp_affinity/node.def +++ b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def @@ -20,31 +20,19 @@ val_help: auto; Automatic CPU affinity (default) default: "auto" -syntax:expression: exec " \ - if [ $VAR(@) = auto ]; then \ - exit 0; - else \ - /opt/vyatta/sbin/vyatta-irqaffin check $VAR(../@) $VAR(@); \ - fi" - -update: - if [ $(cat /sys/devices/system/cpu/present) = 0 ]; then - exit 0 - fi - if [ "$VAR(@)" = "auto" ]; then - echo "Setting SMP affinity for $VAR(../@) automatically." +syntax:expression: $VAR(@) == "auto" || pattern $VAR(@) "^[0-9a-f]+$" ; + "IRQ affinity mask must be hex value or auto" + +commit:expression: exec "\ + [ \"$VAR(@)\" == \"auto\" ] || \ + /opt/vyatta/sbin/vyatta-irqaffin check $VAR(../@) $VAR(@)" + +update: if [ "$VAR(@)" = "auto" ]; then sudo /opt/vyatta/sbin/vyatta-auto-irqaffin.pl --setup $VAR(../@) - exit 0 else sudo /opt/vyatta/sbin/vyatta-irqaffin set $VAR(../@) $VAR(@) - if [ $? -ne 0 ]; then - echo "Error setting CPU affinity mask $VAR(@) on interface $VAR(../@)" - exit 1 - fi fi delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 - if ! sudo /opt/vyatta/sbin/vyatta-irqaffin reset $VAR(../@); then - echo "Warning: Can't reset CPU affinity mask on interface $VAR(../@)" - exit 0 - fi + sudo /opt/vyatta/sbin/vyatta-irqaffin reset $VAR(../@) + -- cgit v1.2.3