[ovs-dev] [netlink v3 5/5] datapath: Merge vport "attach" into "create" and "detach" into "destroy".
Ben Pfaff
blp at nicira.com
Fri Dec 3 21:23:00 UTC 2010
On Thu, Dec 02, 2010 at 07:25:09PM -0800, Jesse Gross wrote:
> 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.
OK, I did a very partial fix for that by returning it to userspace for
ODP_VPORT_DETACH. There are more callers where it won't get propagated,
e.g. ODP_DP_DESTROY.
The real fix is to make sure that it can't fail...
> > 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.
Good point, thanks, done.
> 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.
Also done, thanks again.
> Otherwise:
> Acked-by: Jesse Gross <jesse at nicira.com>
More information about the dev
mailing list