From 968131c18090916ec30738d1ff8c1725bb744a30 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 26 Dec 2011 14:40:54 -0800 Subject: [PATCH] ofproto-dpif: Omit "execute" operation entirely when there are no actions. 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 --- ofproto/ofproto-dpif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index eabce4e0..031aa71e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -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; -- 2.30.2