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 :-> tcpdump -i interface 'ether dst <dest mac> && ip[19] & 0x01 = 0' <br clear="all"><div>Odd IP filter :-> tcpdump -i interface 'ether dst <dest mac> && ip[19] & 0x01 = 1'
</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 "tcpdump -i interface 'ether dst <dest mac> && ip proto 17' ", 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>