diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 7b676862bb..9b84a07093 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -172,6 +172,9 @@ param ( [Parameter(Mandatory = $false)] [switch]$UseXdp = $false, + [Parameter(Mandatory = $false)] + [switch]$UseDpdk = $false, + [Parameter(Mandatory = $false)] [string]$Generator = "", @@ -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" } diff --git a/scripts/prepare-machine.ps1 b/scripts/prepare-machine.ps1 index 1b5aa32ef6..9679138591 100644 --- a/scripts/prepare-machine.ps1 +++ b/scripts/prepare-machine.ps1 @@ -70,6 +70,9 @@ param ( [Parameter(Mandatory = $false)] [switch]$UseXdp, + [Parameter(Mandatory = $false)] + [switch]$UseDpdk, + [Parameter(Mandatory = $false)] [switch]$ForceXdpInstall, @@ -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 + } } } @@ -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. diff --git a/src/platform/CMakeLists.txt b/src/platform/CMakeLists.txt index d79d16841d..f81a464e7d 100644 --- a/src/platform/CMakeLists.txt +++ b/src/platform/CMakeLists.txt @@ -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() @@ -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() @@ -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) @@ -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()