[pve-devel] [PATCH 3/6] setup_tc_rate_limit : delete class and filter before update
Alexandre Derumier
aderumier at odiso.com
Tue Mar 5 10:23:44 CET 2013
also return after remove if rate is not defined
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
data/PVE/Network.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/data/PVE/Network.pm b/data/PVE/Network.pm
index 4efd30b..4cc5fb8 100644
--- a/data/PVE/Network.pm
+++ b/data/PVE/Network.pm
@@ -11,9 +11,13 @@ use File::Basename;
sub setup_tc_rate_limit {
my ($iface, $rate, $burst, $debug) = @_;
+ system("/sbin/tc class del dev $iface parent 1: classid 1:1 >/dev/null 2>&1");
+ system("/sbin/tc filter del dev $iface parent ffff: protocol ip prio 50 estimator 1sec 8sec >/dev/null 2>&1");
system("/sbin/tc qdisc del dev $iface ingress >/dev/null 2>&1");
system("/sbin/tc qdisc del dev $iface root >/dev/null 2>&1");
+ return if (!$rate || ($rate && $rate == 0));
+
run_command("/sbin/tc qdisc add dev $iface handle ffff: ingress");
# this does not work wit virtio - don't know why (setting "mtu 64kb" does not help)
--
1.7.10.4
More information about the pve-devel
mailing list