[ovs-dev] [PATCH 2/2] ofproto: Guarantee uninstalled facets have no dp_packet_count.

Ethan Jackson ethan at nicira.com
Thu Feb 24 22:22:23 UTC 2011


facet_push_stats() implicitly assumes that uninstalled facets have
no dp_[packet|byte]_count.  This commit guarantees and enforces
this invariant.

Bug #4732.
---
 ofproto/ofproto.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 456dcb1..61d08ea 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1526,6 +1526,8 @@ ofproto_flush_flows(struct ofproto *ofproto)
          * individually since we are about to blow away all the facets with
          * dpif_flow_flush(). */
         facet->installed = false;
+        facet->dp_packet_count = 0;
+        facet->dp_byte_count = 0;
         facet_remove(ofproto, facet);
     }
 
@@ -2401,6 +2403,9 @@ facet_uninstall(struct ofproto *p, struct facet *facet)
         facet->installed = false;
         facet->dp_packet_count = 0;
         facet->dp_byte_count = 0;
+    } else {
+        assert(facet->dp_packet_count == 0);
+        assert(facet->dp_byte_count == 0);
     }
 }
 
-- 
1.7.4.1





More information about the dev mailing list