Merge pull request #156790 from abbradar/dpdk

DPDK improvements
This commit is contained in:
Jörg Thalheim 2022-01-29 09:54:44 +01:00 committed by GitHub
commit 4b90f0d6c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 20 deletions

View File

@ -1,9 +1,9 @@
{ stdenv, lib
, kernel
, fetchurl
, pkg-config, meson, ninja
, pkg-config, meson, ninja, makeWrapper
, libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap, rdma-core
, doxygen, python3
, doxygen, python3, pciutils
, withExamples ? []
, shared ? false }:
@ -20,6 +20,7 @@ in stdenv.mkDerivation rec {
};
nativeBuildInputs = [
makeWrapper
doxygen
meson
ninja
@ -31,22 +32,27 @@ in stdenv.mkDerivation rec {
buildInputs = [
jansson
libbpf
libbsd
libelf
libpcap
numactl
openssl.dev
zlib
python3
] ++ lib.optionals mod kernel.moduleBuildDependencies;
# Propagated to support current DPDK users in nixpkgs which statically link
# with the framework (e.g. odp-dpdk).
propagatedBuildInputs = [
# Propagated to support current DPDK users in nixpkgs which statically link
# with the framework (e.g. odp-dpdk).
rdma-core
# Requested by pkg-config.
libbsd
];
postPatch = ''
patchShebangs config/arm buildtools
'' + lib.optionalString mod ''
# kernel_install_dir is hardcoded to `/lib/modules`; patch that.
sed -i "s,kernel_install_dir *= *['\"].*,kernel_install_dir = '$kmod/lib/modules/${kernel.modDirVersion}'," kernel/linux/meson.build
'';
mesonFlags = [
@ -59,30 +65,25 @@ in stdenv.mkDerivation rec {
++ lib.optional (!shared) "-Ddefault_library=static"
++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
++ lib.optional stdenv.isAarch64 "-Dmachine=generic"
++ lib.optional mod "-Dkernel_dir=${placeholder "kmod"}/lib/modules/${kernel.modDirVersion}"
++ lib.optional mod "-Dkernel_dir=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
++ lib.optional (withExamples != []) "-Dexamples=${builtins.concatStringsSep "," withExamples}";
# dpdk meson script does not support separate kernel source and installion
# dirs (except via destdir), so we temporarily link the former into the latter.
preConfigure = lib.optionalString mod ''
mkdir -p $kmod/lib/modules/${kernel.modDirVersion}
ln -sf ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build \
$kmod/lib/modules/${kernel.modDirVersion}
'';
postBuild = lib.optionalString mod ''
rm -f $kmod/lib/modules/${kernel.modDirVersion}/build
'';
postInstall = ''
# Remove Sphinx cache files. Not only are they not useful, but they also
# contain store paths causing spurious dependencies.
rm -rf $out/share/doc/dpdk/html/.doctrees
wrapProgram $out/bin/dpdk-devbind.py \
--prefix PATH : "${lib.makeBinPath [ pciutils ]}"
'' + lib.optionalString (withExamples != []) ''
find examples -type f -executable -exec install {} $out/bin \;
mkdir -p $examples/bin
find examples -type f -executable -exec install {} $examples/bin \;
'';
outputs = [ "out" ] ++ lib.optional mod "kmod";
outputs =
[ "out" "doc" ]
++ lib.optional mod "kmod"
++ lib.optional (withExamples != []) "examples";
meta = with lib; {
description = "Set of libraries and drivers for fast packet processing";

View File

@ -288,6 +288,8 @@ in {
dpdk-kmods = callPackage ../os-specific/linux/dpdk-kmods { };
dpdk = pkgs.dpdk.override { inherit kernel; };
exfat-nofuse = callPackage ../os-specific/linux/exfat { };
evdi = callPackage ../os-specific/linux/evdi { };