Merge pull request #122588 from Mic92/dpdk

dpdk: 20.05 -> 21.02
This commit is contained in:
Jörg Thalheim 2021-05-24 08:15:17 +01:00 committed by GitHub
commit 8ab19de80d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 68 deletions

View file

@ -13,31 +13,17 @@
, openssl , openssl
}: }:
let stdenv.mkDerivation rec {
dpdk-compat-patch = fetchurl {
url = "https://review.spdk.io/gerrit/plugins/gitiles/spdk/spdk/+/6acb9a58755856fb9316baf9dbbb7239dc6b9446%5E%21/?format=TEXT";
sha256 = "18q0956fkjw19r29hp16x4pygkfv01alj9cld2wlqqyfgp41nhn0";
};
in stdenv.mkDerivation rec {
pname = "spdk"; pname = "spdk";
version = "20.04.1"; version = "21.04";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "spdk"; owner = "spdk";
repo = "spdk"; repo = "spdk";
rev = "v${version}"; rev = "v${version}";
sha256 = "ApMyGamPrMalzZLbVkJlcwatiB8dOJmoxesdjkWZElk="; sha256 = "sha256-Xmmgojgtt1HwTqG/1ZOJVo1BcdAH0sheu40d73OJ68w=";
}; };
patches = [
./spdk-dpdk-meson.patch
# https://review.spdk.io/gerrit/c/spdk/spdk/+/3134
(fetchpatch {
url = "https://github.com/spdk/spdk/commit/c954b5b722c5c163774d3598458ff726c48852ab.patch";
sha256 = "1n149hva5qxmpr0nmav10nya7zklafxi136f809clv8pag84g698";
})
];
nativeBuildInputs = [ nativeBuildInputs = [
python3 python3
]; ];
@ -48,12 +34,13 @@ in stdenv.mkDerivation rec {
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .
base64 -d ${dpdk-compat-patch} | patch -p1
''; '';
configureFlags = [ "--with-dpdk=${dpdk}" ]; configureFlags = [ "--with-dpdk=${dpdk}" ];
NIX_CFLAGS_COMPILE = "-mssse3"; # Necessary to compile. NIX_CFLAGS_COMPILE = "-mssse3"; # Necessary to compile.
# otherwise does not find strncpy when compiling
NIX_LDFLAGS = "-lbsd";
meta = with lib; { meta = with lib; {
description = "Set of libraries for fast user-mode storage"; description = "Set of libraries for fast user-mode storage";

View file

@ -8,14 +8,14 @@
let let
mod = kernel != null; mod = kernel != null;
dpdkVersion = "21.02";
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}"; pname = "dpdk";
version = "20.05"; version = "${dpdkVersion}" + lib.optionalString mod "-${kernel.version}";
src = fetchurl { src = fetchurl {
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz"; url = "https://fast.dpdk.org/rel/dpdk-${dpdkVersion}.tar.xz";
sha256 = "0h0xv2zwb91b9n29afg5ihn06a8q28in64hag2f112kc19f79jj8"; sha256 = "sha256-CZJKKoJVGqKZeKNoYYT4oQX1L1ZAsb4of1QLLJHpSJs==";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@ -25,6 +25,7 @@ in stdenv.mkDerivation rec {
pkg-config pkg-config
python3 python3
python3.pkgs.sphinx python3.pkgs.sphinx
python3.pkgs.pyelftools
]; ];
buildInputs = [ buildInputs = [
jansson jansson
@ -42,9 +43,12 @@ in stdenv.mkDerivation rec {
''; '';
mesonFlags = [ mesonFlags = [
"-Dtests=false"
"-Denable_docs=true" "-Denable_docs=true"
"-Denable_kmods=${lib.boolToString mod}" "-Denable_kmods=${lib.boolToString mod}"
] ]
# kni kernel driver is currently not compatble with 5.11
++ lib.optional (mod && kernel.kernelOlder "5.11") "-Ddisable_drivers=kni"
++ lib.optional (!shared) "-Ddefault_library=static" ++ lib.optional (!shared) "-Ddefault_library=static"
++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem" ++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
++ lib.optional mod "-Dkernel_dir=${placeholder "kmod"}/lib/modules/${kernel.modDirVersion}"; ++ lib.optional mod "-Dkernel_dir=${placeholder "kmod"}/lib/modules/${kernel.modDirVersion}";

View file

@ -1,21 +1,21 @@
{ lib, stdenv, fetchurl, autoreconfHook, pkg-config { lib, stdenv, fetchurl, autoreconfHook, pkg-config
, dpdk, libconfig, libpcap, numactl, openssl, zlib, libbsd, libelf, jansson , dpdk, libbpf, libconfig, libpcap, numactl, openssl, zlib, libbsd, libelf, jansson
}: let }: let
dpdk_18_11 = dpdk.overrideAttrs (old: rec { dpdk_19_11 = dpdk.overrideAttrs (old: rec {
version = "18.11.5"; version = "19.11";
src = fetchurl { src = fetchurl {
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz"; url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
sha256 = "1n6nfaj7703l19jcw540lm8avni48hj9q1rq4mfp8b8gd4zjprj0"; sha256 = "sha256-RnEzlohDZ3uxwna7dKNFiqfAAswh4pXFHjvWVJexEqs=";
}; };
}); });
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "odp-dpdk"; pname = "odp-dpdk";
version = "1.22.0.0_DPDK_18.11"; version = "1.27.0.0_DPDK_19.11";
src = fetchurl { src = fetchurl {
url = "https://git.linaro.org/lng/odp-dpdk.git/snapshot/${pname}-${version}.tar.gz"; url = "https://git.linaro.org/lng/odp-dpdk.git/snapshot/${pname}-${version}.tar.gz";
sha256 = "1m8xhmfjqlj2gkkigq5ka3yh0xgzrcpfpaxp1pnh8d1g99094vbx"; sha256 = "sha256-/4m2NqnEXyenNUrCq3c2ozJzPWFFs/Qp7MAVm9B2biA=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@ -23,7 +23,7 @@ in stdenv.mkDerivation rec {
pkg-config pkg-config
]; ];
buildInputs = [ buildInputs = [
dpdk_18_11 dpdk_19_11
libconfig libconfig
libpcap libpcap
numactl numactl
@ -32,19 +32,9 @@ in stdenv.mkDerivation rec {
libbsd libbsd
libelf libelf
jansson jansson
libbpf
]; ];
NIX_CFLAGS_COMPILE = [ "-Wno-error=address-of-packed-member" ];
# for some reason, /build/odp-dpdk-1.22.0.0_DPDK_18.11/lib/.libs ends up in all binaries,
# while it should be $out/lib instead.
# prepend rpath with the proper location, the /build will get removed during rpath shrinking
preFixup = ''
for prog in $out/bin/*; do
patchelf --set-rpath $out/lib:`patchelf --print-rpath $prog` $prog
done
'';
# binaries will segfault otherwise # binaries will segfault otherwise
dontStrip = true; dontStrip = true;

View file

@ -1,17 +0,0 @@
1. librte_process_info does not exist.
2. lua5.3 library is liblua.
3. app/meson.build uses undeclared drivers_install_subdir.
--- a/lib/common/meson.build
+++ b/lib/common/meson.build
@@ -34,1 +34,1 @@
-libs = ['eal', 'kvargs', 'cmdline', 'process_info']
+libs = ['eal', 'kvargs', 'cmdline']
--- a/lib/lua/meson.build
+++ b/lib/lua/meson.build
@@ -31 +31 @@ endforeach
-ext_deps += cc.find_library('lua5.3', required: true)
+ext_deps += cc.find_library('lua', required: true)
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -0,0 +1,1 @@
+option('drivers_install_subdir', type: 'string', value: '')

View file

@ -1,29 +1,33 @@
{ stdenv, lib, fetchurl, meson, ninja, pkg-config { stdenv, lib, fetchFromGitHub, meson, ninja, pkg-config
, dpdk, libbsd, libpcap, lua5_3, numactl, util-linux , dpdk, libbsd, libpcap, lua5_3, numactl, util-linux
, gtk2, which, withGtk ? false , gtk2, which, withGtk ? false
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "pktgen"; pname = "pktgen";
version = "19.12.0"; version = "21.05.0";
src = fetchurl { src = fetchFromGitHub {
url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/${pname}-${version}.tar.xz"; owner = "pktgen";
sha256 = "1clfviz1qa4hysslcg6i29vsxwl9f6j1y7zf9wwx9br3yq08x956"; repo = "Pktgen-DPDK";
rev = "pktgen-${version}";
sha256 = "sha256-7lLDtbd14olEHO+1BuI6KTEUNRM/zAyRXau/OZbYbGA=";
}; };
nativeBuildInputs = [ meson ninja pkg-config ]; nativeBuildInputs = [ meson ninja pkg-config ];
buildInputs = buildInputs = [
[ dpdk libbsd libpcap lua5_3 numactl which ] dpdk libbsd libpcap lua5_3 numactl which
++ lib.optionals withGtk [gtk2]; ] ++ lib.optionals withGtk [
gtk2
];
RTE_SDK = dpdk; RTE_SDK = dpdk;
GUI = lib.optionalString withGtk "true"; GUI = lib.optionalString withGtk "true";
NIX_CFLAGS_COMPILE = "-msse3"; NIX_CFLAGS_COMPILE = "-msse3";
# requires symbols from this file
patches = [ ./configure.patch ]; NIX_LDFLAGS = "-lrte_net_bond";
postPatch = '' postPatch = ''
substituteInPlace lib/common/lscpu.h --replace /usr/bin/lscpu ${util-linux}/bin/lscpu substituteInPlace lib/common/lscpu.h --replace /usr/bin/lscpu ${util-linux}/bin/lscpu