How hpcn-uam/dpdk2disk works
Project Type and Purpose
• This is an open‑source, command‑line packet‑capture tool built in C, using DPDK for zero‑copy high‑speed packet I/O.
• Its sole purpose is to receive network packets at line rate (tested up to 40 Gbps) and dump them in PCAP format to a disk array.
File Structure
Top‑level items:
• dpdk/ ← DPDK submodule (Environment Abstraction Layer, PMDs, EAL)
• scripts/ ← Example shell scripts to kick off capture
• src/ ← Application source code
– Makefile
– main.c, init.c, runtime.c, config.c, external.c, hdd.c, …
– hptimelib/ (high‑precision timestamp library)
– pcap_wrap.h (wrapper for PCAP file format)
– test/ (unit or integration tests)
Key observations:
• All logic resides in src/, following a roughly modular structure: initialization, runtime core loop, disk writer, external modules, timestamp library.
• No GUI or web frontend—pure CLI tool.
• Scripts orchestrate build and run: capture0.sh sets up DPDK environment variables and starts the binary.
README for Further Insights
• Confirms DPDK version is vendored in dpdk/ (or can be pointed to externally via RTE_SDK).
• Build steps: dpdk-setup.sh for DPDK, Makefile in src/ for the app.
• Execution: capture0.sh <outputFolder> [MaxFileSize]
Main Components
a. DPDK Environment (dpdk/)
– EAL initialization
– PMD drivers for NIC ports
– Memory pools for packet buffers
b. Application Core (src/)
– Configuration Loader (config.c)
– Initialization Module (init.c)
– Runtime Packet Loop (runtime.c)
– External Interface (external.c / external.h)
– High‑Precision Timestamp Library (hptimelib / hptl.c)
– HDD/PCAP Writer (hdd.c / pcap_wrap.h)
c. Host OS and Disk Array
d. Control Scripts (scripts/capture0.sh)
Architectural Patterns & Principles
• Modular C code with clear separation of concerns: init, runtime, I/O, external modules.
• Zero‑copy packet processing via DPDK EAL and mbuf pools.
• Pluggable timestamp library (hptl), external interface for future extensions.
Relevant Technologies / Frameworks
• DPDK (Data Plane Development Kit) for user‑space packet I/O
• POSIX Shell for scripts
• Standard C and Makefile for build
Essential Elements Checklist
– Clear component labels
– Layered grouping: Scripts → Application → DPDK → Hardware