[pve-devel] r5635 - qemu-server/pve2

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Mar 2 14:17:18 CET 2011


Author: dietmar
Date: 2011-03-02 14:17:18 +0100 (Wed, 02 Mar 2011)
New Revision: 5635

Modified:
   qemu-server/pve2/pve-bridge
Log:
fix tc for virtio


Modified: qemu-server/pve2/pve-bridge
===================================================================
--- qemu-server/pve2/pve-bridge	2011-03-02 12:17:29 UTC (rev 5634)
+++ qemu-server/pve2/pve-bridge	2011-03-02 13:17:18 UTC (rev 5635)
@@ -37,17 +37,29 @@
     system("/sbin/tc qdisc del dev $iface root >/dev/null 2>&1");
 
     run_command("/sbin/tc qdisc add dev $iface handle ffff: ingress");
-    run_command("/sbin/tc filter add dev $iface parent ffff: protocol ip prio 50 " . 
-		"u32 match ip src 0.0.0.0/0 police rate ${rate}bps " .
-		"burst ${burst}b drop flowid :1");
 
+    # this does not work wit virtio - don't know why
+    #run_command("/sbin/tc filter add dev $iface parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate ${rate}bps burst ${burst}b drop flowid :1");
+    # so we use avrate instead
+    run_command("/sbin/tc filter add dev $iface parent ffff: " .
+		"protocol ip prio 50 estimator 1sec 8sec " .
+		"u32 match ip src 0.0.0.0/0 police avrate ${rate}bps drop flowid :1");
+
     # tbf does not work for unknown reason
     #$TC qdisc add dev $DEV root tbf rate $RATE latency 100ms burst $BURST
-
+    # so we use htb instead
     run_command("/sbin/tc qdisc add dev $iface root handle 1: htb default 1");
     run_command("/sbin/tc class add dev $iface parent 1: classid 1:1 " .
 		"htb rate ${rate}bps burst ${burst}b");
 
+    # enable this to debug tc
+    if (0) {
+	print "DEBUG tc settings\n";
+	system("/sbin/tc qdisc ls dev $iface");
+	system("/sbin/tc class ls dev $iface");
+	system("/sbin/tc filter ls dev $iface parent ffff:");
+    }
+
 }
 
 system ("/usr/sbin/brctl addif $bridge $iface") == 0 ||




More information about the pve-devel mailing list