vpp: 25.06 -> 25.10, cleanup

This commit is contained in:
azey
2025-11-13 17:09:06 +01:00
parent a070008e7b
commit 0a019aa16f
3 changed files with 101 additions and 70 deletions
+77 -70
View File
@@ -3,66 +3,71 @@
stdenv,
fetchFromGitHub,
nix-update-script,
writeText,
cmake,
pkg-config,
check,
openssl,
python3,
subunit,
mbedtls_2,
# optional dependencies
withStackTraces ? true,
libiberty,
libunwind,
withOpenssl ? true, # tls/quic/wireguard plugins
openssl,
withLibPcap ? true, # bpf_trace_filter plugin
libpcap,
withNetlinkLibs ? true, # linux-cp plugin
libnl,
libmnl,
libelf,
withRdma ? true,
rdma-core,
withDpdk ? true,
dpdk,
jansson,
zlib,
rdma-core,
libbpf,
xdp-tools,
writeText,
enableDpdk ? true,
enableRdma ? true,
enableAfXdp ? true,
}:
withAfXdp ? true,
xdp-tools,
libbpf,
# Support for all network cards, but slower than native XDP
enableAfXdpSkbMode ? false,
libelf,
zlib,
}:
let
dpdk' = dpdk.overrideAttrs (old: {
mesonFlags = old.mesonFlags ++ [ "-Denable_driver_sdk=true" ];
});
rdma-core' = rdma-core.overrideAttrs (old: {
cmakeFlags = old.cmakeFlags ++ [
"-DENABLE_STATIC=1"
"-DBUILD_SHARED_LIBS:BOOL=false"
];
});
# in 25.02 only ID seems to be of interest, so keep it simple
os-release-fake = writeText "os-release-fake" ''
ID=nixos
'';
# >=25.02 uses /etc/os-release, so we substitute it
osRelease = writeText "os-release" "ID=nixos";
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "vpp";
version = "25.06";
version = "25.10";
src = fetchFromGitHub {
owner = "FDio";
repo = "vpp";
rev = "v${version}";
hash = "sha256-BuHKPQA4qHoADqBg2IztlzUMpbvYKK5uH7ktChSW5vk=";
tag = "v${finalAttrs.version}";
hash = "sha256-J+aJXzq9jKzcFKpUNBskX3KccwKtZhK+m8NTbrGjsXw=";
};
postPatch = ''
patchShebangs scripts/
substituteInPlace pkg/CMakeLists.txt \
--replace-fail "/etc/os-release" "${os-release-fake}"
--replace-fail "/etc/os-release" "${osRelease}"
'';
preConfigure = ''
echo "${version}-nixos" > scripts/.version
scripts/version
echo "${finalAttrs.version}-nixos" > scripts/.version
./scripts/version
'';
postConfigure = ''
@@ -70,7 +75,7 @@ stdenv.mkDerivation rec {
patchShebangs ../vpp-api/
'';
sourceRoot = "${src.name}/src";
sourceRoot = "${finalAttrs.src.name}/src";
enableParallelBuilding = true;
env.NIX_CFLAGS_COMPILE = "-Wno-error -Wno-array-bounds -Wno-maybe-uninitialized";
@@ -78,55 +83,57 @@ stdenv.mkDerivation rec {
cmakeFlags = [
"-DVPP_PLATFORM=default"
"-DVPP_LIBRARY_DIR=lib"
"-DVPP_BUILD_PYTHON_API=false" # fails to build as of 25.10
]
++ lib.optional enableDpdk "-DVPP_USE_SYSTEM_DPDK=ON";
++ lib.optional withDpdk "-DVPP_USE_SYSTEM_DPDK=ON";
nativeBuildInputs = [
cmake
pkg-config
]
++ lib.optional enableDpdk dpdk'
++ lib.optional enableRdma rdma-core'.dev;
buildInputs = [
check
openssl
(python3.withPackages (ps: [ ps.ply ]))
subunit # vapi tests
mbedtls_2 # tlsmbed plugin
libpcap # bpf_trace_filter plugin
# linux-cp plugin
libnl
libmnl
]
++ lib.optionals enableDpdk [
# dpdk plugin
libelf
jansson
zlib
]
++ lib.optionals enableAfXdp [
# af_xdp plugin
libelf
libbpf
xdp-tools
zlib
];
patches = lib.optionals enableAfXdp [
./use-dynamic-libxdp-libbpf.patch
];
buildInputs =
lib.optionals withStackTraces [
libiberty
libunwind
]
++ lib.optional withOpenssl openssl
++ lib.optional withLibPcap libpcap
++ lib.optionals withNetlinkLibs [
libnl
libmnl
]
++ lib.optionals withDpdk [
dpdk'
jansson
libelf
zlib
]
++ lib.optional withRdma rdma-core
++ lib.optionals withAfXdp [
libelf
libbpf
xdp-tools
zlib
];
strictDeps = true;
patches = [
# VPP links to static RDMA/XDP by default
./use-dynamic-libs.patch
]
++ lib.optional enableAfXdpSkbMode ./xdp-skb-mode.patch;
passthru.updateScript = nix-update-script { };
meta = {
description = "Fast, scalable layer 2-4 multi-platform network stack running in user space";
homepage = "https://s3-docs.fd.io/vpp/${version}/";
license = [ lib.licenses.asl20 ];
maintainers = with lib.maintainers; [ azey7f ];
mainProgram = "vpp";
homepage = "https://s3-docs.fd.io/vpp/${finalAttrs.version}/";
license = lib.licenses.asl20;
platforms = lib.platforms.linux;
mainProgram = "vpp";
maintainers = with lib.maintainers; [ azey7f ];
};
}
})
@@ -11,3 +11,17 @@
vpp_plugin_find_library(af_xdp ELF_LIB elf)
vpp_plugin_find_library(af_xdp Z_LIB z)
if (NOT XDP_LIB OR NOT BPF_LIB OR NOT ELF_LIB OR NOT Z_LIB)
--- a/plugins/rdma/CMakeLists.txt
+++ b/plugins/rdma/CMakeLists.txt
@@ -18,8 +18,8 @@ if (NOT IBVERBS_INCLUDE_DIR)
return()
endif()
-vpp_plugin_find_library(rdma IBVERBS_LIB libibverbs.a)
-vpp_plugin_find_library(rdma MLX5_LIB libmlx5.a)
+vpp_plugin_find_library(rdma IBVERBS_LIB ibverbs)
+vpp_plugin_find_library(rdma MLX5_LIB mlx5)
if (NOT IBVERBS_LIB OR NOT MLX5_LIB)
message(WARNING "rdma plugin - ibverbs not found - rdma plugin disabled")
+10
View File
@@ -0,0 +1,10 @@
--- a/plugins/af_xdp/device.c
+++ b/plugins/af_xdp/device.c
@@ -330,6 +330,7 @@
sock_config.rx_size = args->rxq_size;
sock_config.tx_size = args->txq_size;
sock_config.bind_flags = XDP_USE_NEED_WAKEUP;
+ sock_config.xdp_flags = XDP_FLAGS_SKB_MODE;
switch (args->mode)
{
case AF_XDP_MODE_AUTO: