summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/ShaperClass.pm
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-04-09 17:48:24 -0700
committerStephen Hemminger <shemminger@vyatta.com>2009-04-09 17:48:24 -0700
commit8c2895f17e573cd1a4c08bd4682555e41c115931 (patch)
tree6171d9f055d38259b90583a5c6936f5e87ec1e1d /lib/Vyatta/Qos/ShaperClass.pm
parentd5aa5dcee664bb3084ce512d24b5bcff1adf72e0 (diff)
downloadvyatta-cfg-qos-8c2895f17e573cd1a4c08bd4682555e41c115931.tar.gz
vyatta-cfg-qos-8c2895f17e573cd1a4c08bd4682555e41c115931.zip
Split class and sub qdisc generation
Newer features will have non-hierarchal queue disc where there are no classes just sub-queues.
Diffstat (limited to 'lib/Vyatta/Qos/ShaperClass.pm')
-rw-r--r--lib/Vyatta/Qos/ShaperClass.pm32
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm
index 631fc75..aa3a8ff 100644
--- a/lib/Vyatta/Qos/ShaperClass.pm
+++ b/lib/Vyatta/Qos/ShaperClass.pm
@@ -181,8 +181,7 @@ sub redQdisc {
my $qmax = $qlimit / 8;
my $qmin = $qmax / 3;
- printf "red limit %d min %d max %d avpkt %d",
- $qlimit, $qmin, $qmax, $avg;
+ printf "red limit %d min %d max %d avpkt %d", $qlimit, $qmin, $qmax, $avg;
printf " burst %d probability 0.02 bandwidth %d ecn\n",
( 2 * $qmin + $qmax ) / ( 3 * $avg ), $rate / 1000;
}
@@ -194,29 +193,28 @@ my %qdiscOptions = (
'drop-tail' => \&fifoQdisc,
);
-sub htbClass {
- my ( $self, $dev, $parent, $speed ) = @_;
+sub gen_class {
+ my ( $self, $dev, $qdisc, $parent, $speed ) = @_;
my $rate = _getPercentRate( $self->{_rate}, $speed );
my $ceil = _getPercentRate( $self->{_ceiling}, $speed );
- printf "class add dev %s parent %x:1 classid %x:%x htb rate %s",
- $dev, $parent, $parent, $self->{id}, $rate;
+ printf "class add dev %s parent %x:1 classid %x:%x %s",
+ $dev, $parent, $parent, $self->{id}, $qdisc;
+ print " rate $rate" if ($rate);
print " ceil $ceil" if ($ceil);
- print " burst $self->{_burst}" if ( defined $self->{_burst} );
- print " prio $self->{_priority}" if ( defined $self->{_priority} );
+ print " burst $self->{_burst}" if ( $self->{_burst} );
+ print " prio $self->{_priority}" if ( $self->{_priority} );
print "\n";
+}
- # create leaf qdisc
+sub gen_leaf {
+ my ( $self, $dev, $parent, $rate ) = @_;
my $q = $qdiscOptions{ $self->{_qdisc} };
- if ( defined $q ) {
- printf "qdisc add dev %s parent %x:%x ",
- $dev, $parent, $self->{id};
- $q->( $self, $dev, $rate );
- }
- else {
- die "Unknown queue type $self->{_qdisc}\n";
- }
+ die "Unknown queue type $self->{_qdisc}\n" unless $q;
+
+ printf "qdisc add dev %s parent %x:%x ", $dev, $parent, $self->{id};
+ $q->( $self, $dev, $rate );
}
sub dsmarkClass {