From: Ben Pfaff Date: Tue, 10 Jan 2012 23:34:55 +0000 (-0800) Subject: ofproto-dpif: Restore optimization for no-actions case (without leak). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8338659aa5a02421959bece64f6233216de6a101;p=openvswitch ofproto-dpif: Restore optimization for no-actions case (without leak). Commit 968131c1809 (ofproto-dpif: Omit "execute" operation entirely when there are no actions.) introduced an optimization for the case where a flow translated to ODP actions had no actions at all (i.e. the packet is to be dropped). It also introduced a memory leak (the packet was not freed). Commit 999fba59afd (ofproto-dpif: Implement PACKET_IN in userspace.) inadvertently removed the optimization and as a side effect fixed the memory leak. This commit restores the optimization but not the memory leak. Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 93403ba6..a26981d6 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2548,7 +2548,6 @@ handle_flow_miss(struct ofproto_dpif *ofproto, struct flow_miss *miss, struct flow_miss_op *op; struct dpif_execute *execute; - list_remove(&packet->list_node); ofproto->n_matches++; if (facet->rule->up.cr.priority == FAIL_OPEN_PRIORITY) { @@ -2572,6 +2571,12 @@ handle_flow_miss(struct ofproto_dpif *ofproto, struct flow_miss *miss, dpif_flow_stats_extract(&facet->flow, packet, &stats); subfacet_update_stats(subfacet, &stats); + if (!subfacet->actions_len) { + /* No actions to execute, so skip talking to the dpif. */ + continue; + } + + list_remove(&packet->list_node); if (flow->vlan_tci != subfacet->initial_tci) { /* This packet was received on a VLAN splinter port. We added * a VLAN to the packet to make the packet resemble the flow,