From eacbdd4f0b986b9598cf7f5b38dcac01aabbdab3 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 27 Oct 2008 09:39:12 -0700 Subject: Fix QoS on Vif Handle Vif on serial. Can't have update and create tag. --- templates/interfaces/bonding/node.tag/qos-policy/out/node.def | 4 ++-- .../bonding/node.tag/vif/node.tag/qos-policy/out/node.def | 4 ++-- .../ethernet/node.tag/vif/node.tag/qos-policy/out/node.def | 6 +++--- .../serial/node.tag/cisco-hdlc/vif/node.tag/qos-policy/out/node.def | 5 +++-- .../node.tag/frame-relay/vif/node.tag/qos-policy/out/node.def | 5 +++-- .../serial/node.tag/ppp/vif/node.tag/qos-policy/out/node.def | 5 +++-- templates/interfaces/tunnel/node.tag/qos-policy/out/node.def | 5 +++-- 7 files changed, 19 insertions(+), 15 deletions(-) (limited to 'templates') diff --git a/templates/interfaces/bonding/node.tag/qos-policy/out/node.def b/templates/interfaces/bonding/node.tag/qos-policy/out/node.def index ec96f0f..c7d6ad2 100644 --- a/templates/interfaces/bonding/node.tag/qos-policy/out/node.def +++ b/templates/interfaces/bonding/node.tag/qos-policy/out/node.def @@ -1,6 +1,6 @@ type: txt help: Set output QOS policy for specified bonding interface allowed: /opt/vyatta/sbin/vyatta-qos.pl --list-policy out -create: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 -update: /opt/vyatta/sbin/vyatta-qos.pl --update-interface $VAR(../../@) $VAR(.) $VAR(@) +update: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 + /opt/vyatta/sbin/vyatta-qos.pl --update-interface $VAR(../../@) $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-interface $VAR(../../@) $VAR(.) diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/qos-policy/out/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/qos-policy/out/node.def index df0ea43..729fa7c 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/qos-policy/out/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/qos-policy/out/node.def @@ -1,8 +1,8 @@ type: txt help: Set outbound QOS policy allowed: /opt/vyatta/sbin/vyatta-qos.pl --list-policy out -create: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 -update: /opt/vyatta/sbin/vyatta-qos.pl \ +update: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 + /opt/vyatta/sbin/vyatta-qos.pl \ --update-interface $VAR(../../../@).$VAR(../../@) $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl \ --delete-interface $VAR(../../../@).$VAR(../../@) $VAR(.) diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/qos-policy/out/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/qos-policy/out/node.def index df0ea43..548cc8c 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/qos-policy/out/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/qos-policy/out/node.def @@ -1,9 +1,9 @@ type: txt help: Set outbound QOS policy allowed: /opt/vyatta/sbin/vyatta-qos.pl --list-policy out -create: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 -update: /opt/vyatta/sbin/vyatta-qos.pl \ - --update-interface $VAR(../../../@).$VAR(../../@) $VAR(.) $VAR(@) +update: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 + /opt/vyatta/sbin/vyatta-qos.pl \ + --update-interface $VAR(../../../@).$VAR(../../@) $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl \ --delete-interface $VAR(../../../@).$VAR(../../@) $VAR(.) sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 0 diff --git a/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/qos-policy/out/node.def b/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/qos-policy/out/node.def index f4b7221..2f92a3b 100644 --- a/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/qos-policy/out/node.def +++ b/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/qos-policy/out/node.def @@ -1,9 +1,10 @@ type: txt help: Set outbound QOS policy allowed: /opt/vyatta/sbin/vyatta-qos.pl --list-policy out -create: sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 100 -update: /opt/vyatta/sbin/vyatta-qos.pl \ +update: sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 100 + /opt/vyatta/sbin/vyatta-qos.pl \ --update-interface $VAR(../../../../@).$VAR(../../@) $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl \ --delete-interface $VAR(../../../../@).$VAR(../../@) $VAR(.) + sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 0 diff --git a/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/qos-policy/out/node.def b/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/qos-policy/out/node.def index 905c3b5..67482aa 100644 --- a/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/qos-policy/out/node.def +++ b/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/qos-policy/out/node.def @@ -1,8 +1,9 @@ type: txt help: Set outbound QOS policy allowed: /opt/vyatta/sbin/vyatta-qos.pl --list-policy out -create: sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 100 -update: /opt/vyatta/sbin/vyatta-qos.pl \ +update: sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 100 + /opt/vyatta/sbin/vyatta-qos.pl \ --update-interface $VAR(../../../../@).$VAR(../../@) $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl \ --delete-interface $VAR(../../../../@).$VAR(../../@) $VAR(.) + sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 0 diff --git a/templates/interfaces/serial/node.tag/ppp/vif/node.tag/qos-policy/out/node.def b/templates/interfaces/serial/node.tag/ppp/vif/node.tag/qos-policy/out/node.def index 905c3b5..67482aa 100644 --- a/templates/interfaces/serial/node.tag/ppp/vif/node.tag/qos-policy/out/node.def +++ b/templates/interfaces/serial/node.tag/ppp/vif/node.tag/qos-policy/out/node.def @@ -1,8 +1,9 @@ type: txt help: Set outbound QOS policy allowed: /opt/vyatta/sbin/vyatta-qos.pl --list-policy out -create: sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 100 -update: /opt/vyatta/sbin/vyatta-qos.pl \ +update: sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 100 + /opt/vyatta/sbin/vyatta-qos.pl \ --update-interface $VAR(../../../../@).$VAR(../../@) $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl \ --delete-interface $VAR(../../../../@).$VAR(../../@) $VAR(.) + sudo ip link set dev $VAR(../../../../@).$VAR(../../@) txqueuelen 0 diff --git a/templates/interfaces/tunnel/node.tag/qos-policy/out/node.def b/templates/interfaces/tunnel/node.tag/qos-policy/out/node.def index 063fe58..13c78af 100644 --- a/templates/interfaces/tunnel/node.tag/qos-policy/out/node.def +++ b/templates/interfaces/tunnel/node.tag/qos-policy/out/node.def @@ -1,6 +1,7 @@ type: txt help: Set the tunnel QoS policy allowed: /opt/vyatta/sbin/vyatta-qos.pl --list-policy out -create: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 -update: /opt/vyatta/sbin/vyatta-qos.pl --update-interface $VAR(../../@) $VAR(.) $VAR(@) +update: sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 100 + /opt/vyatta/sbin/vyatta-qos.pl --update-interface $VAR(../../@) $VAR(.) $VAR(@) delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-interface $VAR(../../@) $VAR(.) + sudo ip link set dev $VAR(../../../@).$VAR(../../@) txqueuelen 0 -- cgit v1.2.3 From 1f3727b1c665c5a22e6d461b052f0c2ffc76d810 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 10 Nov 2008 18:12:54 -0800 Subject: Change input rate limiting to use token bucket There are two ways to input rate limit. One uses the generic rate estimator which is supposed to measure average rate, the other is to use a token bucket based packet counter. Well the generic rate estimator doesn't work correctly in current kernels (no effect), so switch to using rate and burst. Bugfix 3881 --- scripts/VyattaQosTrafficLimiter.pm | 13 ++++++------- .../traffic-limiter/node.tag/class/node.tag/burst/node.def | 7 +++++++ 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 templates/qos-policy/traffic-limiter/node.tag/class/node.tag/burst/node.def (limited to 'templates') diff --git a/scripts/VyattaQosTrafficLimiter.pm b/scripts/VyattaQosTrafficLimiter.pm index 2907590..649fb17 100644 --- a/scripts/VyattaQosTrafficLimiter.pm +++ b/scripts/VyattaQosTrafficLimiter.pm @@ -26,6 +26,7 @@ my %fields = ( id => undef, priority => undef, + burst => undef, rate => undef, _match => undef, ); @@ -51,7 +52,8 @@ defined $rate or die "bandwidth must be defined for $level\n"; $self->{rate} = VyattaQosUtil::getRate($rate); - + $self->{burst} = $config->returnValue("burst"); + defined $self->{burst} or die "burst must be defined for $level\n"; $self->{priority} = $config->returnValue("priority"); foreach my $match ( $config->listNodes("match") ) { @@ -134,13 +136,10 @@ sub commands { printf {$out} "qdisc add dev %s handle %x: ingress\n", $dev, $parent; foreach my $class (@$classes) { - my $id = $class->{id}; - my $rate = $class->{rate}; - my $priority = $class->{priority}; - foreach my $match ( $class->matchRules() ) { - $match->filter( $out, $dev, $parent, $priority ); - printf {$out} " police avrate %s drop flowid :%x\n", $rate, $id; + $match->filter( $out, $dev, $parent, $class->{priority} ); + printf {$out} " police rate %s burst %s drop flowid :%x\n", + $class->{rate}, $class->{burst}, $class->{id}; } } } diff --git a/templates/qos-policy/traffic-limiter/node.tag/class/node.tag/burst/node.def b/templates/qos-policy/traffic-limiter/node.tag/class/node.tag/burst/node.def new file mode 100644 index 0000000..54ae4f3 --- /dev/null +++ b/templates/qos-policy/traffic-limiter/node.tag/class/node.tag/burst/node.def @@ -0,0 +1,7 @@ +type: txt +help: Set the burst size for this class (default: 15kb) +default: "15k" +syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --burst \"$VAR(@)\"" +comp_help: Allowed values: + Burst size in bytes + Size with scaling suffix (kb, mb, gb) -- cgit v1.2.3