ofproto-dpif: Update last-used time of initial rule in handle_flow_miss().
authorBen Pfaff <blp@nicira.com>
Wed, 1 Feb 2012 19:42:39 +0000 (11:42 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 7 Feb 2012 23:48:53 +0000 (15:48 -0800)
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@nicira.com>
ofproto/ofproto-dpif.c

index 28f043412276fc62dde80a67d55f897e303b7a1c..d19b6f7f3f0945065e0136736f1e7d06108bc5bb 100644 (file)
@@ -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);