[ovs-dev] [netlink v3 5/5] datapath: Merge vport "attach" into "create" and "detach" into "destroy".

Jesse Gross jesse at nicira.com
Fri Dec 3 03:25:09 UTC 2010


On Tue, Nov 16, 2010 at 5:11 PM, Ben Pfaff <blp at nicira.com> wrote:
> @@ -427,15 +418,9 @@ int dp_detach_port(struct vport *p)
>        list_del_rcu(&p->node);
>        rcu_assign_pointer(p->dp->ports[p->port_no], NULL);
>
> -       err = vport_detach(p);
> -       if (err)
> -               return err;
> -
> -       /* Then wait until no one is still using it, and destroy it. */
> -       synchronize_rcu();
> -
> +       /* Then destroy it. */
>        vport_lock();
> -       vport_del(p);
> +       vport_del(p);           /* XXX handle error */

For the time being we probably should handle the error by returning it
to userspace.  It's still not great but it's good to at least document
these error paths.

> diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
> index f6348be..09bd55b 100644
> --- a/datapath/vport-internal_dev.c
> +++ b/datapath/vport-internal_dev.c
> @@ -214,6 +214,10 @@ static struct vport *internal_dev_create(const struct vport_parms *parms)
>        if (err)
>                goto error_free_netdev;
>
> +       rcu_assign_pointer(internal_dev->attached_vport, internal_dev->vport);
> +       dev_set_promiscuity(netdev_vport->dev, 1);
> +       netif_start_queue(netdev_vport->dev);

We can get rid of all of the references to attached_vport and replace
them with just internal_dev->vport.  They're now always identical.

Also, in vport-internal_dev.c we can drop the checks for !vport in
internal_dev_change_mtu() and internal_dev_getinfo().  Since the ports
will always be attached while the device is registered and those
functions will only be called for internal devices, we'll always have
a valid vport.

Otherwise:
Acked-by: Jesse Gross <jesse at nicira.com>




More information about the dev mailing list