If your application just needs to look at the header of lots of
packets, I would suggest using AF_PACKET's mmap feature with a limited
capture length. That will copy just a few bytes into user space for
each packet, and user space can process batches of packets at a time
when your device is loaded. This is very efficient.
AF_PACKET is a raw capture socket; this is completely zero-copy and works directly with DMA
(PF_RING/DNA is the full crazy stuff)
see http://osdir.com/ml/linux.network.general/2003-05/msg00016.html
AF_PACKET is a raw capture socket; this is completely zero-copy and works directly with DMA (PF_RING/DNA is the full crazy stuff)
https://www.kernel.org/doc/Documentation/networking/packet_mmap.txt
so it is actually like implementing totally userspace networking