diff options
11 files changed, 87 insertions, 86 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 4003489b..e57e384b 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -62,7 +62,8 @@ Usage: $0 --dev=<interface> --check=<type> $0 --dev=<interface> --check-speed=speed,duplex $0 --dev=<interface> --allowed-speed $0 --dev=<interface> --isup - $0 --dev=<interface> --offload-settings={tcp,udp,segmentation,receive} {value} + $0 --dev=<interface> --offload-option={tcp-segmention,udp-fragmentation} {value} + $0 --dev=<interface> --offload-option={generic-segmentation,generic-receive} {value} $0 --show=<type> EOF exit 1; @@ -83,21 +84,21 @@ GetOptions( "speed-duplex=s{2}" => \@speed_duplex, "check-speed=s{2}" => \@check_speed, "allowed-speed" => \$allowed_speed, - "offload-settings=s{2}" => \@offload_option, + "offload-option=s{2}" => \@offload_option, ) or usage(); -is_valid_addr_commit($dev, @addr_commit) if (@addr_commit); -is_valid_mac($mac, $dev) if ($mac); -update_mac($mac_update, $dev) if ($mac_update); -dhcp($dhcp_command, $dev) if ($dhcp_command); -is_valid_name($check_name, $dev) if ($check_name); -exists_name($dev) if ($warn_name); -show_interfaces($show_names) if ($show_names); -is_up($dev) if ($check_up); -set_speed_duplex($dev, @speed_duplex) if (@speed_duplex); -check_speed_duplex($dev, @check_speed) if (@check_speed); -allowed_speed($dev) if ($allowed_speed); -set_offload_setting($dev, @offload_option) if (@offload_option); +is_valid_addr_commit($dev, @addr_commit) if (@addr_commit); +is_valid_mac($mac, $dev) if ($mac); +update_mac($mac_update, $dev) if ($mac_update); +dhcp($dhcp_command, $dev) if ($dhcp_command); +is_valid_name($check_name, $dev) if ($check_name); +exists_name($dev) if ($warn_name); +show_interfaces($show_names) if ($show_names); +is_up($dev) if ($check_up); +set_speed_duplex($dev, @speed_duplex) if (@speed_duplex); +check_speed_duplex($dev, @check_speed) if (@check_speed); +allowed_speed($dev) if ($allowed_speed); +set_offload_option($dev, @offload_option) if (@offload_option); exit 0; sub is_ip_configured { @@ -576,7 +577,7 @@ sub allowed_speed { print 'auto ', join(' ', sort keys %speeds), "\n"; } -sub get_offload_setting { +sub get_offload_option { my ($dev, $option) = @_; my ($val); @@ -591,17 +592,17 @@ sub get_offload_setting { } -sub set_offload_setting { +sub set_offload_option { my ($intf, $option, $nvalue) = @_; die "Missing --dev argument\n" unless $intf; - my $ovalue = get_offload_setting($intf, $option); + my $ovalue = get_offload_option($intf, $option); my %ethtool_opts = ( - 'generic-receive-offload' => 'gro', - 'generic-segmentation-offload' => 'gso', - 'tcp-segmentation-offload' => 'tso', - 'udp-fragmentation-offload' => 'ufo', + 'generic-receive' => 'gro', + 'generic-segmentation' => 'gso', + 'tcp-segmentation' => 'tso', + 'udp-fragmentation' => 'ufo', ); if (defined($nvalue) && $nvalue ne $ovalue) { @@ -609,7 +610,7 @@ sub set_offload_setting { system($cmd); if ($? >> 8) { - die "exec of $ETHTOOL failed: '$cmd'"; + die "Offload option for $option is not supported on $intf\n"; } } diff --git a/templates/interfaces/ethernet/node.tag/offload-options/generic-receive/node.def b/templates/interfaces/ethernet/node.tag/offload-options/generic-receive/node.def new file mode 100644 index 00000000..a2bc1ebc --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/offload-options/generic-receive/node.def @@ -0,0 +1,16 @@ +# +# Configuration template for offload options +# + +priority: 319 # Failure barrier only - no ordering constraints + +type: txt +help: Configure generic-receive option +val_help: on; Enable generic-receive +val_help: off; Disable generic-receive + +syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" + +update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-option generic-receive $VAR(@) + + diff --git a/templates/interfaces/ethernet/node.tag/offload-options/generic-segmentation/node.def b/templates/interfaces/ethernet/node.tag/offload-options/generic-segmentation/node.def new file mode 100644 index 00000000..bdc25c63 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/offload-options/generic-segmentation/node.def @@ -0,0 +1,16 @@ +# +# Configuration template for offload options +# + +priority: 319 # Failure barrier only - no ordering constraints + +type: txt +help: Configure generic-segmentation option +val_help: on; Enable generic-segmentation +val_help: off; Disable generic-segmentation + +syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" + +update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-option generic-segmentation $VAR(@) + + diff --git a/templates/interfaces/ethernet/node.tag/offload-options/node.def b/templates/interfaces/ethernet/node.tag/offload-options/node.def new file mode 100644 index 00000000..59d45778 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/offload-options/node.def @@ -0,0 +1 @@ +help: Configurable offload options diff --git a/templates/interfaces/ethernet/node.tag/offload-options/tcp-segmentation/node.def b/templates/interfaces/ethernet/node.tag/offload-options/tcp-segmentation/node.def new file mode 100644 index 00000000..c8da289e --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/offload-options/tcp-segmentation/node.def @@ -0,0 +1,15 @@ +# +# Configuration template for offload options +# + +priority: 319 # Failure barrier only - no ordering constraints + +type: txt +help: Configure tcp-segmentation option +val_help: on; Enable tcp-segmentation +val_help: off; Disable tcp-segmentation + +syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" + +update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-option tcp-segmentation $VAR(@) + diff --git a/templates/interfaces/ethernet/node.tag/offload-options/udp-fragmentation/node.def b/templates/interfaces/ethernet/node.tag/offload-options/udp-fragmentation/node.def new file mode 100644 index 00000000..dcff5b2c --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/offload-options/udp-fragmentation/node.def @@ -0,0 +1,16 @@ +# +# Configuration template for offload options +# + +priority: 319 # Failure barrier only - no ordering constraints + +type: txt +help: Configure udp-fragmentation option +val_help: on; Enable udp-fragmentation +val_help: off; Disable udp-fragmentation + +syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" + +update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-option udp-fragmentation $VAR(@) + + diff --git a/templates/interfaces/ethernet/node.tag/offload/generic-receive-offload/node.def b/templates/interfaces/ethernet/node.tag/offload/generic-receive-offload/node.def deleted file mode 100644 index 3491e074..00000000 --- a/templates/interfaces/ethernet/node.tag/offload/generic-receive-offload/node.def +++ /dev/null @@ -1,16 +0,0 @@ -# -# Configuration template for offload settings -# - -priority: 319 # Failure barrier only - no ordering constraints - -type: txt -help: Configure generic-receive-offload option -val_help: on; Enable generic-receive-offload -val_help: off; Disable generic-receive-offload - -syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" - -update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-settings generic-receive-offload $VAR(@) - - diff --git a/templates/interfaces/ethernet/node.tag/offload/generic-segmentation-offload/node.def b/templates/interfaces/ethernet/node.tag/offload/generic-segmentation-offload/node.def deleted file mode 100644 index 1ed7133b..00000000 --- a/templates/interfaces/ethernet/node.tag/offload/generic-segmentation-offload/node.def +++ /dev/null @@ -1,16 +0,0 @@ -# -# Configuration template for offload settings -# - -priority: 319 # Failure barrier only - no ordering constraints - -type: txt -help: Configure generic-segmentation-offload option -val_help: on; Enable generic-segmentation-offload -val_help: off; Disable generic-segmentation-offload - -syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" - -update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-settings generic-segmentation-offload $VAR(@) - - diff --git a/templates/interfaces/ethernet/node.tag/offload/node.def b/templates/interfaces/ethernet/node.tag/offload/node.def deleted file mode 100644 index 180a9e7c..00000000 --- a/templates/interfaces/ethernet/node.tag/offload/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Configuraable offload settings diff --git a/templates/interfaces/ethernet/node.tag/offload/tcp-segmentation-offload/node.def b/templates/interfaces/ethernet/node.tag/offload/tcp-segmentation-offload/node.def deleted file mode 100644 index 95a37369..00000000 --- a/templates/interfaces/ethernet/node.tag/offload/tcp-segmentation-offload/node.def +++ /dev/null @@ -1,15 +0,0 @@ -# -# Configuration template for offload settings -# - -priority: 319 # Failure barrier only - no ordering constraints - -type: txt -help: Configure tcp-segmentation-offload option -val_help: on; Enable tcp-segmentation-offload -val_help: off; Disable tcp-segmentation-offload - -syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" - -update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-settings tcp-segmentation-offload $VAR(@) - diff --git a/templates/interfaces/ethernet/node.tag/offload/udp-fragmentation-offload/node.def b/templates/interfaces/ethernet/node.tag/offload/udp-fragmentation-offload/node.def deleted file mode 100644 index 796c791d..00000000 --- a/templates/interfaces/ethernet/node.tag/offload/udp-fragmentation-offload/node.def +++ /dev/null @@ -1,16 +0,0 @@ -# -# Configuration template for offload settings -# - -priority: 319 # Failure barrier only - no ordering constraints - -type: txt -help: Configure udp-fragmentation-offload option -val_help: on; Enable udp-fragmentation-offload -val_help: off; Disable udp-fragmentation-offload - -syntax:expression: $VAR(@) == "on" || $VAR(@) == "off" ; "Must be either 'on' or 'off'" - -update: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../../@) --offload-settings udp-fragmentation-offload $VAR(@) - - |