1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//! DPDK source backend (design placeholder).
//!
//! DPDK (Data Plane Development Kit) is a userspace packet processing
//! framework. It bypasses the Linux kernel networking stack entirely,
//! polling NIC queues directly from userspace via poll-mode drivers (PMDs).
//!
//! ## Why DPDK is deferred (ADR-002)
//!
//! DPDK is powerful but operationally heavy. It introduces C/FFI
//! dependencies, requires hugepages and privileged driver setup, and is
//! difficult to validate in standard CI. AF_XDP is the better first real
//! networking backend because it is closer to the Linux networking stack
//! and has lower operational burden.
//!
//! DPDK's primary advantage (tight latency control with poll-mode drivers
//! and CPU pinning) is only relevant at packet rates that should first be
//! validated with AF_XDP.
//!
//! ## How DPDK works (conceptual)
//!
//! ```text
//! NIC bound to VFIO/UIO driver (kernel driver unloaded)
//! ↓
//! EAL initialised (hugepages, core mask, device PCI address)
//! ↓
//! mempool allocated (hugepage-backed mbuf storage)
//! ↓
//! rte_eth_rx_burst() — polls RX queue directly from userspace
//! ↓
//! mbuf batch → FlyBy RawBatch → Decode → Placement → Sink
//! ```
//!
//! ## Concepts to understand before implementing
//!
//! - **EAL** (Environment Abstraction Layer): DPDK's init layer. Takes
//! `-c <core_mask> -n <mem_channels> -a <pci_addr>` arguments.
//! - **Hugepages**: 2M or 1G pages required for DMA-safe mbuf storage.
//! Configure with `/sys/kernel/mm/hugepages/`.
//! - **mempools**: fixed-size object pools for mbufs. Must be
//! NUMA-local to the core receiving packets.
//! - **mbufs**: DPDK's packet buffer type. Contains header fields and a
//! data pointer into the mempool.
//! - **PMD** (Poll Mode Driver): userspace NIC driver. No interrupts.
//! - **lcores**: DPDK's logical core abstraction, mapped to CPU cores.
//! - **burst receive**: `rte_eth_rx_burst()` returns up to N mbufs per
//! call. Empty-poll rate is a key efficiency metric.
//!
//! ## Operational requirements
//!
//! - Linux host with DPDK ≥ 22.11 installed.
//! - NIC bound to `vfio-pci` or `uio_pci_generic` (not the kernel driver).
//! - Hugepages configured: `echo 512 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages`.
//! - `dpdk-devbind.py --bind=vfio-pci <pci_addr>` before starting.
//! - `CAP_SYS_ADMIN` for VFIO.
//!
//! ## FlyBy implementation strategy
//!
//! The recommended approach (see §23 of Part IV):
//!
//! 1. Keep DPDK behind the `dpdk` feature flag (it is already).
//! 2. Isolate all FFI in a `ffi` submodule with explicit safety comments.
//! 3. Wrap mbufs in a safe `Mbuf` newtype; never expose raw `rte_mbuf *`
//! in the public API.
//! 4. Use `RawBatch` as the handoff point: copy mbuf data into pre-allocated
//! batch slots (copy mode first), then zero-copy as a follow-up.
//! 5. Prototype outside the main crate before integration.
//!
//! ## Status
//!
//! Design placeholder. Returns [`crate::core::ErrorKind::NotImplemented`].
//! The concrete FFI binding is a future deliverable after AF_XDP is stable.
use crate;
use crateRawBatch;
use crateDpdkConfig;
use crate;
/// DPDK source: polls a NIC RX queue via a userspace poll-mode driver.
///
/// See the module documentation for the full design description.
///
/// # Current status
///
/// Placeholder. Returns [`ErrorKind::NotImplemented`] on all operations.
/// Enable the `dpdk` feature flag to compile this type.