From 78bd68edf6247af4cd2af5d30fe9dfaa3fee0db2 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 31 Oct 2013 16:59:58 -0700 Subject: For TPACKET_V3, pick a "frame" size of 131072. The "frame" size is used to carve the mapped region into buffers that contain variable-sized packets; pick a "frame" (buffer) size big enough to hold a reasonably large packet. --- pcap-linux.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pcap-linux.c') diff --git a/pcap-linux.c b/pcap-linux.c index 03ff5d30..e8173824 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -3694,14 +3694,14 @@ create_ring(pcap_t *handle, int *status) #ifdef HAVE_TPACKET3 case TPACKET_V3: - /* The "frame size" (tp_frame_size) and "frame count" - * (tp_frame_nr) values aren't used for TPACKET_V3, except - * that the kernel still does sanity checks on their values, - * so we have to give *some* value. + /* The "frames" for this are actually buffers that + * contain multiple variable-sized frames. * - * We just pick a frame size of 64K and run with that. */ - req.tp_frame_size = 65536; - req.tp_frame_nr = handle->opt.buffer_size/65536; + * We pick a "frame" size of 128K to leave enough + * room for at least one reasonably-sized packet + * in the "frame". */ + req.tp_frame_size = 131072; + req.tp_frame_nr = handle->opt.buffer_size/req.tp_frame_size; break; #endif } -- cgit v1.2.3