From: Ethan Jackson Date: Thu, 24 Feb 2011 21:53:02 +0000 (-0800) Subject: ofproto: Guarantee uninstalled facets have no dp_packet_count. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2c6a63cc06f4edbce32b6ae5f500b89b3dcd1a6;p=openvswitch ofproto: Guarantee uninstalled facets have no dp_packet_count. facet_push_stats() implicitly assumes that uninstalled facets have no dp_[packet|byte]_count. This commit guarantees and enforces this invariant. Bug #4732. --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 456dcb19..61d08ea4 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); } }