[ovs-dev] [PATCH] ofproto: Avoid user->kernel->user round-trip for many controller actions.

Jesse Gross jesse at nicira.com
Thu Aug 5 20:50:05 UTC 2010


On Thu, Aug 5, 2010 at 2:05 PM, Ben Pfaff <blp at nicira.com> wrote:

> On Thu, Aug 05, 2010 at 01:41:24PM -0400, Jesse Gross wrote:
> > On Wed, Aug 4, 2010 at 2:09 PM, Ben Pfaff <blp at nicira.com> wrote:
> >
> > > +        copy = ofpbuf_new(DPIF_RECV_MSG_PADDING + sizeof(struct
> odp_msg)
> > > +                          + packet->size);
> > > +        ofpbuf_reserve(copy, DPIF_RECV_MSG_PADDING);
> > > +        msg = ofpbuf_put_uninit(copy, sizeof *msg);
> > > +        msg->type = _ODPL_ACTION_NR;
> > > +        msg->length = sizeof(struct odp_msg) + packet->size;
> > > +        msg->port = in_port;
> > > +        msg->reserved = 0;
> > > +        msg->arg = actions[0].controller.arg;
> > > +        ofpbuf_put(copy, packet->data, packet->size);
> >
> > How common is it that sending to the controller is the only action?  It
> > seems like that might be a fairly common scenario here.  If so, it would
> be
> > ideal if we could avoid copying the packet an additional time here.  I
> don't
> > know if it is worth it though seeing as this is already a fairly narrow
> use
> > case (first packet to the controller).
>
> I was looking at that as a possibly fairly risky micro-optimization on
> top of what seems to be a valuable optimization that avoids multiple
> user<->kernel trips and trips through the main loop.  It is worth
> considering, I guess.
>
> If you think it's valuable, then I'll make a followup patch that adds
> that optimization too.
>

It seems like we'll be able to avoid the extra copy in a significant
percentage of the cases that we can use this optimization.  Given that, if
you think that the first optimization is worthwhile, then I think that the
second one is as well.  I realize that it isn't quite as self contained but
it doesn't seem too risky to me.


>
> Did you see any problems with this one?
>

No, this looks good.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20100805/50861f22/attachment-0003.html>


More information about the dev mailing list