[ovs-dev] [PATCH 4/4] netdev: Add support for "patch" type

Jesse Gross jesse at nicira.com
Wed Apr 14 18:02:32 UTC 2010


On Wed, Apr 14, 2010 at 1:20 PM, Ben Pfaff <blp at nicira.com> wrote:

> On Wed, Apr 14, 2010 at 12:31:25AM -0700, Justin Pettit wrote:
> > diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> > index 736b588..4d4bf90 100644
> > --- a/lib/netdev-linux.c
> > +++ b/lib/netdev-linux.c
> > @@ -177,7 +178,7 @@ netdev_dev_linux_cast(const struct netdev_dev
> *netdev_dev)
> >  {
> >      const char *type = netdev_dev_get_type(netdev_dev);
> >      assert(!strcmp(type, "system") || !strcmp(type, "tap")
> > -            || !strcmp(type, "gre"));
> > +            || !strcmp(type, "gre") || !strcmp(type, "patch"));
> >      return CONTAINER_OF(netdev_dev, struct netdev_dev_linux,
> netdev_dev);
> >  }
> >
> > @@ -186,7 +187,7 @@ netdev_linux_cast(const struct netdev *netdev)
> >  {
> >      const char *type = netdev_get_type(netdev);
> >      assert(!strcmp(type, "system") || !strcmp(type, "tap")
> > -            || !strcmp(type, "gre"));
> > +            || !strcmp(type, "gre") || !strcmp(type, "patch"));
> >      return CONTAINER_OF(netdev, struct netdev_linux, netdev);
> >  }
>
> I realize that you didn't introduce the above, but it still seems like a
> silly amount of overhead in the assertions.  Why not something like this:
>        assert(netdev_get_dev(netdev)->netdev_class->init ==
> netdev_linux_init);
> Much cheaper than up to 4 string compares.
>
>
My GRE patch set includes a change to this effect.  I would just leave this
as it is for now since I'll have to fix it up either way when I rebase.


>
> > diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
> > index d3f3efb..873c145 100644
> > --- a/vswitchd/vswitch.xml
> > +++ b/vswitchd/vswitch.xml
> > @@ -357,6 +357,9 @@
> >            <dd>A TUN/TAP device managed by Open vSwitch.</dd>
> >            <dt><code>gre</code></dt>
> >            <dd>A GRE tunnel device managed by Open vSwitch.</dd>
> > +          <dt><code>patch</code></dt>
> > +          <dd>A pair of virtual devices that act as patch cable managed
> by
> > +            Open vSwitch.</dd>
> >          </dl>
> >        </column>
>
> The XML file should also document the "peer" option for patch devices.
> (I think that it doesn't document the options for "gre" devices, but in
> my opinion that's a bug.)


Documenting the GRE options is on my todo list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20100414/c69dee00/attachment-0003.html>


More information about the dev mailing list