[ovs-dev] [PATCH] ofproto-dpif: Move 'orig_flow' from action_xlate_ctx to local variable.

Ben Pfaff blp at nicira.com
Thu Feb 14 05:55:37 UTC 2013


Thanks, I pushed this.

On Wed, Feb 13, 2013 at 04:22:07PM -0800, Justin Pettit wrote:
> Looks good.
> 
> --Justin
> 
> 
> On Feb 13, 2013, at 3:50 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > A comment said that this was necessary to silence a false-positive warning
> > from GCC 4.4.  However, it no longer triggers a warning for me, so enough
> > must have changed in the meantime to make GCC happy.
> > 
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> > ofproto/ofproto-dpif.c |   14 +++++---------
> > 1 files changed, 5 insertions(+), 9 deletions(-)
> > 
> > diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> > index 6a994d0..81e0f71 100644
> > --- a/ofproto/ofproto-dpif.c
> > +++ b/ofproto/ofproto-dpif.c
> > @@ -283,7 +283,6 @@ struct action_xlate_ctx {
> >     uint32_t sflow_odp_port;    /* Output port for composing sFlow action. */
> >     uint16_t user_cookie_offset;/* Used for user_action_cookie fixup. */
> >     bool exit;                  /* No further actions should be processed. */
> > -    struct flow orig_flow;      /* Copy of original flow. */
> > };
> > 
> > static void action_xlate_ctx_init(struct action_xlate_ctx *,
> > @@ -6567,6 +6566,7 @@ xlate_actions(struct action_xlate_ctx *ctx,
> > 
> >     enum slow_path_reason special;
> >     struct ofport_dpif *in_port;
> > +    struct flow orig_flow;
> > 
> >     COVERAGE_INC(ofproto_dpif_xlate);
> > 
> > @@ -6589,12 +6589,8 @@ xlate_actions(struct action_xlate_ctx *ctx,
> > 
> >     if (ctx->ofproto->has_mirrors || hit_resubmit_limit) {
> >         /* Do this conditionally because the copy is expensive enough that it
> > -         * shows up in profiles.
> > -         *
> > -         * We keep orig_flow in 'ctx' only because I couldn't make GCC 4.4
> > -         * believe that I wasn't using it without initializing it if I kept it
> > -         * in a local variable. */
> > -        ctx->orig_flow = ctx->flow;
> > +         * shows up in profiles. */
> > +        orig_flow = ctx->flow;
> >     }
> > 
> >     if (ctx->flow.nw_frag & FLOW_NW_FRAG_ANY) {
> > @@ -6650,7 +6646,7 @@ xlate_actions(struct action_xlate_ctx *ctx,
> >             } else if (!VLOG_DROP_ERR(&trace_rl)) {
> >                 struct ds ds = DS_EMPTY_INITIALIZER;
> > 
> > -                ofproto_trace(ctx->ofproto, &ctx->orig_flow, ctx->packet,
> > +                ofproto_trace(ctx->ofproto, &orig_flow, ctx->packet,
> >                               initial_tci, &ds);
> >                 VLOG_ERR("Trace triggered by excessive resubmit "
> >                          "recursion:\n%s", ds_cstr(&ds));
> > @@ -6671,7 +6667,7 @@ xlate_actions(struct action_xlate_ctx *ctx,
> >             }
> >         }
> >         if (ctx->ofproto->has_mirrors) {
> > -            add_mirror_actions(ctx, &ctx->orig_flow);
> > +            add_mirror_actions(ctx, &orig_flow);
> >         }
> >         fix_sflow_action(ctx);
> >     }
> > -- 
> > 1.7.2.5
> > 
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> 



More information about the dev mailing list