From 9be74e71213ab2a8d449d1cc6cfa4d533fce0d0f Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Thu, 30 May 2013 18:11:08 +0200 Subject: ring: prepare setup_rx_ring_layout for support in v2/v3 Prepare setup_rx_ring_layout for both, v2 and v3. Also do some checks during compile time if offsets stay the same as we operate on different union mappings. 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 5e47d37..f618a35 100644 --- a/ring.h +++ b/ring.h @@ -82,6 +82,13 @@ static inline unsigned int ring_frame_size(struct ring *ring) return ring->layout.tp_frame_size; } +static inline void ring_verify_layout(struct ring *ring) +{ + bug_on(ring->layout.tp_block_size < ring->layout.tp_frame_size); + bug_on((ring->layout.tp_block_size % ring->layout.tp_frame_size) != 0); + bug_on((ring->layout.tp_block_size % getpagesize()) != 0); +} + static inline void tpacket_hdr_clone(struct tpacket2_hdr *thdrd, struct tpacket2_hdr *thdrs) { -- cgit v1.2.3-54-g00ecf