aboutsummaryrefslogtreecommitdiff
path: root/pcap-linux.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-10-31 16:59:58 -0700
committerGuy Harris <guy@alum.mit.edu>2013-10-31 16:59:58 -0700
commit78bd68edf6247af4cd2af5d30fe9dfaa3fee0db2 (patch)
tree64fe4a9d47e119fa8da5dd985d3c973e7017e926 /pcap-linux.c
parent4c934f4dd3715e3705c089ed3fcb132b7e821de4 (diff)
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.
Diffstat (limited to 'pcap-linux.c')
-rw-r--r--pcap-linux.c14
1 files changed, 7 insertions, 7 deletions
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
}