Push bwmin to 1KBps. Also check running values against arguments before calling tc.
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Fri, 1 Aug 2008 16:04:15 +0000 (16:04 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Fri, 1 Aug 2008 16:04:15 +0000 (16:04 +0000)
python/bwlimit.py

index 6591b83..1be3bd4 100644 (file)
@@ -66,7 +66,7 @@ verbose = 0
 # bwmin should be small enough that it can be considered negligibly
 # slow compared to the hardware. 8 bits/second appears to be the
 # smallest value supported by tc.
 # bwmin should be small enough that it can be considered negligibly
 # slow compared to the hardware. 8 bits/second appears to be the
 # smallest value supported by tc.
-bwmin = 8
+bwmin = 1000
 
 # bwmax should be large enough that it can be considered at least as
 # fast as the hardware.
 
 # bwmax should be large enough that it can be considered at least as
 # fast as the hardware.
@@ -546,9 +546,15 @@ def on(xid, dev = dev, share = None, minrate = None, maxrate = None, minexemptra
 
 
 def set(xid, share = None, minrate = None, maxrate = None, minexemptrate = None, maxexemptrate = None):
 
 
 def set(xid, share = None, minrate = None, maxrate = None, minexemptrate = None, maxexemptrate = None):
-    on(xid = xid, share = share,
-       minrate = minrate, maxrate = maxrate,
-       minexemptrate = minexemptrate, maxexemptrate = maxexemptrate)
+    # Get defaults from current state if available
+    # get(xid,dev) = ( xid, share, minrate, maxrate, minexemptrate, maxexemptrate, bytes, i2bytes )
+    current = get(xid, dev)
+    if current == None: current = () # must be a new slice if returned nothing.
+    new = ( share, minrate, maxrate, minexemptrate, maxexemptrate )
+    if current[1:6] != new:
+        on(xid = xid, share = share,
+            minrate = minrate, maxrate = maxrate,
+            minexemptrate = minexemptrate, maxexemptrate = maxexemptrate)
 
 
 # Remove class associated with specified slice xid. If further packets
 
 
 # Remove class associated with specified slice xid. If further packets