On Wed, Oct 10, 2012 at 6:12 PM,  <[email protected]> wrote:
> Just to make sure, so the buffer that is allocated to TX_RING can be 
> discared, if not required, if so, can you please give an example snippet code?

To familiarize yourself with the whole mechanism, you can read this:
http://lingrok.org/xref/linux-net-next/Documentation/networking/packet_mmap.txt

Short answer: if you mean by discarded ``free'd during runtime'' then
no. The ring buffer is allocated and setup on startup, you give the
kernel a flag if it's the kernel's turn to process or not. After you
have filled enough packets (does not need to be all) and set the flag
for the kernel, you can signal the kernel to start pushing those out
by calling a non-blocking sendto(2). If your question relates to the
BPF filtering in user space that I/you mentioned earlier, then it's
that while doing a read(2) on the pcap file with handing the ring slot
buffer to it, we execute the BPF machine and repeat the same process
on the same slot until the packet passes the filter. It can all be
read in the code.

> On Monday, October 8, 2012 4:04:46 PM UTC+5:30, [email protected] wrote:
>> I downloaded and compiled the netsniff-ng. The replay works perfectly for 
>> 10G and 1G rates, well above other open source softwares. I have achieved 
>> around close to 2.6 Mpps with 512 byte packets and close to 5Mpps in 10G 
>> Intel Ixgbe card.
>>
>> I have a few queries:
>>
>> 1) In the code for netnsiff-ng, it expects bpf filter which is applied on 
>> the Pcap file. Can I instead apply the filter on the TxRing ie. the Intel 
>> NIC card? So that multiple TxRings can have multiple filters.
>>
>> eg. eth1#SrcPort=1233-1244
>>       eth2#IPSrc=1.2.3.4/16 etc.
>>
>> 2) One more requirement is that, is it possible to get a bpf filter from 
>> command line in a human readable format like SrcPort like the one in 
>> tcpreplay ?
>
> --
>
>

-- 


Reply via email to