summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-08-29 13:54:38 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-08-29 13:54:38 -0700
commitdae88a60a1b40555db65f19a417b0600055a4b51 (patch)
tree973f1d267eb3bb4263e95b70e35fc4350a677904
parent8b94b543ac693865f2a52bcde4f53fe1e0926f75 (diff)
downloadvyatta-cfg-qos-dae88a60a1b40555db65f19a417b0600055a4b51.tar.gz
vyatta-cfg-qos-dae88a60a1b40555db65f19a417b0600055a4b51.zip
Add drop-tail (aka FIFO) QoS policy
Add new configuration support for plain fifo queueing. Better code for the table in perl script that loads queue objects.
-rw-r--r--Makefile.am10
-rw-r--r--scripts/VyattaQosDropTail.pm57
-rwxr-xr-xscripts/vyatta-qos.pl8
-rw-r--r--templates/qos-policy/drop-tail/node.def8
-rw-r--r--templates/qos-policy/drop-tail/node.tag/description/node.def2
-rw-r--r--templates/qos-policy/drop-tail/node.tag/queue-limit/node.def2
6 files changed, 77 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index 23e2bfa..8df4236 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,17 +1,15 @@
cfgdir = $(datadir)/vyatta-cfg/templates
share_perl5dir = /opt/vyatta/share/perl5
-sbin_SCRIPTS =
-share_perl5_DATA =
-
-sbin_SCRIPTS += scripts/vyatta-qos.pl
+sbin_SCRIPTS = scripts/vyatta-qos.pl
sbin_SCRIPTS += scripts/vyatta-qos-util.pl
-share_perl5_DATA += scripts/VyattaQosUtil.pm
+share_perl5_DATA = scripts/VyattaQosUtil.pm
share_perl5_DATA += scripts/VyattaQosFairQueue.pm
share_perl5_DATA += scripts/VyattaQosTrafficShaper.pm
-share_perl5_DATA += scripts/VyattaQosRateLimiter.pm
share_perl5_DATA += scripts/VyattaQosMatch.pm
+share_perl5_DATA += scripts/VyattaQosRateLimiter.pm
+share_perl5_DATA += scripts/VyattaQosDropTail.pm
cpiop = find . ! -regex '\(.*~\|.*\.bak\|.*\.swp\|.*\#.*\#\)' -print0 | \
cpio -0pd
diff --git a/scripts/VyattaQosDropTail.pm b/scripts/VyattaQosDropTail.pm
new file mode 100644
index 0000000..1345fb0
--- /dev/null
+++ b/scripts/VyattaQosDropTail.pm
@@ -0,0 +1,57 @@
+# This is a wrapper around FIFO queue discipline
+#
+#
+# **** License ****
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# This code was originally developed by Vyatta, Inc.
+# Portions created by Vyatta are Copyright (C) 2008 Vyatta, Inc.
+# All Rights Reserved.
+# **** End License ****
+
+package VyattaQosDropTail;
+
+use strict;
+require VyattaConfig;
+use VyattaQosUtil;
+
+my %fields = (
+ _limit => undef,
+);
+
+sub new {
+ my ( $that, $config ) = @_;
+ my $level = $config->setLevel();
+ my $class = ref($that) || $that;
+ my $self = {%fields};
+
+ $self->{_limit} = $config->returnValue("queue-limit");
+
+ return bless $self, $class;
+}
+
+sub commands {
+ my ( $self, $out, $dev ) = @_;
+ my $limit = $self->{_limit};
+ my $cmd = "qdisc add dev $dev root pfifo";
+
+ $cmd .= " limit $limit" if defined $limit;
+ printf {$out} "%s\n", $cmd;
+}
+
+sub isChanged {
+ my ($self, $name) = @_;
+ my $config = new VyattaConfig;
+
+ $config->setLevel("qos-policy drop-tail $name");
+ return $config->isChanged('queue-limit');
+}
+
+1;
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl
index 3d8e58b..690894d 100755
--- a/scripts/vyatta-qos.pl
+++ b/scripts/vyatta-qos.pl
@@ -46,10 +46,8 @@ my %policies = (
'traffic-shaper' => "VyattaQosTrafficShaper",
'fair-queue' => "VyattaQosFairQueue",
'rate-limit' => "VyattaQosRateLimiter",
+ 'drop-tail' => "VyattaQosDropTail",
);
-use VyattaQosTrafficShaper;
-use VyattaQosFairQueue;
-use VyattaQosRateLimiter;
sub make_policy {
my ($config, $type, $name) = @_;
@@ -58,8 +56,10 @@ sub make_policy {
# This means template exists but we don't know what it is.
defined $class or die "Unknown policy type $type";
- $config->setLevel("qos-policy $type $name");
+ my $location = "$class.pm";
+ require $location;
+ $config->setLevel("qos-policy $type $name");
return $class->new($config, $name);
}
diff --git a/templates/qos-policy/drop-tail/node.def b/templates/qos-policy/drop-tail/node.def
new file mode 100644
index 0000000..980e5c6
--- /dev/null
+++ b/templates/qos-policy/drop-tail/node.def
@@ -0,0 +1,8 @@
+tag:
+type: txt
+help: Set drop tail queue (FIFO) policy
+syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$"
+ ; "only alpha-numeric policy name allowed"
+create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)"
+delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)"
+update: /opt/vyatta/sbin/vyatta-qos.pl --update-policy "$VAR(.)" "$VAR(@)"
diff --git a/templates/qos-policy/drop-tail/node.tag/description/node.def b/templates/qos-policy/drop-tail/node.tag/description/node.def
new file mode 100644
index 0000000..1e8e64f
--- /dev/null
+++ b/templates/qos-policy/drop-tail/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: Set description for this queuing policy
diff --git a/templates/qos-policy/drop-tail/node.tag/queue-limit/node.def b/templates/qos-policy/drop-tail/node.tag/queue-limit/node.def
new file mode 100644
index 0000000..49c47b4
--- /dev/null
+++ b/templates/qos-policy/drop-tail/node.tag/queue-limit/node.def
@@ -0,0 +1,2 @@
+type: u32
+help: Set maximum queue size (packets)