Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revive DPDK #4345

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ param (
[Parameter(Mandatory = $false)]
[switch]$UseXdp = $false,

[Parameter(Mandatory = $false)]
[switch]$UseDpdk = $false,

[Parameter(Mandatory = $false)]
[string]$Generator = "",

Expand Down Expand Up @@ -472,6 +475,9 @@ function CMake-Generate {
if ($UseXdp) {
$Arguments += " -DQUIC_LINUX_XDP_ENABLED=on"
}
if ($UseDpdk) {
$Arguments += " -DQUIC_DPDK_ENABLED=on"
}
if ($Platform -eq "uwp") {
$Arguments += " -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DQUIC_UWP_BUILD=on"
}
Expand Down
40 changes: 27 additions & 13 deletions scripts/prepare-machine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ param (
[Parameter(Mandatory = $false)]
[switch]$UseXdp,

[Parameter(Mandatory = $false)]
[switch]$UseDpdk,

[Parameter(Mandatory = $false)]
[switch]$ForceXdpInstall,

Expand Down Expand Up @@ -527,13 +530,19 @@ if ($IsLinux) {
sudo gem install public_suffix -v 4.0.7
sudo gem install fpm

# XDP dependencies
if ($UseXdp) {
sudo apt-get -y install --no-install-recommends libc6-dev-i386 # for building xdp programs
sudo apt-add-repository "deb http://mirrors.kernel.org/ubuntu noble main" -y
sudo apt-get update -y
sudo apt-get -y install libxdp-dev libbpf-dev
sudo apt-get -y install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev zlib1g-dev zlib1g pkg-config m4 clang libpcap-dev libelf-dev
if ($UseXdp -or $UseDpdk) {
sudo apt-get install -y libnl-3-dev libnl-genl-3-dev libnl-route-3-dev
if ($UseXdp) {
sudo apt-get -y install --no-install-recommends libc6-dev-i386 # for building xdp programs
sudo apt-add-repository "deb http://mirrors.kernel.org/ubuntu noble main" -y
sudo apt-get update -y
sudo apt-get -y install libxdp-dev libbpf-dev
sudo apt-get -y install zlib1g-dev zlib1g m4 clang
}
if ($UseDpdk) {
# for ubuntu 22.04
sudo apt-get install -y libdpdk-dev
}
}
}

Expand All @@ -543,13 +552,18 @@ if ($IsLinux) {
sudo apt-get install -y lttng-tools
sudo apt-get install -y liblttng-ust-dev
sudo apt-get install -y gdb
if ($UseXdp) {
sudo apt-add-repository "deb http://mirrors.kernel.org/ubuntu noble main" -y
sudo apt-get update -y
sudo apt-get install -y libxdp1 libbpf1
if ($UseXdp -or $UseDpdk) {
sudo apt-get install -y libnl-3-200 libnl-route-3-200 libnl-genl-3-200
sudo apt-get install -y iproute2 iptables
Install-DuoNic
if ($UseXdp) {
sudo apt-add-repository "deb http://mirrors.kernel.org/ubuntu noble main" -y
sudo apt-get update -y
sudo apt-get install -y libxdp1 libbpf1
sudo apt-get install -y iproute2 iptables
Install-DuoNic
}
if ($UseDpdk) {
sudo apt-get install -y libdpdk-dev
}
}

# Enable core dumps for the system.
Expand Down
11 changes: 10 additions & 1 deletion src/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ if("${CX_PLATFORM}" STREQUAL "windows")
${SYSTEM_PROCESSOR} STREQUAL "arm64" OR
${SYSTEM_PROCESSOR} STREQUAL "arm64ec")
set(SOURCES ${SOURCES} datapath_raw_dummy.c)
elseif(QUIC_DPDK_ENABLED)
set(SOURCES ${SOURCES} datapath_raw.c datapath_raw_win.c datapath_raw_socket.c datapath_raw_socket_win.c datapath_raw_dpdk.c)
else()
set(SOURCES ${SOURCES} datapath_raw.c datapath_raw_win.c datapath_raw_socket.c datapath_raw_socket_win.c datapath_raw_xdp_win.c)
endif()
Expand All @@ -28,6 +30,9 @@ else()
set(SOURCES ${SOURCES} datapath_linux.c datapath_epoll.c)
if (QUIC_LINUX_XDP_ENABLED)
set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw.c datapath_raw_linux.c datapath_raw_socket.c datapath_raw_socket_linux.c datapath_raw_xdp_linux.c)
elseif (QUIC_DPDK_ENABLED)
# DPDK is not available yet
set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw.c datapath_raw_linux.c datapath_raw_socket.c datapath_raw_socket_linux.c datapath_raw_dummy.c)
else()
set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw_dummy.c)
endif()
Expand Down Expand Up @@ -98,6 +103,10 @@ elseif(QUIC_LINUX_XDP_ENABLED)
endif()

target_link_libraries(platform PUBLIC ${XDP_LIB} ${BPF_LIB} ${NL_LIB} ${NL_ROUTE_LIB} ${ELF_LIB} ${Z_LIB} ${ZSTD_LIB})
elseif(QUIC_DPDK_ENABLED)
find_library(DPDK_LIBRARIES NAMES rte_eal rte_mempool rte_ring rte_ethdev)
target_include_directories(platform PRIVATE /usr/include/dpdk /usr/include/x86_64-linux-gnu/dpdk)
target_link_libraries(platform PUBLIC ${DPDK_LIBRARIES})
endif()

target_link_libraries(platform PUBLIC inc)
Expand All @@ -111,7 +120,7 @@ if ("${CX_PLATFORM}" STREQUAL "windows")
PRIVATE
${EXTRA_PLATFORM_INCLUDE_DIRECTORIES}
${PROJECT_SOURCE_DIR}/submodules/xdp-for-windows/published/external)
elseif(QUIC_LINUX_XDP_ENABLED)
elseif(QUIC_LINUX_XDP_ENABLED OR QUIC_DPDK_ENABLED)
include_directories(/usr/include/libnl3)
target_include_directories(platform PRIVATE ${EXTRA_PLATFORM_INCLUDE_DIRECTORIES})
endif()
Expand Down
Loading