[ovs-dev] [PATCH v2 2/2] datapath: Move vport init to First port create.

Jesse Gross jesse at nicira.com
Wed May 1 00:38:46 UTC 2013


On Tue, Apr 30, 2013 at 4:21 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
> diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
> index 2db4934..59e22be 100644
> --- a/datapath/vport-gre.c
> +++ b/datapath/vport-gre.c
> @@ -327,10 +325,17 @@ static struct vport *gre_create(const struct vport_parms *parms)
>         struct net *net = ovs_dp_get_net(parms->dp);
>         struct ovs_net *ovs_net;
>         struct vport *vport;
> +       int err;
> +
> +       err = gre_init();
> +       if (err)
> +               return ERR_PTR(err);
>
>         ovs_net = net_generic(net, ovs_net_id);
> -       if (ovsl_dereference(ovs_net->vport_net.gre_vport))
> -               return ERR_PTR(-EEXIST);
> +       if (ovsl_dereference(ovs_net->vport_net.gre_vport)) {
> +               vport = ERR_PTR(-EEXIST);
> +               goto error;
> +       }

I think that we need to jump to error in the case that
ovs_vport_alloc() fails as well.

> diff --git a/datapath/vport.h b/datapath/vport.h
> index cba578c..56065a7 100644
> --- a/datapath/vport.h
> +++ b/datapath/vport.h
> @@ -94,8 +94,7 @@ struct vport {
>         struct ovs_vport_stats offset_stats;
>  };
>
> -#define VPORT_F_REQUIRED       (1 << 0) /* If init fails, module loading fails. */
> -#define VPORT_F_TUN_ID         (1 << 1) /* Sets OVS_CB(skb)->tun_id. */
> +#define VPORT_F_TUN_ID         (1 << 0) /* Sets OVS_CB(skb)->tun_id. */

This is separate but we should probably rename TUN_ID now that it's
more than just the ID. Maybe we can even just remove it (for example,
force people to initialize it) now that it's the only remaining flag.



More information about the dev mailing list