[ovs-dev] [dpif-netdev 12/15] dpif-netdev: Break actions out into new struct dp_netdev_actions.

Ben Pfaff blp at nicira.com
Wed Jan 8 22:37:04 UTC 2014


On Wed, Jan 08, 2014 at 01:22:25PM -0800, Pravin Shelar wrote:
> On Fri, Dec 27, 2013 at 8:03 PM, Ben Pfaff <blp at nicira.com> wrote:
> > This is analogous to the split between rule and rule_actions in
> > ofproto.  As there, it will allow retaining a reference to a rule's
> > actions, while processing them, without having to retain a reference
> > to the rule itself.
> >
> > Signed-off-by: Ben Pfaff <blp at nicira.com>

...

> >      if (actions) {
> > -        free(state->actions);
> > -        state->actions = xmemdup(netdev_flow->actions,
> > -                         netdev_flow->actions_len);
> > +        dp_netdev_actions_unref(state->actions);
> > +        state->actions = NULL;
> >
> > -        *actions = state->actions;
> > -        *actions_len = netdev_flow->actions_len;
> > +        if (actions) {
> > +            state->actions = dp_netdev_actions_ref(netdev_flow->actions);
> > +            *actions = state->actions->actions;
> > +            *actions_len = state->actions->size;
> > +        }
> actions is checked twice.
> 
> Otherwise looks good.

Thanks for pointing that out.  I changed this code to:

    if (actions) {
        dp_netdev_actions_unref(state->actions);
        state->actions = dp_netdev_actions_ref(netdev_flow->actions);
        *actions = state->actions->actions;
        *actions_len = state->actions->size;
    }



More information about the dev mailing list