On Thu, Aug 5, 2010 at 2:05 PM, Ben Pfaff <span dir="ltr">&lt;<a href="mailto:blp@nicira.com">blp@nicira.com</a>&gt;</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>
&gt; On Wed, Aug 4, 2010 at 2:09 PM, Ben Pfaff &lt;<a href="mailto:blp@nicira.com">blp@nicira.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; +        copy = ofpbuf_new(DPIF_RECV_MSG_PADDING + sizeof(struct odp_msg)<br>
&gt; &gt; +                          + packet-&gt;size);<br>
&gt; &gt; +        ofpbuf_reserve(copy, DPIF_RECV_MSG_PADDING);<br>
&gt; &gt; +        msg = ofpbuf_put_uninit(copy, sizeof *msg);<br>
&gt; &gt; +        msg-&gt;type = _ODPL_ACTION_NR;<br>
&gt; &gt; +        msg-&gt;length = sizeof(struct odp_msg) + packet-&gt;size;<br>
&gt; &gt; +        msg-&gt;port = in_port;<br>
&gt; &gt; +        msg-&gt;reserved = 0;<br>
&gt; &gt; +        msg-&gt;arg = actions[0].controller.arg;<br>
&gt; &gt; +        ofpbuf_put(copy, packet-&gt;data, packet-&gt;size);<br>
&gt;<br>
&gt; How common is it that sending to the controller is the only action?  It<br>
&gt; seems like that might be a fairly common scenario here.  If so, it would be<br>
&gt; ideal if we could avoid copying the packet an additional time here.  I don&#39;t<br>
&gt; know if it is worth it though seeing as this is already a fairly narrow use<br>
&gt; 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&lt;-&gt;kernel trips and trips through the main loop.  It is worth<br>
considering, I guess.<br>
<br>
If you think it&#39;s valuable, then I&#39;ll make a followup patch that adds<br>
that optimization too.<br></blockquote><div><br></div><div>It seems like we&#39;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&#39;t quite as self contained but it doesn&#39;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>