summaryrefslogtreecommitdiff
path: root/ring.h
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-11-06 10:48:55 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-11-06 10:48:55 +0100
commite9889f58e2e116d10f6b683a267423086b6cf00f (patch)
treea2376e79ece4e38ce75c2a6d4d40bcef2480eeeb /ring.h
parentc1c3bc8c146b9f395790164a9b4aabebc9f5ab25 (diff)
ring: Move common ring block_r/frame_nr shrinking to generic function
Merge shrinking code duplicated for RX/TX rings into an own generic function. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'ring.h')
-rw-r--r--ring.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/ring.h b/ring.h
index 6517a80..4153b9c 100644
--- a/ring.h
+++ b/ring.h
@@ -145,6 +145,14 @@ static inline void ring_verify_layout(struct ring *ring)
bug_on((ring->layout.tp_block_size % RUNTIME_PAGE_SIZE) != 0);
}
+static inline void shrink_ring_layout_generic(struct ring *ring)
+{
+ ring->layout.tp_block_nr >>= 1;
+ ring->layout.tp_frame_nr = ring->layout.tp_block_size /
+ ring->layout.tp_frame_size *
+ ring->layout.tp_block_nr;
+}
+
static inline void tpacket_hdr_clone(struct tpacket2_hdr *thdrd,
struct tpacket2_hdr *thdrs)
{