summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-05-30 17:36:59 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-05-30 17:36:59 +0200
commitc3fec06db030445563d3945eec6320afa9a3db62 (patch)
tree67c378766f2e999813f6c32007afed3b69cab6b9
parent6fbc585ee38b92cea338e96a5f661c811cd28990 (diff)
ring: add necessary structures and helper functions for v3
Prepare and add some structures an helper functions for TPACKET_V3. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r--ring.h11
-rw-r--r--ring_rx.h5
2 files changed, 15 insertions, 1 deletions
diff --git a/ring.h b/ring.h
index facda23..5e47d37 100644
--- a/ring.h
+++ b/ring.h
@@ -31,12 +31,21 @@ struct frame_map {
struct sockaddr_ll s_ll __align_tpacket(sizeof(struct tpacket2_hdr));
};
+struct block_desc {
+ uint32_t version;
+ uint32_t offset_to_priv;
+ struct tpacket_hdr_v1 h1;
+};
+
struct ring {
struct iovec *frames;
uint8_t *mm_space;
size_t mm_len;
- struct tpacket_req layout;
struct sockaddr_ll s_ll;
+ union {
+ struct tpacket_req layout;
+ struct tpacket_req3 layout3;
+ };
};
static inline void next_rnd_slot(unsigned int *it, struct ring *ring)
diff --git a/ring_rx.h b/ring_rx.h
index 8d695e5..0e0478c 100644
--- a/ring_rx.h
+++ b/ring_rx.h
@@ -28,4 +28,9 @@ static inline void kernel_may_pull_from_rx(struct tpacket2_hdr *hdr)
hdr->tp_status = TP_STATUS_KERNEL;
}
+static inline void kernel_may_pull_from_rx_block(struct block_desc *pbd)
+{
+ pbd->h1.block_status = TP_STATUS_KERNEL;
+}
+
#endif /* RX_RING_H */