[ovs-dev] [PATCH 1/2] qos: Remove min-rate requirement for linux-htb and linux-hfsc.

Ethan Jackson ethan at nicira.com
Tue Mar 15 19:31:31 UTC 2011


One could quite reasonably desire to create a queue with no
min-rate.  For example, a default queue could be reasonably
configured without a min-rate or a max-rate.  This commit removes
the requirement that min-rate be configured on all queues.  If not
configured, defaults to something very small.
---
 lib/netdev-linux.c   |   13 ++-----------
 vswitchd/vswitch.xml |    4 ++--
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index a27a625..baaa1e6 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2497,12 +2497,7 @@ htb_parse_class_details__(struct netdev *netdev,
         return EINVAL;
     }
 
-    /* min-rate.  Don't allow a min-rate below 1500 bytes/s. */
-    if (!min_rate_s) {
-        /* min-rate is required. */
-        return EINVAL;
-    }
-    hc->min_rate = strtoull(min_rate_s, NULL, 10) / 8;
+    hc->min_rate = min_rate_s ? strtoull(min_rate_s, NULL, 10) / 8 : 0;
     hc->min_rate = MAX(hc->min_rate, 1500);
     hc->min_rate = MIN(hc->min_rate, htb->max_rate);
 
@@ -2977,11 +2972,7 @@ hfsc_parse_class_details__(struct netdev *netdev,
     min_rate_s = shash_find_data(details, "min-rate");
     max_rate_s = shash_find_data(details, "max-rate");
 
-    if (!min_rate_s) {
-        return EINVAL;
-    }
-
-    min_rate = strtoull(min_rate_s, NULL, 10) / 8;
+    min_rate = min_rate_s ? strtoull(min_rate_s, NULL, 10) / 8 : 0;
     min_rate = MAX(min_rate, 1500);
     min_rate = MIN(min_rate, hfsc->max_rate);
 
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 244b24e..470f389 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1384,7 +1384,7 @@
         column="type"/> of <code>linux-htb</code> are:</p>
       <dl>
         <dt><code>min-rate</code></dt>
-        <dd>Minimum guaranteed bandwidth, in bit/s.  Required.</dd>
+        <dd>Minimum guaranteed bandwidth, in bit/s.</dd>
         <dt><code>max-rate</code></dt>
         <dd>Maximum allowed bandwidth, in bit/s.  Optional.  If specified, the
           queue's rate will not be allowed to exceed the specified value, even
@@ -1407,7 +1407,7 @@
         column="type"/> of <code>linux-hfsc</code> are:</p>
       <dl>
         <dt><code>min-rate</code></dt>
-        <dd>Minimum guaranteed bandwidth, in bit/s.  Required.</dd>
+        <dd>Minimum guaranteed bandwidth, in bit/s.</dd>
         <dt><code>max-rate</code></dt>
         <dd>Maximum allowed bandwidth, in bit/s.  Optional.  If specified, the
           queue's rate will not be allowed to exceed the specified value, even
-- 
1.7.4.1




More information about the dev mailing list