From 827ab71c97f25b77c94a1158834cdad35df6806f Mon Sep 17 00:00:00 2001
From: Ethan Jackson <ethan@nicira.com>
Date: Wed, 18 May 2011 11:52:08 -0700
Subject: [PATCH] ofproto: Datapath statistics accounted twice.

Due to an error introduced in  Commit 6f1435f "ofproto: Resubmit
statistics improperly account during failover." Flow statistics
could be double accounted when removed from the datapath.

Reported-by: KK Yap <yapkke@stanford.edu>
---
 ofproto/ofproto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index bc900dad..ee59cd02 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1744,8 +1744,8 @@ facet_is_controller_flow(struct facet *facet)
 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) {
+    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;
     }
-- 
2.30.2