wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
xskring.h
Go to the documentation of this file.
1#ifndef XSKRING_H
2#define XSKRING_H
3
5
14
18typedef struct {
25} xdp_desc;
26
30typedef struct {
36 void* desc;
40
59
62
69
73
80
83
87
91
92#endif
AF_XDP descriptor (binary-compatible with linux/if_xdp.h struct xdp_desc).
Definition xskring.h:18
u32 options
kernel flags, 0 on every frame this SDK produces
Definition xskring.h:24
u64 addr
UMEM byte offset of the frame.
Definition xskring.h:20
u32 len
frame byte length
Definition xskring.h:22
Raw mmap'd ring pointers as handed in by the caller (or, in tests, plain local variables).
Definition xskring.h:30
void * desc
entry array (u64[] for fill/comp, xdp_desc[] for rx/tx)
Definition xskring.h:36
u32 * consumer
shared consumer index cell
Definition xskring.h:34
u32 size
ring capacity, a power of two
Definition xskring.h:38
u32 * producer
shared producer index cell
Definition xskring.h:32
One SPSC ring side, caching the peer's last-known index so the hot path avoids re-reading the shared ...
Definition xskring.h:43
u32 cached_prod
last-seen value of *producer
Definition xskring.h:55
u32 size
ring capacity, a power of two
Definition xskring.h:53
u32 cached_cons
last-seen value of *consumer
Definition xskring.h:57
u32 * consumer
shared consumer index cell
Definition xskring.h:47
void * desc
entry array (u64[] for fill/comp, xdp_desc[] for rx/tx)
Definition xskring.h:49
u32 mask
size - 1, masks a raw index into a slot
Definition xskring.h:51
u32 * producer
shared producer index cell
Definition xskring.h:45
Linux direct syscalls.
unsigned int u32
unsigned 32-bit integer
Definition types.h:15
unsigned long u64
unsigned 64-bit integer
Definition types.h:13
u32 xskring_cons_peek(xskring *r, u32 n, u32 *idx)
Consumer side (draining the rx ring, reaping the comp ring).
u64 * xskring_addr_at(xskring *r, u32 idx)
Address slot accessor (fill/comp rings); idx is a raw (unmasked) index, masked here.
u32 xskring_prod_reserve(xskring *r, u32 n, u32 *idx)
Producer side (feeding the fill ring, submitting to the tx ring).
void xskring_prod_submit(xskring *r, u32 n)
Publish n previously reserved slots: advances cached_prod by n and RELEASE-stores it to *producer.
xdp_desc * xskring_desc_at(xskring *r, u32 idx)
Descriptor slot accessor (rx/tx rings); idx is a raw (unmasked) index, masked here.
void xskring_init(xskring *r, const xskring_view *v)
Initialize r from a view.
void xskring_cons_release(xskring *r, u32 n)
Release n previously peeked slots back to the producer.