+/* Resets 'facet''s datapath statistics counters. This should be called when
+ * 'facet''s statistics are cleared in the datapath. If 'stats' is non-null,
+ * it should contain the statistics returned by dpif when 'facet' was reset in
+ * the datapath. 'stats' will be modified to only included statistics new
+ * since 'facet' was last updated. */
+static void
+facet_reset_dp_stats(struct facet *facet, struct dpif_flow_stats *stats)
+{
+ if (stats && facet->dp_packet_count < stats->n_packets
+ && facet->dp_byte_count < stats->n_bytes) {
+ stats->n_packets -= facet->dp_packet_count;
+ stats->n_bytes -= facet->dp_byte_count;
+ }
+
+ facet->dp_packet_count = 0;
+ facet->dp_byte_count = 0;
+}
+