[ovs-dev] [cleanups 03/13] ofproto: Make xlate_actions() initialize '*tags' itself.

Ethan Jackson ethan at nicira.com
Thu Nov 11 03:32:35 UTC 2010


Looks good

On Fri, Oct 29, 2010 at 4:37 PM, Ben Pfaff <blp at nicira.com> wrote:
> This seems cleaner than expecting the caller to do it.
> ---
>  ofproto/ofproto.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index a689188..6638def 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -2108,7 +2108,6 @@ rule_make_actions(struct ofproto *p, struct rule *rule,
>     assert(!rule->cr.wc.wildcards);
>
>     super = rule->super ? rule->super : rule;
> -    rule->tags = 0;
>     xlate_actions(super->actions, super->n_actions, &rule->cr.flow, p,
>                   packet, &a, &rule->tags, &rule->may_install,
>                   &rule->nf_flow.output_iface);
> @@ -2440,7 +2439,7 @@ struct action_xlate_ctx {
>
>     /* Output. */
>     struct odp_actions *out;    /* Datapath actions. */
> -    tag_type *tags;             /* Tags associated with OFPP_NORMAL actions. */
> +    tag_type tags;              /* Tags associated with OFPP_NORMAL actions. */
>     bool may_set_up_flow;       /* True ordinarily; false if the actions must
>                                  * be reassessed for every packet. */
>     uint16_t nf_output_iface;   /* Output interface index for NetFlow. */
> @@ -2560,7 +2559,7 @@ xlate_output_action__(struct action_xlate_ctx *ctx,
>         break;
>     case OFPP_NORMAL:
>         if (!ctx->ofproto->ofhooks->normal_cb(&ctx->flow, ctx->packet,
> -                                              ctx->out, ctx->tags,
> +                                              ctx->out, &ctx->tags,
>                                               &ctx->nf_output_iface,
>                                               ctx->ofproto->aux)) {
>             COVERAGE_INC(ofproto_uninstallable);
> @@ -2868,8 +2867,8 @@ xlate_actions(const union ofp_action *in, size_t n_in,
>               struct odp_actions *out, tag_type *tags, bool *may_set_up_flow,
>               uint16_t *nf_output_iface)
>  {
> -    tag_type no_tags = 0;
>     struct action_xlate_ctx ctx;
> +
>     COVERAGE_INC(ofproto_ofp2odp);
>     odp_actions_init(out);
>     ctx.flow = *flow;
> @@ -2877,7 +2876,7 @@ xlate_actions(const union ofp_action *in, size_t n_in,
>     ctx.ofproto = ofproto;
>     ctx.packet = packet;
>     ctx.out = out;
> -    ctx.tags = tags ? tags : &no_tags;
> +    ctx.tags = 0;
>     ctx.may_set_up_flow = true;
>     ctx.nf_output_iface = NF_OUT_DROP;
>     do_xlate_actions(in, n_in, &ctx);
> @@ -2889,6 +2888,9 @@ xlate_actions(const union ofp_action *in, size_t n_in,
>         ctx.may_set_up_flow = false;
>     }
>
> +    if (tags) {
> +        *tags = ctx.tags;
> +    }
>     if (may_set_up_flow) {
>         *may_set_up_flow = ctx.may_set_up_flow;
>     }
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>




More information about the dev mailing list