wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
srvxdp.h
Go to the documentation of this file.
1#ifndef WIRED_SRVXDP_SRVXDP_H
2#define WIRED_SRVXDP_SRVXDP_H
3
7#include "transport/io/xdp/xdpmac/xdpmac.h"
9#include "transport/io/xdp/xskumem/xskumem.h"
10
19
29
47
60
73 wired_srvxdp* x, const wired_srvxdp_cfg* cfg, wired_srvxdpbpf* bpf);
74
87
99
105
113
114#endif
Value-type views that fold the SDK's recurring argument shapes into single parameters,...
i64 wired_srvxdp_send(wired_srvxdp *x, const sockaddr *dst, wired_span pkt)
Send one datagram to dst.
i64 wired_srvxdp_open_shared(wired_srvxdp *x, const wired_srvxdp_cfg *cfg, wired_srvxdpbpf *bpf)
Open one AF_XDP-backed server socket against an already-open shared per-interface BPF object: xsksetu...
i64 wired_srvxdp_open(wired_srvxdp *x, const wired_srvxdp_cfg *cfg)
Open one AF_XDP-backed server socket with its own BPF redirect filter: wired_srvxdpbpf_open on cfg->i...
i64 wired_srvxdp_rx_burst(wired_srvxdp *x, mmsg_buf *bufs, usz nbufs)
Drain up to nbufs received datagrams into bufs.
void wired_srvxdp_print_stats(i64 fd)
Read XDP_STATISTICS for fd (xsksetup_stats) and log one line per counter (name + value) via wired_log...
void wired_srvxdp_close(wired_srvxdp *x)
Tear down x: close the owned BPF link/prog/map fds (skipped when x was opened against a shared wired_...
Shared per-interface BPF objects for the AF_XDP driver: one XSKMAP plus redirect-filter program plus ...
One slot of a recvmmsg() batch: caller-owned receive buffer and source address, filled in by wired_ud...
Definition udp.h:150
A sockaddr_in6 laid out for the kernel (big-endian port; a 16-byte address that is either native IPv6...
Definition udp.h:22
Read-only view of a byte range.
Definition span.h:30
Caller-supplied configuration for one AF_XDP-backed server socket.
Definition srvxdp.h:21
u32 queue_id
RX queue index to bind.
Definition srvxdp.h:23
u8 ip[4]
our IPv4 address, host-readable octets a.b.c.d
Definition srvxdp.h:24
u16 bind_flags
passed through to xsk_cfg
Definition srvxdp.h:26
u16 port
our UDP port, host order
Definition srvxdp.h:25
u32 ifindex
network interface index
Definition srvxdp.h:22
u32 attach_flags
0 = native XDP, XDP_FLAGS_SKB_MODE(2) = generic/veth
Definition srvxdp.h:27
One open AF_XDP driver instance: the socket/rings, the TX frame pool, the learned peer MAC cache,...
Definition srvxdp.h:33
u32 ip_be
cfg->ip, network byte order
Definition srvxdp.h:39
xdpmac macs
peer ip -> mac reflect cache
Definition srvxdp.h:36
xsk xsk
AF_XDP socket, UMEM and four rings.
Definition srvxdp.h:34
wired_srvxdpbpf bpf
BPF map/prog/link owned by this instance; fds are -1 when opened against a shared wired_srvxdpbpf (wi...
Definition srvxdp.h:43
int have_mac
0 until our_mac is learned
Definition srvxdp.h:38
int bpf_owned
1 when wired_srvxdp_open built bpf and close() must tear it down
Definition srvxdp.h:45
u16 port
cfg->port, host order
Definition srvxdp.h:40
xskumem_alloc txpool
TX frame pool, UMEM frames 64..127.
Definition srvxdp.h:35
u8 our_mac[6]
learned from the first RX frame
Definition srvxdp.h:37
The three kernel objects backing one interface's redirect filter.
Definition srvxdpbpf.h:18
Fixed-capacity ip -> mac cache.
Definition xdpmac.h:17
Fixed-capacity LIFO free list of UMEM frame addresses.
Definition xskumem.h:21
unsigned int u32
unsigned 32-bit integer
Definition types.h:15
long i64
signed 64-bit integer
Definition types.h:14
u64 usz
unsigned size (size_t equivalent)
Definition types.h:20
unsigned short u16
unsigned 16-bit integer
Definition types.h:17
unsigned char u8
unsigned 8-bit integer / byte
Definition types.h:18
UDP via direct x86_64 syscalls, dual-stack (one AF_INET6 socket serves IPv6 natively and IPv4 as v4-m...
AF_XDP socket setup: socket(2)/setsockopt(2)/getsockopt(2)/mmap(2)/bind(2) sequence that turns a raw ...