From 0de1be6daf08292e694cb162fc189f26468317dd Mon Sep 17 00:00:00 2001 From: Daniel Noland Date: Tue, 12 Nov 2024 15:17:28 -0700 Subject: [PATCH] Refactor build --- .github/workflows/build.yml | 49 ------- Dockerfile | 25 +--- builds.template.yml | 1 - builds.yml | 1 - default.nix | 219 ++++++++++------------------ justfile | 40 ++--- nix/dpdk-wrapper/src/dpdk_wrapper.h | 108 ++++++-------- nix/flags.nix | 2 +- nix/versions.nix | 2 - nix/versions.nix.template | 2 - 10 files changed, 136 insertions(+), 313 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aab0031..5eba899 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -151,30 +151,6 @@ jobs: body: body }); - - name: "outdated packages (musl64)" - uses: "actions/github-script@v7" - if: ${{ github.event_name == 'pull_request' }} - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - script: | - let fs = require('fs'); - let body = "
\n"; - body += "\n\n"; - body = "## Outdated packages (musl64):\n"; - body += "\n\n"; - body += fs.readFileSync('/tmp/dpdk-sys/builds/env.sysroot.musl64.outdated.md'); - body += "\n
\n"; - const maxLength = 65535; - if (body.length > maxLength) { - const warning = "\n...output truncated due to length limits...\n"; - body = body.slice(0, maxLength - warning.length) + warning; - } - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: body - }); - name: "Vulnerable packages (gnu64)" uses: "actions/github-script@v7" @@ -201,31 +177,6 @@ jobs: body: body }); - - name: "Vulnerable packages (musl64)" - uses: "actions/github-script@v7" - if: ${{ github.event_name == 'pull_request' }} - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - script: | - let fs = require('fs'); - let body = "
\n"; - body += "\n\n"; - body = "## Vulnerable packages (musl64):\n"; - body += "\n\n"; - body += fs.readFileSync('/tmp/dpdk-sys/builds/env.sysroot.musl64.vulns.triage.md'); - body += "\n
\n"; - const maxLength = 65535; - if (body.length > maxLength) { - const warning = "\n...output truncated due to length limits...\n"; - body = body.slice(0, maxLength - warning.length) + warning; - } - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: body - }); - - name: "Setup tmate session for debug" if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} uses: "mxschmitt/action-tmate@v3" diff --git a/Dockerfile b/Dockerfile index 6f39a5c..c008f45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,2 @@ -ARG TAG="latest" -FROM ghcr.io/githedgehog/dpdk-sys/compile-env:${TAG} AS compile-env -FROM ghcr.io/githedgehog/dpdk-sys/doc-env:${TAG} AS doc-env -FROM ghcr.io/githedgehog/dpdk-sys/dev-env:${TAG} AS dev-env -SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] - -# I can't properly set permissions in nix because of the way it works. -# So I have to do this hacky thing to get sudo to work. -# Also, ldconfig breaks in nix settings. -# Normally that doesn't matter but it is called by vscode in the dev container -# so we need to remove it to make that work. -RUN chmod 777 /tmp \ - && chmod 4755 /sbin/sudo \ - && chmod 555 /etc/pam.d \ - && chmod -R 444 /etc/pam.d/* \ - && chmod 444 /etc/group \ - && chmod 444 /etc/passwd \ - && rm /bin/ldconfig \ - && mkdir -p /home/runner \ - && chown -R runner:runner /home/runner - -USER runner -CMD ["/bin/bash", "--login"] +ARG IMAGE=scratch +FROM ${IMAGE} diff --git a/builds.template.yml b/builds.template.yml index d70ad34..54e9cad 100644 --- a/builds.template.yml +++ b/builds.template.yml @@ -27,7 +27,6 @@ matrix: - "debug" target: - "x86_64-unknown-linux-gnu" - - "x86_64-unknown-linux-musl" just: *just_version nixpkgs: - *nixpkgs_unstable diff --git a/builds.yml b/builds.yml index 86d2ed4..5a59221 100644 --- a/builds.yml +++ b/builds.yml @@ -27,7 +27,6 @@ matrix: - "debug" target: - "x86_64-unknown-linux-gnu" - - "x86_64-unknown-linux-musl" just: *just_version nixpkgs: - *nixpkgs_unstable diff --git a/default.nix b/default.nix index 2e451fc..b8337c9 100644 --- a/default.nix +++ b/default.nix @@ -4,8 +4,8 @@ rust-version = versions.rust.${rust-channel}; llvm-version = rust-version.llvm; llvm-overlay = self: super: rec { - llvmPackagesVersion = "llvmPackages_${llvm-version}"; llvmPackages = super.${llvmPackagesVersion}; + llvmPackagesVersion = "llvmPackages_${llvm-version}"; }; rust-overlay = (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")); @@ -19,7 +19,6 @@ ]; }; - project-name = "dpdk-sys"; crossOverlay = { build-flags, crossEnv }: self: super: rec { @@ -66,9 +65,29 @@ fatLto = pkg: pkg.overrideAttrs (orig: { CFLAGS = "${orig.CFLAGS or ""} -ffat-lto-objects"; }); + + at-spi2-atk = null; # no users in container + at-spi2-core = null; # no users in container + dbus = super.dbus.override { enableSystemd = false; }; + libusb = null; + libusb1 = null; + gtk3 = null; + tinysparql = null; + systemd = null; + systemdLibs = null; + systemdMinimal = null; + util-linux = super.util-linux.override { systemdSupport = false; }; rdma-core = (fatLto (optimizedBuild super.rdma-core)).overrideAttrs (orig: { - cmakeFlags = orig.cmakeFlags ++ [ "-DENABLE_STATIC=1" ]; + outputs = [ "out" "dev" ]; + perl = null; + cmakeFlags = orig.cmakeFlags ++ [ + "-DENABLE_STATIC=1" + "-DNO_PYVERBS=1" + "-DNO_MAN_PAGES=1" + "-DIOCTL_MODE=write" + "-DNO_COMPAT_SYMS=1" + ]; patches = (orig.patches or []) ++ (if crossEnv == "musl64" then [] else [(super.fetchpatch { # you need to patch rdma-core to build with clang + glibc 2.40.x since glibc 2.40 has improved fortifying # this function with clang. @@ -121,14 +140,14 @@ })); }; - pkgs.debug = (import toolchainPkgs.path { + pkgs.dev = (import toolchainPkgs.path { overlays = [ (self: prev: { pkgsCross.gnu64 = import prev.path { overlays = [ llvm-overlay (crossOverlay { - build-flags = build-flags.debug; + build-flags = build-flags.dev; crossEnv = "gnu64"; }) ]; @@ -137,7 +156,7 @@ overlays = [ llvm-overlay (crossOverlay { - build-flags = build-flags.debug; + build-flags = build-flags.dev; crossEnv = "musl64"; }) ]; @@ -171,7 +190,7 @@ ]; }).pkgsCross; - sysrootPackageListFn = crossEnv: pkgs: + sysrootPackageListFn = libc: pkgs: with pkgs; ([ customLibbsd @@ -185,15 +204,14 @@ libpcap numactl rdma-core - ] ++ (if crossEnv == "gnu64" then [ + ] ++ (if libc == "gnu64" then [ glibc glibc.out libgcc.libgcc glibc.dev glibc.static ] else - [ ]) ++ (if crossEnv == "musl64" then [ - mimalloc + [ ]) ++ (if libc == "musl64" then [ musl.out musl.dev ] else @@ -201,11 +219,11 @@ sysrootPackageList = { gnu64 = { - debug = sysrootPackageListFn "gnu64" pkgs.debug.gnu64; + dev = sysrootPackageListFn "gnu64" pkgs.dev.gnu64; release = sysrootPackageListFn "gnu64" pkgs.release.gnu64; }; musl64 = { - debug = sysrootPackageListFn "musl64" pkgs.debug.musl64; + dev = sysrootPackageListFn "musl64" pkgs.dev.musl64; release = sysrootPackageListFn "musl64" pkgs.release.musl64; }; }; @@ -215,21 +233,21 @@ inherit targets extensions; }); - # Don't add in a shell here or it may override the shell in the - # dev-env container - # We can just add bash to the complete environment at the end - compileEnvPackageList = (with toolchainPkgs; [ + compileEnvPackageList = with toolchainPkgs; [ + (toolchainPkgs.callPackage ./nix/shell-fixup {}) + bash-completion + bashInteractive cacert + cargo-nextest coreutils - glibc.static # for linking the tests just + libcap # for test runner llvmPackages.clang llvmPackages.libclang.lib llvmPackages.lld rust-toolchain - sysroot - cargo-nextest - ]); + sudo # for test runner + ]; docEnvPackageList = [tmpdir] ++ (with toolchainPkgs; [ (callPackage ./nix/mdbook-alerts {}) @@ -245,77 +263,22 @@ plantuml # needed for mdbook-plantuml to work (runtime exe dep) ]); - devEnvPackageList = compileEnvPackageList ++ docEnvPackageList ++ [ tmpdir usr shell-fixup ] - ++ (with toolchainPkgs; [ - bash-completion - bashInteractive - cacert - coreutils - curl - docker-client - ethtool - findutils - freetype # for jetbrains - gawk - gdb - gettext # for envsubst - git - glibc - glibc.bin # for ldd - gnugrep - gnused - gnutar - gzip - htop - hwloc - iproute2 - jq - just - less - libcap - llvmPackages.bintools-unwrapped - llvmPackages.clang - llvmPackages.libclang.lib - llvmPackages.lld - llvmPackages.lldb - numactl - openssh # for git - openssl.all # for git - pam.out # for sudo - pciutils - pcre.out # for jetbrains - pcre2.out # for jetbrains - procps # for jetbrains - ps # for jetbrains - stdenv.cc.cc.lib # for github ci - strace - sudo - unzip # for jetbrains - util-linux - vim - wget - xorg.libXext # for jetbrains - xorg.libXi # for jetbrains - xorg.libXrender # for jetbrains - xorg.libXtst # for jetbrains - ]); - env = { - sysroot.gnu64.debug = toolchainPkgs.symlinkJoin { - name = "${project-name}-env-debug-sysroot-gnu64"; - paths = sysrootPackageList.gnu64.debug; + sysroot.gnu64.dev = toolchainPkgs.symlinkJoin { + name = "${project-name}-env-dev-sysroot-gnu64"; + paths = sysrootPackageListFn "gnu64" pkgs.dev.gnu64; }; sysroot.gnu64.release = toolchainPkgs.symlinkJoin { name = "${project-name}-env-release-sysroot-gnu64"; - paths = sysrootPackageList.gnu64.release; + paths = sysrootPackageListFn "gnu64" pkgs.release.gnu64; }; - sysroot.musl64.debug = toolchainPkgs.symlinkJoin { - name = "${project-name}-env-debug-sysroot-musl64"; - paths = sysrootPackageList.musl64.debug; + sysroot.musl64.dev = toolchainPkgs.symlinkJoin { + name = "${project-name}-env-dev-sysroot-musl64"; + paths = sysrootPackageListFn "musl64" pkgs.dev.musl64; }; sysroot.musl64.release = toolchainPkgs.symlinkJoin { name = "${project-name}-env-release-sysroot-musl64"; - paths = sysrootPackageList.musl64.release; + paths = sysrootPackageListFn "musl64" pkgs.release.musl64; }; compile = toolchainPkgs.symlinkJoin { name = "${project-name}-env-compile"; @@ -325,29 +288,36 @@ name = "${project-name}-doc"; paths = docEnvPackageList; }; - dev = toolchainPkgs.symlinkJoin { - name = "${project-name}-toolchain"; - paths = devEnvPackageList; - }; }; - sysroot = toolchainPkgs.stdenv.mkDerivation { - name = "${project-name}-sysroot"; + sysrootFn = libc: profile: let libcShortName = (if libc == "gnu64" then "gnu" else "musl"); in + toolchainPkgs.stdenv.mkDerivation { + name = "${project-name}-sysroot.${libc}.${profile}"; + nativeBuildInputs = [toolchainPkgs.rsync]; src = null; dontUnpack = true; installPhase = '' - mkdir --parent "$out/sysroot/x86_64-unknown-linux-"{musl,gnu}/{debug,release} - cp -r "${env.sysroot.gnu64.debug}"/* "$out/sysroot/x86_64-unknown-linux-gnu/debug" - cp -r "${env.sysroot.gnu64.release}"/* "$out/sysroot/x86_64-unknown-linux-gnu/release" - cp -r "${env.sysroot.musl64.debug}"/* "$out/sysroot/x86_64-unknown-linux-musl/debug" - cp -r "${env.sysroot.musl64.release}"/* "$out/sysroot/x86_64-unknown-linux-musl/release" - ln -s /nix "$out/sysroot/x86_64-unknown-linux-gnu/debug" - ln -s /nix "$out/sysroot/x86_64-unknown-linux-gnu/release" - ln -s /nix "$out/sysroot/x86_64-unknown-linux-musl/debug" - ln -s /nix "$out/sysroot/x86_64-unknown-linux-musl/release" + mkdir --parent "$out/sysroot/x86_64-unknown-linux-${libcShortName}/${profile}/"{lib,include} + rsync -rLhP \ + "${env.sysroot.${libc}.${profile}}/lib/" \ + "$out/sysroot/x86_64-unknown-linux-${libcShortName}/${profile}/lib/" + rsync -rLhP \ + "${env.sysroot.${libc}.${profile}}/include/" \ + "$out/sysroot/x86_64-unknown-linux-${libcShortName}/${profile}/include/" ''; + # Rust can't decided if the profile is called dev or debug so we need a fixup + postFixup = if profile == "dev" then '' + ln -s dev $out/sysroot/x86_64-unknown-linux-${libcShortName}/debug + '' else ""; }; + sysroot.gnu64.dev = sysrootFn "gnu64" "dev"; + sysroot.gnu64.release = sysrootFn "gnu64" "release"; + sysroot.musl64.dev = sysrootFn "musl64" "dev"; + sysroot.musl64.release = sysrootFn "musl64" "release"; + + sysroots = with sysroot; [ gnu64.dev gnu64.release musl64.dev musl64.release ]; + tmpdir = toolchainPkgs.stdenv.mkDerivation { name = "${project-name}-tmpdir"; src = null; @@ -357,39 +327,18 @@ ''; }; - usr = toolchainPkgs.stdenv.mkDerivation { - name = "${project-name}-usr-bin"; - src = null; - dontUnpack = true; - installPhase = '' - mkdir --parent "$out"/{usr,lib} - ln -s /bin "$out/usr/bin" - ln -s /lib "$out/usr/lib" - ''; - }; - - shell-fixup = toolchainPkgs.callPackage ./nix/shell-fixup {}; + clearDeps = obj: with builtins; ( + /. + "${unsafeDiscardStringContext(unsafeDiscardOutputDependency(obj))}" + ); maxLayers = 120; container = { compile-env = toolchainPkgs.dockerTools.buildLayeredImage { - name = "${contianer-repo}/compile-env"; - tag = "${image-tag}"; - contents = [ toolchainPkgs.bash ] ++ compileEnvPackageList; - inherit maxLayers; - config = { - Cmd = [ "/bin/sh" ]; - WorkingDir = "/"; - Env = [ - "COMPILE_ENV=/" - "LD_LIBRARY_PATH=/lib" - "LIBCLANG_PATH=/lib" - "PATH=/bin" - "SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt" - "SYSROOT=/sysroot" - ]; - }; + name = "${contianer-repo}/compile-env"; + tag = "${image-tag}"; + contents = [ env.compile ] ++ (map clearDeps sysroots); + inherit maxLayers; }; doc-env = toolchainPkgs.dockerTools.buildLayeredImage { name = "${contianer-repo}/doc-env"; @@ -406,23 +355,5 @@ ]; }; }; - dev-env = toolchainPkgs.dockerTools.buildLayeredImage { - name = "${contianer-repo}/dev-env"; - tag = "${image-tag}"; - contents = [ env.dev ]; - config = { - Cmd = [ "/bin/bash" ]; - WorkingDir = "/"; - Env = [ - "COMPILE_ENV=/" - "LD_LIBRARY_PATH=/lib:/lib/openjdk/lib" - "LIBCLANG_PATH=/lib" - "PATH=/bin:/lib/openjdk/bin" - "SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt" - "SYSROOT=/sysroot" - ]; - }; - inherit maxLayers; - }; }; } diff --git a/justfile b/justfile index ce08659..8b5e65d 100644 --- a/justfile +++ b/justfile @@ -62,10 +62,6 @@ _branch := `git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9]/-/g'` _slug := (if _clean == "clean" { "" } else { "dirty-_-" }) + _branch -# The name of the dev-env container - -_dev_env_container_name := container_repo + "/dev-env" - # The name of the doc-env container _doc_env_container_name := container_repo + "/doc-env" @@ -118,7 +114,7 @@ _nix_build attribute: # Build only the sysroot [script] -build-sysroot: (_nix_build "env.sysroot.gnu64.debug") (_nix_build "env.sysroot.gnu64.release") (_nix_build "env.sysroot.musl64.debug") (_nix_build "env.sysroot.musl64.release") (_nix_build "sysroot") +build-sysroot: (_nix_build "sysroots") (_nix_build "env.sysroot.gnu64.dev") (_nix_build "env.sysroot.gnu64.release") (_nix_build "env.sysroot.musl64.dev") (_nix_build "env.sysroot.musl64.release") (_nix_build "sysroot") {{ _just_debug_ }} # Builds and post processes a container from the nix build @@ -132,10 +128,10 @@ _build-container target container-name: (_nix_build ("container." + target)) docker load --input /tmp/dpdk-sys/builds/container.{{ target }} docker tag \ "{{ container-name }}:{{ _build-id }}" \ - "{{ container-name }}:{{ _slug }}-rust-{{ rust }}" + "{{ container-name }}:{{ _slug }}.rust-{{ rust }}" docker tag \ "{{ container-name }}:{{ _build-id }}" \ - "{{ container-name }}:{{ _commit }}-rust-{{ rust }}" + "{{ container-name }}:{{ _commit }}.rust-{{ rust }}" docker build \ --label "git.commit={{ _commit }}" \ --label "git.branch={{ _branch }}" \ @@ -164,42 +160,36 @@ _build-container target container-name: (_nix_build ("container." + target)) --label "nixpkgs.hash.tar.blake2b512=$(nix eval --raw -f '{{ versions }}' 'nixpkgs.hash.tar.blake2b512')" \ --label "nixpkgs.hash.tar.blake2s256=$(nix eval --raw -f '{{ versions }}' 'nixpkgs.hash.tar.blake2s256')" \ --label "versions.json=$(nix eval --json -f '{{ versions }}')" \ - --build-arg TAG="{{ _build-id }}" \ + --build-arg IMAGE="{{ container-name }}:{{ _build-id }}" \ --tag "{{ container-name }}:post-{{ _build-id }}" \ - --target "{{ target }}" \ -f Dockerfile \ . docker tag \ "{{ container-name }}:post-{{ _build-id }}" \ - "{{ container-name }}:{{ _slug }}-rust-{{ rust }}" + "{{ container-name }}:{{ _slug }}.rust-{{ rust }}" docker tag \ "{{ container-name }}:post-{{ _build-id }}" \ - "{{ container-name }}:{{ _commit }}-rust-{{ rust }}" + "{{ container-name }}:{{ _commit }}.rust-{{ rust }}" docker rmi "{{ container-name }}:{{ _build-id }}" docker rmi "{{ container-name }}:post-{{ _build-id }}" -# Build and tag the dev-env container -build-dev-env-container: (_build-container "dev-env" _dev_env_container_name) - # Build and tag the doc-env container build-doc-env-container: (_build-container "doc-env" _doc_env_container_name) -# Build and tag the dev-env container +# Build and tag the compile-env container build-compile-env-container: (_build-container "compile-env" _compile_env_container_name) -# Build the sysroot, compile-env, and dev-env containers -build: build-sysroot build-compile-env-container build-dev-env-container build-doc-env-container +# Build the sysroot, and compile-env containers +build: build-sysroot build-compile-env-container build-doc-env-container -# Push the compile-env and dev-env containers to the container registry +# Push the compile-env and doc-env containers to the container registry [script] push: build {{ _just_debug_ }} - docker push "{{ _compile_env_container_name }}:{{ _slug }}-rust-{{ rust }}" - docker push "{{ _compile_env_container_name }}:{{ _commit }}-rust-{{ rust }}" - docker push "{{ _dev_env_container_name }}:{{ _slug }}-rust-{{ rust }}" - docker push "{{ _dev_env_container_name }}:{{ _commit }}-rust-{{ rust }}" - docker push "{{ _doc_env_container_name }}:{{ _slug }}-rust-{{ rust }}" - docker push "{{ _doc_env_container_name }}:{{ _commit }}-rust-{{ rust }}" + docker push "{{ _compile_env_container_name }}:{{ _slug }}.rust-{{ rust }}" + docker push "{{ _compile_env_container_name }}:{{ _commit }}.rust-{{ rust }}" + docker push "{{ _doc_env_container_name }}:{{ _slug }}.rust-{{ rust }}" + docker push "{{ _doc_env_container_name }}:{{ _commit }}.rust-{{ rust }}" # Delete all the old generations of the nix store and run the garbage collector [script] @@ -223,4 +213,4 @@ generate-todo-list param=".": [script] bump dpdk_sys_branch="main": {{ _just_debug_ }} - ./scripts/bump.sh {{dpdk_sys_branch}} + ./scripts/bump.sh {{ dpdk_sys_branch }} diff --git a/nix/dpdk-wrapper/src/dpdk_wrapper.h b/nix/dpdk-wrapper/src/dpdk_wrapper.h index 6315489..1227942 100644 --- a/nix/dpdk-wrapper/src/dpdk_wrapper.h +++ b/nix/dpdk-wrapper/src/dpdk_wrapper.h @@ -133,43 +133,6 @@ #include #include -//int const rte_get_errno(); - -//enum rte_eth_tx_offload: uint64_t { -// VLAN_INSERT = RTE_ETH_TX_OFFLOAD_VLAN_INSERT, -// IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_IPV4_CKSUM, -// UDP_CKSUM = RTE_ETH_TX_OFFLOAD_UDP_CKSUM, -// TCP_CKSUM = RTE_ETH_TX_OFFLOAD_TCP_CKSUM, -// SCTP_CKSUM = RTE_ETH_TX_OFFLOAD_SCTP_CKSUM, -// TCP_TSO = RTE_ETH_TX_OFFLOAD_TCP_TSO, -// UDP_TSO = RTE_ETH_TX_OFFLOAD_UDP_TSO, -// OUTER_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, -// QINQ_INSERT = RTE_ETH_TX_OFFLOAD_QINQ_INSERT, -// VXLAN_TNL_TSO = RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO, -// GRE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO, -// IPIP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO, -// GENEVE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO, -// MACSEC_INSERT = RTE_ETH_TX_OFFLOAD_MACSEC_INSERT, -//}; - -//enum rte_flow_port_flag: uint32_t { -// /** -// * Indicate all operations for a given flow rule will _strictly_ -// * happen on the same queue (create/destroy/query/update). -// */ -// STRICT_QUEUE = RTE_FLOW_PORT_FLAG_STRICT_QUEUE, -// -// /** -// * Indicate all steering objects should be created on contexts -// * of the host port, providing indirect object sharing between -// * ports. -// */ -// SHARE_INDIRECT = RTE_FLOW_PORT_FLAG_SHARE_INDIRECT -//}; - - - - // Things which are either duplicated, totally inapplicable or not needed //#include //#include @@ -226,20 +189,6 @@ __rte_hot __rte_warn_unused_result int wrte_errno(); -///** -// * DPDK specific error codes. -// * -// * I wrapped these because the original enum is anonymous (this irritates me). -// */ -//enum wrte_errno : uint32_t { -// RTE_MIN_ERRNO = __ELASTERROR, /**< Start numbering above std errno vals */ -// -// E_RTE_SECONDARY, /**< Operation not allowed in secondary processes */ -// E_RTE_NO_CONFIG, /**< Missing rte_config */ -// -// RTE_MAX_ERRNO /**< Max RTE error number */ -//}; - /** * TX offloads to be set in [`rte_eth_tx_mode.offloads`]. * @@ -250,20 +199,49 @@ int wrte_errno(); * notation with `uint64_t` seen here.). */ enum wrte_eth_tx_offload: uint64_t { - VLAN_INSERT = RTE_ETH_TX_OFFLOAD_VLAN_INSERT, - IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_IPV4_CKSUM, - UDP_CKSUM = RTE_ETH_TX_OFFLOAD_UDP_CKSUM, - TCP_CKSUM = RTE_ETH_TX_OFFLOAD_TCP_CKSUM, - SCTP_CKSUM = RTE_ETH_TX_OFFLOAD_SCTP_CKSUM, - TCP_TSO = RTE_ETH_TX_OFFLOAD_TCP_TSO, - UDP_TSO = RTE_ETH_TX_OFFLOAD_UDP_TSO, - OUTER_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, - QINQ_INSERT = RTE_ETH_TX_OFFLOAD_QINQ_INSERT, - VXLAN_TNL_TSO = RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO, - GRE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO, - IPIP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO, - GENEVE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO, - MACSEC_INSERT = RTE_ETH_TX_OFFLOAD_MACSEC_INSERT, + TX_OFFLOAD_VLAN_INSERT = RTE_ETH_TX_OFFLOAD_VLAN_INSERT, + TX_OFFLOAD_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_IPV4_CKSUM, + TX_OFFLOAD_UDP_CKSUM = RTE_ETH_TX_OFFLOAD_UDP_CKSUM, + TX_OFFLOAD_TCP_CKSUM = RTE_ETH_TX_OFFLOAD_TCP_CKSUM, + TX_OFFLOAD_SCTP_CKSUM = RTE_ETH_TX_OFFLOAD_SCTP_CKSUM, + TX_OFFLOAD_TCP_TSO = RTE_ETH_TX_OFFLOAD_TCP_TSO, + TX_OFFLOAD_UDP_TSO = RTE_ETH_TX_OFFLOAD_UDP_TSO, + TX_OFFLOAD_OUTER_IPV4_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, + TX_OFFLOAD_QINQ_INSERT = RTE_ETH_TX_OFFLOAD_QINQ_INSERT, + TX_OFFLOAD_VXLAN_TNL_TSO = RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO, + TX_OFFLOAD_GRE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO, + TX_OFFLOAD_IPIP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO, + TX_OFFLOAD_GENEVE_TNL_TSO = RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO, + TX_OFFLOAD_MACSEC_INSERT = RTE_ETH_TX_OFFLOAD_MACSEC_INSERT, + TX_OFFLOAD_MT_LOCKFREE = RTE_ETH_TX_OFFLOAD_MT_LOCKFREE, + TX_OFFLOAD_MULTI_SEGS = RTE_ETH_TX_OFFLOAD_MULTI_SEGS, + TX_OFFLOAD_MBUF_FAST_FREE = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE, + TX_OFFLOAD_SECURITY = RTE_ETH_TX_OFFLOAD_SECURITY, + TX_OFFLOAD_UDP_TNL_TSO = RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO, + TX_OFFLOAD_IP_TNL_TSO = RTE_ETH_TX_OFFLOAD_IP_TNL_TSO, + TX_OFFLOAD_OUTER_UDP_CKSUM = RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM, + TX_OFFLOAD_SEND_ON_TIMESTAMP = RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP +}; + +enum wrte_eth_rx_offload: uint64_t { + RX_OFFLOAD_VLAN_STRIP = RTE_ETH_RX_OFFLOAD_VLAN_STRIP, + RX_OFFLOAD_IPV4_CKSUM = RTE_ETH_RX_OFFLOAD_IPV4_CKSUM, + RX_OFFLOAD_UDP_CKSUM = RTE_ETH_RX_OFFLOAD_UDP_CKSUM, + RX_OFFLOAD_TCP_CKSUM = RTE_ETH_RX_OFFLOAD_TCP_CKSUM, + RX_OFFLOAD_TCP_LRO = RTE_ETH_RX_OFFLOAD_TCP_LRO, + RX_OFFLOAD_QINQ_STRIP = RTE_ETH_RX_OFFLOAD_QINQ_STRIP, + RX_OFFLOAD_OUTER_IPV4_CKSUM = RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, + RX_OFFLOAD_MACSEC_STRIP = RTE_ETH_RX_OFFLOAD_MACSEC_STRIP, + RX_OFFLOAD_VLAN_FILTER = RTE_ETH_RX_OFFLOAD_VLAN_FILTER, + RX_OFFLOAD_VLAN_EXTEND = RTE_ETH_RX_OFFLOAD_VLAN_EXTEND, + RX_OFFLOAD_SCATTER = RTE_ETH_RX_OFFLOAD_SCATTER, + RX_OFFLOAD_TIMESTAMP = RTE_ETH_RX_OFFLOAD_TIMESTAMP, + RX_OFFLOAD_SECURITY = RTE_ETH_RX_OFFLOAD_SECURITY, + RX_OFFLOAD_KEEP_CRC = RTE_ETH_RX_OFFLOAD_KEEP_CRC, + RX_OFFLOAD_SCTP_CKSUM = RTE_ETH_RX_OFFLOAD_SCTP_CKSUM, + RX_OFFLOAD_OUTER_UDP_CKSUM = RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM, + RX_OFFLOAD_RSS_HASH = RTE_ETH_RX_OFFLOAD_RSS_HASH, + RX_OFFLOAD_BUFFER_SPLIT = RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT, }; diff --git a/nix/flags.nix b/nix/flags.nix index 4ca9430..bfd8eac 100644 --- a/nix/flags.nix +++ b/nix/flags.nix @@ -5,7 +5,7 @@ LDFLAGS="-Wl,-O3 -Wl,--gc-sections -Wl,-z,relro,-z,now -Wl,--thinlto-jobs=1 -Wl,-plugin-opt,jobs=1 -Qunused-arguments"; }; - debug = rec { + dev = rec { CFLAGS="-Og -ggdb3 -fno-inline -Qunused-arguments"; CXXFLAGS=CFLAGS; LDFLAGS=""; diff --git a/nix/versions.nix b/nix/versions.nix index 7756e68..135af90 100644 --- a/nix/versions.nix +++ b/nix/versions.nix @@ -40,9 +40,7 @@ extensions = [ "cargo" "clippy" - "rust-src" "rust-std" - "rustfmt" ]; }; }; diff --git a/nix/versions.nix.template b/nix/versions.nix.template index cb54137..3a9390a 100644 --- a/nix/versions.nix.template +++ b/nix/versions.nix.template @@ -40,9 +40,7 @@ extensions = [ "cargo" "clippy" - "rust-src" "rust-std" - "rustfmt" ]; }; };