From f3b50afb0347705ba667b030204f61c8a3865b09 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 1 Feb 2012 11:42:39 -0800 Subject: [PATCH] ofproto-dpif: Update last-used time of initial rule in handle_flow_miss(). 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 --- ofproto/ofproto-dpif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 28f04341..d19b6f7f 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); -- 2.30.2