On Thu, Aug 5, 2010 at 2:05 PM, Ben Pfaff <span dir="ltr"><<a href="mailto:blp@nicira.com">blp@nicira.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Thu, Aug 05, 2010 at 01:41:24PM -0400, Jesse Gross wrote:<br>
> On Wed, Aug 4, 2010 at 2:09 PM, Ben Pfaff <<a href="mailto:blp@nicira.com">blp@nicira.com</a>> wrote:<br>
><br>
> > + copy = ofpbuf_new(DPIF_RECV_MSG_PADDING + sizeof(struct odp_msg)<br>
> > + + packet->size);<br>
> > + ofpbuf_reserve(copy, DPIF_RECV_MSG_PADDING);<br>
> > + msg = ofpbuf_put_uninit(copy, sizeof *msg);<br>
> > + msg->type = _ODPL_ACTION_NR;<br>
> > + msg->length = sizeof(struct odp_msg) + packet->size;<br>
> > + msg->port = in_port;<br>
> > + msg->reserved = 0;<br>
> > + msg->arg = actions[0].controller.arg;<br>
> > + ofpbuf_put(copy, packet->data, packet->size);<br>
><br>
> How common is it that sending to the controller is the only action? It<br>
> seems like that might be a fairly common scenario here. If so, it would be<br>
> ideal if we could avoid copying the packet an additional time here. I don't<br>
> know if it is worth it though seeing as this is already a fairly narrow use<br>
> case (first packet to the controller).<br>
<br>
</div></div>I was looking at that as a possibly fairly risky micro-optimization on<br>
top of what seems to be a valuable optimization that avoids multiple<br>
user<->kernel trips and trips through the main loop. It is worth<br>
considering, I guess.<br>
<br>
If you think it's valuable, then I'll make a followup patch that adds<br>
that optimization too.<br></blockquote><div><br></div><div>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.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Did you see any problems with this one?<br></blockquote><div><br></div><div>No, this looks good. </div></div><br>