Complete Guide of Building RUST DPDK Hello World.
I've tried to cover from all the basics
[If you have DPDK Compliant NIC you can skip this]
A virtual box VM with following attributes was used to build and run the example due NIC dep.
Ubuntu 22.04
4 vcpu
8gb RAM
NIC: default adapter[NAT]
NIC: Intel PRO/1000 MT Desktop (82540EM) [bridged]
sudo apt install \
build-essential \
meson \
python3-pyelftools \
libnuma-dev \
pkgconf \
libclang-dev \
clang \
llvm-dev \
libbsd-dev
tar xf dpdk-<version>.tar.gz # or checkout specific version
cd dpdk
meson setup -Dplatform=native build
cd build
ninja
meson install #sudo
ldconfig #sudo
mkdir -p /dev/hugepages
mountpoint -q /dev/hugepages || mount -t hugetlbfs nodev /dev/hugepages
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages # prefer to run with root
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo new demo-rust-dpdk-hello-world
[dependencies]
# rust dpdk from github
rust-dpdk = { git = "https://github.com/ANLAB-KAIST/rust-dpdk.git", package = "rust-dpdk-sys" }
cargo build #--release
$dpdk-user@vbox: sudo ./target/release/demo-rust-dpdk-hello-world
EAL: Detected CPU lcores: 4
EAL: Detected NUMA nodes: 1
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: VFIO support initialized
TELEMETRY: No legacy callbacks, legacy socket not created
hello from core 1
hello from core 2
hello from core 3
hello from core 0