summaryrefslogtreecommitdiff
path: root/ring.h
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-05-30 18:11:08 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-05-30 18:11:08 +0200
commit9be74e71213ab2a8d449d1cc6cfa4d533fce0d0f (patch)
treeff2981355231f8f59917d1d5bab55a6f1e1ba5d1 /ring.h
parentc3fec06db030445563d3945eec6320afa9a3db62 (diff)
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 <dborkman@redhat.com>
Diffstat (limited to 'ring.h')
-rw-r--r--ring.h7
1 files changed, 7 insertions, 0 deletions
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)
{