From: Ben Pfaff <blp@nicira.com>
Date: Thu, 11 Nov 2010 19:04:10 +0000 (-0800)
Subject: ofproto: Fix used time of revalidated subrules.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c43ad9a7501774ba33e55e8b5367e611ff0057f;p=openvswitch

ofproto: Fix used time of revalidated subrules.

Despite the comment, the 'used' member of a rule is always set to at least
the value of 'created', except in one case in revalidation.  That case
appears to be just a mistake, so this commit changes it and corrects the
comment.
---

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index dbde7c04..8348868b 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -88,7 +88,7 @@ struct rule {
     uint16_t idle_timeout;      /* In seconds from time of last use. */
     uint16_t hard_timeout;      /* In seconds from time of creation. */
     bool send_flow_removed;     /* Send a flow removed message? */
-    long long int used;         /* Last-used time (0 if never used). */
+    long long int used;         /* Time last used; time created if not used. */
     long long int created;      /* Creation time. */
     uint64_t packet_count;      /* Number of packets received. */
     uint64_t byte_count;        /* Number of bytes received. */
@@ -4823,8 +4823,7 @@ revalidate_rule(struct ofproto *p, struct rule *rule)
             rule->super = super;
             rule->hard_timeout = super->hard_timeout;
             rule->idle_timeout = super->idle_timeout;
-            rule->created = super->created;
-            rule->used = 0;
+            rule->created = rule->used = super->created;
         }
     }