[ovs-dev] [PATCH] ofproto: Keep track of last used with resubmits

Ethan Jackson ethan at nicira.com
Mon Oct 11 16:37:02 PDT 2010


This patch uses the resubmit tree to update the last used field of
flows when other flows resubmit into them.
---
 ofproto/ofproto.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index c11ee55..c70ac83 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3686,13 +3686,19 @@ static void
 update_time(struct ofproto *ofproto, struct rule *rule,
             const struct odp_flow_stats *stats)
 {
+    struct rule * cur;
     long long int used = msec_from_nsec(stats->used_sec, stats->used_nsec);
-    if (used > rule->used) {
-        rule->used = used;
-        if (rule->super && used > rule->super->used) {
-            rule->super->used = used;
+
+    cur = rule;
+    while (cur) {
+        if (used > cur->used) {
+            cur->used = used;
+            if (cur->super && used > cur->super->used) {
+                cur->super->used = used;
+            }
+            netflow_flow_update_time(ofproto->netflow, &cur->nf_flow, used);
         }
-        netflow_flow_update_time(ofproto->netflow, &rule->nf_flow, used);
+        cur = cur->super ? cur->super->rs_parent : cur->rs_parent;
     }
 }

--




More information about the dev mailing list