ANLAB-KAIST / rust-dpdk

BSD 3-Clause "New" or "Revised" License
84 stars 14 forks source link

rust-dpdk

Build Status

Tested with https://github.com/DPDK/dpdk.git v22.11.

Goals

There are other rust-dpdk implementations and you may choose most proper implementation to your purpose. (https://github.com/flier/rust-dpdk, https://github.com/netsys/netbricks) This library is built for following design goals.

  1. Minimize hand-written binding code.
  2. Do not include bindgen's output in this repository.
  3. Statically link DPDK libraries instead of using shared libraries.
Library No bindgen output Static linking Inline function wrappers Prevent PMD opt-out
flier bindgen snapshot O O (manual) X
netbricks manual FFI X X O (via dynload)
ANLAB ondemand creation O O (automatic) O

Prerequisites

First, this library depends on Intel Data Plane Development Kit (DPDK). Refer to official DPDK document to install DPDK (http://doc.dpdk.org/guides/linux_gsg/index.html).

Here, we include basic instructions to build DPDK and use this library.

Commonly, following packages are required to build DPDK.

apt-get install -y curl git build-essential libnuma-dev meson python3-pyelftools # To download and build DPDK
apt-get install -y linux-headers-`unmae -r` # To build kernel drivers
apt-get install -y libclang-dev clang llvm-dev # To analyze DPDK headers and create bindings

DPDK can be installed by following commands:

meson build
ninja -C build
ninja -C build install # sudo required

Since v20.11, kernel drivers are moved to https://git.dpdk.org/dpdk-kmods/. If your NIC requires kernel drivers, they are found at the above link.

Now add rust-dpdk to your project's Cargo.toml and use it!

[dependencies]
rust-dpdk-sys = { git = "https://github.com/ANLAB-KAIST/rust-dpdk", branch = "main" }