From 74a4979266860005c0013cdc86208be204cddd1d Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Wed, 21 Aug 2013 09:59:06 +0200 Subject: ring_{rx,tx}: verbose: output version and v3 specific info Kevin says: With netsniff-ng 0.5.8-rc2+, when I run the below packet capture session, the output seems to imply that 64K of memory is being allocated per frame, which does not look like what I want since my interface MTU is only 1500. This appears to be severely limiting the number of frames I can fit into my packet capture ring. As TPACKET_V3 is used in capturing to pcap files, frames are written continuously to the ring, thus the above will give a wrong impression to the user. Therefore, output such information in verbose mode differently when TPACKET_V3 is being used, as it works block-wise. Reported-by: Kevin Branch Signed-off-by: Daniel Borkmann --- ring_rx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ring_rx.c') diff --git a/ring_rx.c b/ring_rx.c index 3c701da..54505da 100644 --- a/ring_rx.c +++ b/ring_rx.c @@ -98,9 +98,15 @@ retry: ring->mm_len = ring->layout.tp_block_size * ring->layout.tp_block_nr; if (verbose) { - printf("RX: %.2Lf MiB, %u Frames, each %u Byte allocated\n", - (long double) ring->mm_len / (1 << 20), - ring->layout.tp_frame_nr, ring->layout.tp_frame_size); + if (!v3) { + printf("RX,V2: %.2Lf MiB, %u Frames, each %u Byte allocated\n", + (long double) ring->mm_len / (1 << 20), + ring->layout.tp_frame_nr, ring->layout.tp_frame_size); + } else { + printf("RX,V3: %.2Lf MiB, %u Blocks, each %u Byte allocated\n", + (long double) ring->mm_len / (1 << 20), + ring->layout.tp_block_nr, ring->layout.tp_block_size); + } } } -- cgit v1.2.3-54-g00ecf