ofproto-dpif: Omit "execute" operation entirely when there are no actions.
authorBen Pfaff <blp@nicira.com>
Mon, 26 Dec 2011 22:40:54 +0000 (14:40 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 2 Jan 2012 20:42:35 +0000 (12:42 -0800)
There's no point in executing an empty set of actions.

dpif_execute() has had this optimization internally for a long time but
dpif_operate() doesn't.  For dpif_operate() it seems like a bigger win to
optimize it at this higher level, avoiding adding any operation to the
array at all.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif.c

index eabce4e07213225838120debc28d7e01d19f19c9..031aa71e21d05ecbfd7ad4645693804653c3d639 100644 (file)
@@ -2573,7 +2573,8 @@ handle_flow_miss(struct ofproto_dpif *ofproto, struct flow_miss *miss,
 
         if (!execute_controller_action(ofproto, &facet->flow,
                                        subfacet->actions,
-                                       subfacet->actions_len, packet, true)) {
+                                       subfacet->actions_len, packet, true)
+            && subfacet->actions_len > 0) {
             struct flow_miss_op *op = &ops[(*n_ops)++];
             struct dpif_execute *execute = &op->dpif_op.execute;