Hi Guys,<div><br></div><div>I am working on user level code which uses BPF filter. </div><div>Solution has two threads and  BPF filter for incoming packets to raw socket dedicated to each thread.</div><div>Intent is to divide ingress traffic between two thread based on whether dest IP is even or odd.</div>
<div><br></div><div>BPF filters used are:</div><div>Even IP filter :-&gt; tcpdump -i interface &#39;ether dst &lt;dest mac&gt; &amp;&amp; ip[19] &amp; 0x01 = 0&#39;  <br clear="all"><div>Odd IP filter :-&gt;  tcpdump -i interface  &#39;ether dst &lt;dest mac&gt; &amp;&amp; ip[19] &amp; 0x01 = 1&#39; 
</div><div><br></div><div>There is a packet loss for odd IP thread even when CPU is available. Reason being packet drop due  recv buffer full.</div><div>Same amount of traffic is well handled by even IP thread(user code being same in both), scaling CPU to full 100%. </div>
<div><br></div><div>In odd IP thread, If filter is changed to &quot;tcpdump -i interface  &#39;ether dst &lt;dest mac&gt; &amp;&amp; ip proto 17&#39; &quot;, all goes fine. </div>Also CPU usage at kernel drops from 50% to 4 % for a particular amount of traffic. </div>
<div><br></div><div>Would appreciate any I/ps for reducing load at kernel for packet filtering(Odd/Even IP distribution) </div><div><br></div><div><br></div><div>Cheers<br>Mukesh<br><br>
</div>