ofproto: Guarantee uninstalled facets have no dp_packet_count.
authorEthan Jackson <ethan@nicira.com>
Thu, 24 Feb 2011 21:53:02 +0000 (13:53 -0800)
committerEthan Jackson <ethan@nicira.com>
Thu, 24 Feb 2011 22:33:16 +0000 (14:33 -0800)
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

index 456dcb1..61d08ea 100644 (file)
@@ -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);
     }
 }