diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index e00133660f8..af02e2e94cd 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -1850,23 +1850,22 @@ struct reval_context { struct flow flow; }; -/* Translates 'ukey->key' into a flow, populating 'ctx' as it goes along. +/* Translates 'key' into a flow, populating 'ctx' as it goes along. * * Returns 0 on success, otherwise a positive errno value. * * The caller is responsible for uninitializing ctx->xout on success. */ static int -xlate_ukey(struct udpif *udpif, const struct udpif_key *ukey, - const struct dpif_flow_stats *push, struct reval_context *ctx) +xlate_key(struct udpif *udpif, const struct nlattr *key, unsigned int len, + const struct dpif_flow_stats *push, struct reval_context *ctx) { struct ofproto_dpif *ofproto; ofp_port_t ofp_in_port; struct xlate_in xin; int error; - if (odp_flow_key_to_flow(ukey->key, ukey->key_len, &ctx->flow) - == ODP_FIT_ERROR) { + if (odp_flow_key_to_flow(key, len, &ctx->flow) == ODP_FIT_ERROR) { return EINVAL; } @@ -1889,6 +1888,13 @@ xlate_ukey(struct udpif *udpif, const struct udpif_key *ukey, return 0; } +static int +xlate_ukey(struct udpif *udpif, const struct udpif_key *ukey, + const struct dpif_flow_stats *push, struct reval_context *ctx) +{ + return xlate_key(udpif, ukey->key, ukey->key_len, push, ctx); +} + static enum reval_result revalidate_ukey__(struct udpif *udpif, struct udpif_key *ukey, const struct dpif_flow_stats *push, @@ -2127,10 +2133,10 @@ push_dp_ops(struct udpif *udpif, struct ukey_op *ops, size_t n_ops) if (push->n_packets || netflow_exists()) { const struct nlattr *key = op->dop.u.flow_del.key; size_t key_len = op->dop.u.flow_del.key_len; - struct ofproto_dpif *ofproto; struct netflow *netflow; - ofp_port_t ofp_in_port; - struct flow flow; + struct reval_context ctx = { + .netflow = &netflow, + }; int error; if (op->ukey) { @@ -2145,26 +2151,16 @@ push_dp_ops(struct udpif *udpif, struct ukey_op *ops, size_t n_ops) key_len = op->ukey->key_len; } - if (odp_flow_key_to_flow(key, key_len, &flow) - == ODP_FIT_ERROR) { - continue; - } - - error = xlate_lookup(udpif->backer, &flow, &ofproto, NULL, NULL, - &netflow, &ofp_in_port); - if (!error) { - struct xlate_in xin; - - xlate_in_init(&xin, ofproto, - ofproto_dpif_get_tables_version(ofproto), - &flow, ofp_in_port, NULL, - push->tcp_flags, NULL, NULL, NULL); - xin.resubmit_stats = push->n_packets ? push : NULL; - xin.allow_side_effects = push->n_packets > 0; - xlate_actions_for_side_effects(&xin); + error = xlate_key(udpif, key, key_len, push, &ctx); + if (error) { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_WARN_RL(&rl, "xlate_actions failed (%s)!", + xlate_strerror(error)); + } else { + xlate_out_uninit(&ctx.xout); if (netflow) { - netflow_flow_clear(netflow, &flow); + netflow_flow_clear(netflow, &ctx.flow); } } } diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 4c287124f29..f6391ed2944 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -5100,24 +5100,6 @@ xlate_out_uninit(struct xlate_out *xout) recirc_refs_unref(&xout->recircs); } } - -/* Translates the 'ofpacts_len' bytes of "struct ofpact"s starting at 'ofpacts' - * into datapath actions, using 'ctx', and discards the datapath actions. */ -void -xlate_actions_for_side_effects(struct xlate_in *xin) -{ - struct xlate_out xout; - enum xlate_error error; - - error = xlate_actions(xin, &xout); - if (error) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - - VLOG_WARN_RL(&rl, "xlate_actions failed (%s)!", xlate_strerror(error)); - } - - xlate_out_uninit(&xout); -} static struct skb_priority_to_dscp * get_skb_priority(const struct xport *xport, uint32_t skb_priority) diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h index 24d9382561a..eaa2e8e0a70 100644 --- a/ofproto/ofproto-dpif-xlate.h +++ b/ofproto/ofproto-dpif-xlate.h @@ -213,7 +213,6 @@ void xlate_in_init(struct xlate_in *, struct ofproto_dpif *, ovs_version_t, uint16_t tcp_flags, const struct dp_packet *packet, struct flow_wildcards *, struct ofpbuf *odp_actions); void xlate_out_uninit(struct xlate_out *); -void xlate_actions_for_side_effects(struct xlate_in *); enum ofperr xlate_resume(struct ofproto_dpif *, const struct ofputil_packet_in_private *,