[ovs-dev] [merge native tunneling and patch port 3/7] ofproto-dpif: Refactor compose_clone()
Greg Rose
gvrose8192 at gmail.com
Thu Sep 21 16:48:30 UTC 2017
On 09/12/2017 12:49 PM, Andy Zhou wrote:
> Add a new function clone_xlate_actions(), which shares the same
> signature as do_xlate_actions(); Later patch will make use
> of this function.
>
> Signed-off-by: Andy Zhou <azhou at ovn.org>
> ---
> ofproto/ofproto-dpif-xlate.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index d5b47666e974..223313d4ecba 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -5334,7 +5334,8 @@ reversible_actions(const struct ofpact *ofpacts, size_t ofpacts_len)
> }
>
> static void
> -compose_clone(struct xlate_ctx *ctx, const struct ofpact_nest *oc)
> +clone_xlate_actions(const struct ofpact *actions, size_t actions_len,
> + struct xlate_ctx *ctx)
> {
> struct ofpbuf old_stack = ctx->stack;
> union mf_subvalue new_stack[1024 / sizeof(union mf_subvalue)];
> @@ -5347,12 +5348,11 @@ compose_clone(struct xlate_ctx *ctx, const struct ofpact_nest *oc)
> ofpbuf_put(&ctx->action_set, old_action_set.data, old_action_set.size);
>
> size_t offset, ac_offset;
> - size_t oc_actions_len = ofpact_nest_get_action_len(oc);
> struct flow old_flow = ctx->xin->flow;
>
> - if (reversible_actions(oc->actions, oc_actions_len)) {
> + if (reversible_actions(actions, actions_len)) {
> old_flow = ctx->xin->flow;
> - do_xlate_actions(oc->actions, oc_actions_len, ctx);
> + do_xlate_actions(actions, actions_len, ctx);
> if (ctx->freezing) {
> finish_freezing(ctx);
> }
> @@ -5373,7 +5373,7 @@ compose_clone(struct xlate_ctx *ctx, const struct ofpact_nest *oc)
> if (ctx->xbridge->support.clone) { /* Use clone action */
> /* Use clone action as datapath clone. */
> offset = nl_msg_start_nested(ctx->odp_actions, OVS_ACTION_ATTR_CLONE);
> - do_xlate_actions(oc->actions, oc_actions_len, ctx);
> + do_xlate_actions(actions, actions_len, ctx);
> if (ctx->freezing) {
> finish_freezing(ctx);
> }
> @@ -5386,7 +5386,7 @@ compose_clone(struct xlate_ctx *ctx, const struct ofpact_nest *oc)
> offset = nl_msg_start_nested(ctx->odp_actions, OVS_ACTION_ATTR_SAMPLE);
> ac_offset = nl_msg_start_nested(ctx->odp_actions,
> OVS_SAMPLE_ATTR_ACTIONS);
> - do_xlate_actions(oc->actions, oc_actions_len, ctx);
> + do_xlate_actions(actions, actions_len, ctx);
> if (ctx->freezing) {
> finish_freezing(ctx);
> }
> @@ -5425,6 +5425,14 @@ xlate_done:
> }
>
> static void
> +compose_clone(struct xlate_ctx *ctx, const struct ofpact_nest *oc)
> +{
> + size_t oc_actions_len = ofpact_nest_get_action_len(oc);
> +
> + clone_xlate_actions(oc->actions, oc_actions_len, ctx);
> +}
> +
> +static void
> xlate_meter_action(struct xlate_ctx *ctx, const struct ofpact_meter *meter)
> {
> if (meter->provider_meter_id != UINT32_MAX) {
>
Tested-by: Greg Rose <gvrose8192 at gmail.com>
Reviewed-by: Greg Rose <gvrose8192 at gmail.com>
More information about the dev
mailing list