Hi all,
I would like to know if there are any ways to increase the rate at which
packets can be read/copied into a buffer using PF_RING.
I'm writing a program that reads a large pcap file using pcap_loop, puts the
packets into a 100MB buffer and then processes this 100MB buffer on a GPU.
Basically, it simulates live packet processing where packets are received one
by one. As the program is currently single-threaded, it will fill up the
buffer, copy the buffer to GPU, process on GPU, copy the
results back to CPU, then repeat the process again by filling up the buffer
until no more packets are read. The way the buffer is filled is by memcpy-ing
every packet into this buffer.
The transferring of data to/from CPU/GPU and the GPU processing is very fast
(multi-Gbps). The bottleneck lies in the memcpy-ing packets to buffer portion,
which can reach only up to 1 Gbps. Therefore, the whole program can never
exceed 1 Gbps.
I'm hoping to speed up the process using PF_RING.
The "Improving Passive Packet Capture: Beyond Device Polling" paper states that
the idea behind PF_RING is "the socket ring buffer is exported to userspace
applications via mmap"
and "userspace applications that want to access the buffer need to open the
file, then
call mmap() on it in order to obtain a pointer to the circular buffer." I'm
hoping to be able to do that - have the GPU read from the buffer directly and
not have to memcpy every packet into another buffer first.
However, since my input packets are not from actual packet capture via a NIC
but a pcap file that is read offline, is this method possible using PF_RING?
I'm also not sure how I can implement this. Do I use pfring_recv()? Which
"file" do I open to access the buffer and call mmap() on?
Lastly, from the userland/examples/pfmap.c example, it looks like struct
pfring_pkthdr contains L2 to L4 headers. Is this right? What happens to packets
that are tunnelled, i.e. eth -> IPv4 -> IPv6?
Thank you.
Regards,Rayne
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc