From: Alex Wang Date: Fri, 11 Oct 2013 21:58:36 +0000 (-0700) Subject: ofproto-dpif-xlate: Simplify the xlate_send_packet() function. X-Git-Tag: sliver-openvswitch-2.0.90-1~8^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=690efec27ba170cf1bb5bbdd28e9d354c049829a;p=sliver-openvswitch.git ofproto-dpif-xlate: Simplify the xlate_send_packet() function. This commit simplifies the xlate_send_packet() function by calling ofproto_dpif_execute_actions() function. Signed-off-by: Alex Wang Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 0e248ebd2..efa5cbed1 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -2857,20 +2857,12 @@ out: int xlate_send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet) { - uint64_t odp_actions_stub[1024 / 8]; struct xport *xport; - struct ofpbuf key, odp_actions; - struct dpif_flow_stats stats; - struct odputil_keybuf keybuf; struct ofpact_output output; - struct xlate_out xout; - struct xlate_in xin; struct flow flow; union flow_in_port in_port_; int error; - ofpbuf_use_stub(&odp_actions, odp_actions_stub, sizeof odp_actions_stub); - ofpbuf_use_stack(&key, &keybuf, sizeof keybuf); ofpact_init(&output.ofpact, OFPACT_OUTPUT, sizeof output); /* Use OFPP_NONE as the in_port to avoid special packet processing. */ in_port_.ofp_port = OFPP_NONE; @@ -2882,22 +2874,11 @@ xlate_send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet) ovs_rwlock_unlock(&xlate_rwlock); return EINVAL; } - - odp_flow_key_from_flow(&key, &flow, ofp_port_to_odp_port(xport->xbridge, OFPP_LOCAL)); - dpif_flow_stats_extract(&flow, packet, time_msec(), &stats); output.port = xport->ofp_port; output.max_len = 0; - xlate_in_init(&xin, xport->xbridge->ofproto, &flow, NULL, 0, packet); - xin.ofpacts_len = sizeof output; - xin.ofpacts = &output.ofpact; - xin.resubmit_stats = &stats; - /* Calls xlate_actions__ directly, since the rdlock is acquired. */ - xlate_actions__(&xin, &xout); - error = dpif_execute(xport->xbridge->dpif, - key.data, key.size, - xout.odp_actions.data, xout.odp_actions.size, - packet, (xout.slow & SLOW_ACTION) != 0); + error = ofproto_dpif_execute_actions(xport->xbridge->ofproto, &flow, NULL, + &output.ofpact, sizeof output, + packet); ovs_rwlock_unlock(&xlate_rwlock); - xlate_out_uninit(&xout); return error; }