ofproto-dpif: Include datapath flow misses in flow statistics.
authorBen Pfaff <blp@nicira.com>
Thu, 8 Dec 2011 20:40:01 +0000 (12:40 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 19 Dec 2011 22:53:06 +0000 (14:53 -0800)
Commit 501f8d1fd75 (ofproto-dpif: Batch interacting with the dpif on flow
miss operations.) caused packets handled manually in userspace not to be
counted in flow statistics.  This patch fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Bug #8494.

ofproto/ofproto-dpif.c

index 527c05dc5cf6bbec01208fe6fbb56b97be2d469d..84ddc9dc06db3f568552153d81cb413f53bb04e4 100644 (file)
@@ -2543,6 +2543,8 @@ handle_flow_miss(struct ofproto_dpif *ofproto, struct flow_miss *miss,
                                miss->initial_tci);
 
     LIST_FOR_EACH_SAFE (packet, next_packet, list_node, &miss->packets) {
+        struct dpif_flow_stats stats;
+
         list_remove(&packet->list_node);
         ofproto->n_matches++;
 
@@ -2563,6 +2565,12 @@ handle_flow_miss(struct ofproto_dpif *ofproto, struct flow_miss *miss,
         if (!facet->may_install || !subfacet->actions) {
             subfacet_make_actions(ofproto, subfacet, packet);
         }
+
+        /* Credit statistics to subfacet for this packet.  We must do this now
+         * because execute_controller_action() below may destroy 'packet'. */
+        dpif_flow_stats_extract(&facet->flow, packet, &stats);
+        subfacet_update_stats(ofproto, subfacet, &stats);
+
         if (!execute_controller_action(ofproto, &facet->flow,
                                        subfacet->actions,
                                        subfacet->actions_len, packet, true)) {