From d8cdc6ab87550de9c93b1f6763ea6015f292d7fb Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Fri, 31 May 2013 15:07:15 +0200 Subject: ring: netsniff-ng: migrate capture only to TPACKET_V3 Lets migrate capturing to TPACKET_V3, since it will bring a better performance due to fewer page cache misses caused by a higher density of packets, since now they are contigous placed in the ring buffer. It is said that TPACKET_V3 brings the following benefits: *) ~15 - 20% reduction in CPU-usage *) ~20% increase in packet capture rate *) ~2x increase in packet density *) Port aggregation analysis *) Non static frame size to capture entire packet payload Signed-off-by: Daniel Borkmann --- ring.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ring.h') diff --git a/ring.h b/ring.h index be04cf0..8bfe1eb 100644 --- a/ring.h +++ b/ring.h @@ -26,6 +26,13 @@ #include "built_in.h" #include "die.h" +union tpacket_uhdr { + struct tpacket_hdr *h1; + struct tpacket2_hdr *h2; + struct tpacket3_hdr *h3; + void *raw; +}; + struct frame_map { struct tpacket2_hdr tp_h __aligned_tpacket; struct sockaddr_ll s_ll __align_tpacket(sizeof(struct tpacket2_hdr)); -- cgit v1.2.3-54-g00ecf