[ovs-dev] [time_left 1/3] ofproto-dpif: Update last-used time of initial rule in handle_flow_miss().

Ben Pfaff blp at nicira.com
Thu Feb 2 00:35:27 UTC 2012


When handle_flow_miss() handled a packet, it failed to update the rule's
last-used time.  The change to flow_push_stats() fixes the problem.

The change to rule_execute() deletes code that becomes redundant after the
change to flow_push_stats().

A test case introduced in an upcoming commit fails without this fix.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ofproto/ofproto-dpif.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 28f0434..d19b6f7 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3687,6 +3687,8 @@ flow_push_stats(struct rule_dpif *rule,
     push.bytes = bytes;
     push.used = used;
 
+    ofproto_rule_update_used(&rule->up, used);
+
     action_xlate_ctx_init(&push.ctx, ofproto, flow, flow->vlan_tci, rule,
                           NULL);
     push.ctx.resubmit_hook = push_resubmit;
@@ -4118,10 +4120,9 @@ rule_execute(struct rule *rule_, const struct flow *flow,
     size = packet->size;
     if (execute_odp_actions(ofproto, flow, odp_actions->data,
                             odp_actions->size, packet)) {
-        ofproto_rule_update_used(&rule->up, time_msec());
         rule->packet_count++;
         rule->byte_count += size;
-        flow_push_stats(rule, flow, 1, size, rule->up.used);
+        flow_push_stats(rule, flow, 1, size, time_msec());
     }
     ofpbuf_delete(odp_actions);
 
-- 
1.7.2.5




More information about the dev mailing list