The existing dual-loop setup is unnecessary
as the outer loop only skips to the first non-zero value
and then exits once the inner loop completes.
Zero values in the inner loop have no affect on its logic.

Signed-off-by: Simon Horman <[email protected]>
---
 ofproto/ofproto-dpif.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index c062ec3..e111026 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1884,14 +1884,11 @@ facet_max_idle(const struct ofproto_dpif *ofproto)
     }
 
     /* Find the first bucket whose flows should be expired. */
-    for (bucket = 0; bucket < N_BUCKETS; bucket++) {
-        if (buckets[bucket]) {
-            int subtotal = 0;
-            do {
-                subtotal += buckets[bucket++];
-            } while (bucket < N_BUCKETS && subtotal < MAX(1000, total / 100));
-            break;
-        }
+    {
+        int subtotal = 0;
+        do {
+            subtotal += buckets[bucket++];
+        } while (bucket < N_BUCKETS && subtotal < MAX(1000, total / 100));
     }
 
     if (VLOG_IS_DBG_ENABLED()) {
-- 
1.7.5.4

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to