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
}:
let
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 {
stdenv.mkDerivation rec {
pname = "spdk";
version = "20.04.1";
version = "21.04";
src = fetchFromGitHub {
owner = "spdk";
repo = "spdk";
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 = [
python3
];
@ -48,12 +34,13 @@ in stdenv.mkDerivation rec {
postPatch = ''
patchShebangs .
base64 -d ${dpdk-compat-patch} | patch -p1
'';
configureFlags = [ "--with-dpdk=${dpdk}" ];
NIX_CFLAGS_COMPILE = "-mssse3"; # Necessary to compile.
# otherwise does not find strncpy when compiling
NIX_LDFLAGS = "-lbsd";
meta = with lib; {
description = "Set of libraries for fast user-mode storage";

View file

@ -8,14 +8,14 @@
let
mod = kernel != null;
dpdkVersion = "21.02";
in stdenv.mkDerivation rec {
name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}";
version = "20.05";
pname = "dpdk";
version = "${dpdkVersion}" + lib.optionalString mod "-${kernel.version}";
src = fetchurl {
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
sha256 = "0h0xv2zwb91b9n29afg5ihn06a8q28in64hag2f112kc19f79jj8";
url = "https://fast.dpdk.org/rel/dpdk-${dpdkVersion}.tar.xz";
sha256 = "sha256-CZJKKoJVGqKZeKNoYYT4oQX1L1ZAsb4of1QLLJHpSJs==";
};
nativeBuildInputs = [
@ -25,6 +25,7 @@ in stdenv.mkDerivation rec {
pkg-config
python3
python3.pkgs.sphinx
python3.pkgs.pyelftools
];
buildInputs = [
jansson
@ -42,9 +43,12 @@ in stdenv.mkDerivation rec {
'';
mesonFlags = [
"-Dtests=false"
"-Denable_docs=true"
"-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 stdenv.isx86_64 "-Dmachine=nehalem"
++ lib.optional mod "-Dkernel_dir=${placeholder "kmod"}/lib/modules/${kernel.modDirVersion}";

View file

@ -1,21 +1,21 @@
{ 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
dpdk_18_11 = dpdk.overrideAttrs (old: rec {
version = "18.11.5";
dpdk_19_11 = dpdk.overrideAttrs (old: rec {
version = "19.11";
src = fetchurl {
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
sha256 = "1n6nfaj7703l19jcw540lm8avni48hj9q1rq4mfp8b8gd4zjprj0";
sha256 = "sha256-RnEzlohDZ3uxwna7dKNFiqfAAswh4pXFHjvWVJexEqs=";
};
});
in stdenv.mkDerivation rec {
pname = "odp-dpdk";
version = "1.22.0.0_DPDK_18.11";
version = "1.27.0.0_DPDK_19.11";
src = fetchurl {
url = "https://git.linaro.org/lng/odp-dpdk.git/snapshot/${pname}-${version}.tar.gz";
sha256 = "1m8xhmfjqlj2gkkigq5ka3yh0xgzrcpfpaxp1pnh8d1g99094vbx";
sha256 = "sha256-/4m2NqnEXyenNUrCq3c2ozJzPWFFs/Qp7MAVm9B2biA=";
};
nativeBuildInputs = [
@ -23,7 +23,7 @@ in stdenv.mkDerivation rec {
pkg-config
];
buildInputs = [
dpdk_18_11
dpdk_19_11
libconfig
libpcap
numactl
@ -32,19 +32,9 @@ in stdenv.mkDerivation rec {
libbsd
libelf
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
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
, gtk2, which, withGtk ? false
}:
stdenv.mkDerivation rec {
pname = "pktgen";
version = "19.12.0";
version = "21.05.0";
src = fetchurl {
url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/${pname}-${version}.tar.xz";
sha256 = "1clfviz1qa4hysslcg6i29vsxwl9f6j1y7zf9wwx9br3yq08x956";
src = fetchFromGitHub {
owner = "pktgen";
repo = "Pktgen-DPDK";
rev = "pktgen-${version}";
sha256 = "sha256-7lLDtbd14olEHO+1BuI6KTEUNRM/zAyRXau/OZbYbGA=";
};
nativeBuildInputs = [ meson ninja pkg-config ];
buildInputs =
[ dpdk libbsd libpcap lua5_3 numactl which ]
++ lib.optionals withGtk [gtk2];
buildInputs = [
dpdk libbsd libpcap lua5_3 numactl which
] ++ lib.optionals withGtk [
gtk2
];
RTE_SDK = dpdk;
GUI = lib.optionalString withGtk "true";
NIX_CFLAGS_COMPILE = "-msse3";
patches = [ ./configure.patch ];
# requires symbols from this file
NIX_LDFLAGS = "-lrte_net_bond";
postPatch = ''
substituteInPlace lib/common/lscpu.h --replace /usr/bin/lscpu ${util-linux}/bin/lscpu