Custom DPDK PMD · F-Stack port · FPGA NIC
A kernel-bypass network stack for RISC-V: a custom DPDK Poll Mode Driver for an FPGA NIC, patches to run F-Stack (FreeBSD networking) on RISC-V, and the tooling to cross-compile and deploy it. The driver maps MMIO directly into user space, implements burst RX/TX with descriptor rings and doorbell semantics, and fixes a RISC-V weak-memory-ordering bug with explicit fence instructions so the NIC sees updated descriptors correctly.
| Layer | What I Did |
|---|---|
| PMD | Ported kernel NIC driver → DPDK burst API; added fence ow,ow / fence i,r where needed |
| F-Stack | RISC-V context-switch asm (arch_ctx.S), single-process init fixes, FreeBSD header glue |
| Build | Meson cross-file for riscv64-linux-gnu; tuned f-stack.conf and nginx.conf |
C · DPDK · F-Stack · FreeBSD · RISC-V · Meson · vfio-platform · MMIO · AXI DMA
┌──────────────────────────────────────────────────────────────────────────┐
│ RISC-V FPGA Host │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ Nginx / App │
│ │ │
│ ▼ │
│ F-Stack (libfstack) ◄── RISC-V port: arch_ctx.S, ff_dpdk_if patches │
│ │ │
│ ▼ │
│ DPDK EAL ◄── Custom PMD: eth_rx_burst, eth_tx_burst, doorbell, fence │
│ │ │
│ ▼ │
│ FPGA NIC (MMIO · AXI DMA Scatter-Gather) │
│ │
└──────────────────────────────────────────────────────────────────────────┘
| Component | Description |
|---|---|
| Custom PMD | Burst RX/TX, 1024-entry descriptor rings, tail-pointer doorbell, DMA error handling |
| RISC-V memory fix | fence ow,ow / fence i,r so NIC observes correct descriptor state (weak ordering) |
| F-Stack port | Context-switch asm for micro-threading; single-process mode fixes |
| Cross-build | riscv64-linux-gnu toolchain via Meson cross-file |
| Path | Role |
|---|---|
COMPAS_PMD/ |
Custom DPDK PMD source |
FSTACK_RISCV_PORT/ |
F-Stack + FreeBSD RISC-V patches |
riscv_cross.txt |
Meson cross-compilation profile |
f-stack.conf |
Runtime config (lcore mask, PCI whitelist) |
nginx.conf |
Nginx + F-Stack affinity config |
RISCV_FLASHING.md |
FPGA flashing & serial console (env-specific) |
1. Integrate the driver
cp -r COMPAS_PMD/drivers/net/compas /path/to/dpdk/drivers/net/
meson setup build --cross-file riscv_cross.txt -Ddrivers=net/compas
ninja -C build2. Patch F-Stack
cp -r FSTACK_RISCV_PORT/* /path/to/f-stack/
cd /path/to/f-stack/lib && ./setup_freebsd_riscv.sh
# Build libfstack with riscv64-linux-gnu toolchain3. Run
- Program FPGA, connect to RISC-V console (see
RISCV_FLASHING.md) - Deploy
f-stack.confandnginx.conf ./nginx -c nginx.conf
MIT — see LICENSE.