diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-05-21 17:12:27 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-05-21 17:12:27 -0700 |
commit | 6532ac36bd6b6590edbffc725d7d2fe75dab2c7d (patch) | |
tree | 48fadc7b732983f9abb6b882af58cafaca52edcf /scripts | |
parent | 81218208adb11e2a8e32b90ede20554cad23c45a (diff) | |
parent | 613b7e3b36684e92cb7765b03bb4706a6caed98b (diff) | |
download | vyatta-cfg-6532ac36bd6b6590edbffc725d7d2fe75dab2c7d.tar.gz vyatta-cfg-6532ac36bd6b6590edbffc725d7d2fe75dab2c7d.zip |
Merge branch 'jenner' of http://git.vyatta.com/vyatta-cfg into jenner
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-cfg-cmd-wrapper | 2 | ||||
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 16 | ||||
-rwxr-xr-x | scripts/vyatta-irqaffin | 63 |
3 files changed, 55 insertions, 26 deletions
diff --git a/scripts/vyatta-cfg-cmd-wrapper b/scripts/vyatta-cfg-cmd-wrapper index cf10fc5..d1b70d5 100755 --- a/scripts/vyatta-cfg-cmd-wrapper +++ b/scripts/vyatta-cfg-cmd-wrapper @@ -66,7 +66,7 @@ case "$1" in rm -rf ${VYATTA_CONFIG_TMP} rm -rf ${VYATTA_TEMP_CONFIG_DIR} ;; - cleanup) + cleanup|discard) sudo umount ${VYATTA_TEMP_CONFIG_DIR} rm -rf $VYATTA_CHANGES_ONLY_DIR/* $VYATTA_CHANGES_ONLY_DIR/.modified sudo mount -t $UNIONFS -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:${VYATTA_ACTIVE_CONFIGURATION_DIR}=ro $UNIONFS ${VYATTA_TEMP_CONFIG_DIR} diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index d0d8fa1..3e5beaa 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -48,7 +48,8 @@ use warnings; my $dhcp_daemon = '/sbin/dhclient'; my ($eth_update, $eth_delete, $addr, $dev, $mac, $mac_update, $op_dhclient); -my ($check_name, $show_names, $intf_cli_path, $vif_name, $warn_name, $show_path); +my ($check_name, $show_names, $intf_cli_path, $vif_name, $warn_name); +my ($check_up, $show_path); sub usage { print "Usage: $0 --dev=<interface> --check=<type>\n"; @@ -58,6 +59,7 @@ sub usage { print " $0 --dev=<interface> --eth-addr-delete=<aa:aa:aa:aa:aa:aa>\n"; print " $0 --dev=<interface> --valid-addr={<a.b.c.d>|dhcp}\n"; print " $0 --dev=<interface> --path\n"; + print " $0 --dev=<interface> --isup\n"; print " $0 --show=<type>\n"; exit 1; } @@ -74,6 +76,7 @@ GetOptions("eth-addr-update=s" => \$eth_update, "vif=s" => \$vif_name, "warn" => \$warn_name, "path" => \$show_path, + "isup" => \$check_up, ) or usage(); update_eth_addrs($eth_update, $dev) if ($eth_update); @@ -86,6 +89,7 @@ is_valid_name($check_name, $dev) if ($check_name); exists_name($dev) if ($warn_name); show_interfaces($show_names) if ($show_names); show_config_path($dev) if ($show_path); +is_up($dev) if ($check_up); exit 0; sub is_ip_configured { @@ -106,6 +110,16 @@ sub is_ip_duplicate { return is_ip_configured($intf, $ip); } +sub is_up { + my $name = shift; + my $intf = new Vyatta::Interface($name); + + die "Unknown interface type for $name" unless $intf; + + exit 0 if ($intf->up()); + exit 1; +} + sub touch { my $file = shift; my $t = time; diff --git a/scripts/vyatta-irqaffin b/scripts/vyatta-irqaffin index 1959a30..1286130 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,23 @@ 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 + if [ -e /proc/irq/default_smp_affinity ]; then + defmask=`cat /proc/irq/default_smp_affinity` + else + defmask=$maxmaskhex fi + + for irqnum in $irqnums ; do + echo $defmask > /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 +190,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 ;; *) |