diff --git a/.cargo/config.toml b/.cargo/config.toml index 5cafed729..99fc2352e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,13 +1,10 @@ [env] -COMPILE_ENV = { value = "compile-env", relative = true, force = false } -PATH = { value = "compile-env/bin", relative = true, force = true } -LIBCLANG_PATH = { value = "compile-env/lib", relative = true, force = true } -PKG_CONFIG_PATH = { value = "compile-env/sysroot/x86_64-unknown-linux-gnu/release/lib/pkgconfig", relative = true, force = true } +DATAPLANE_SYSROOT = { value = "sysroot", relative = true, force = false } +C_INCLUDE_PATH = { value = "sysroot/include", relative = true, force = false } +LIBRARY_PATH = { value = "sysroot/lib", relative = true, force = false } +PKG_CONFIG_PATH = { value = "sysroot/lib/pkgconfig", relative = true, force = false } +GW_CRD_PATH = { value = "devroot/src/gateway/config/crd/bases", relative = true, force = false } +LIBCLANG_PATH = { value = "devroot/lib", relative = true, force = false } [build] -target = "x86_64-unknown-linux-gnu" -rustc = "compile-env/bin/rustc" -rustflags = ["--cfg", "tokio_unstable"] - -[target.x86_64-unknown-linux-gnu] -runner = ["scripts/test-runner.sh"] +rustflags = ["--cfg=tokio_unstable"] diff --git a/.cargo/cross/aarch64/gnu.toml b/.cargo/cross/aarch64/gnu.toml new file mode 100644 index 000000000..fce26c56a --- /dev/null +++ b/.cargo/cross/aarch64/gnu.toml @@ -0,0 +1,8 @@ +[env] +CC = { value = "aarch64-unknown-linux-gnu-clang", relative = false, force = true } + +[build] +target = "aarch64-unknown-linux-gnu" + +[target.aarch64-unknown-linux-gnu] +rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/cross/aarch64/musl.toml b/.cargo/cross/aarch64/musl.toml new file mode 100644 index 000000000..173243792 --- /dev/null +++ b/.cargo/cross/aarch64/musl.toml @@ -0,0 +1,8 @@ +[env] +CC = { value = "aarch64-unknown-linux-musl-clang", relative = false, force = true } + +[build] +target = "aarch64-unknown-linux-musl" + +[target.aarch64-unknown-linux-musl] +rustflags = ["--cfg=tokio_unstable", "-Clinker=aarch64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/cross/x86_64/gnu.toml b/.cargo/cross/x86_64/gnu.toml new file mode 100644 index 000000000..ce5b95740 --- /dev/null +++ b/.cargo/cross/x86_64/gnu.toml @@ -0,0 +1,8 @@ +[env] +CC = { value = "x86_64-unknown-linux-gnu-clang", relative = false, force = true } + +[build] +target = "x86_64-unknown-linux-gnu" + +[target.x86_64-unknown-linux-gnu] +rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-gnu-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.cargo/cross/x86_64/musl.toml b/.cargo/cross/x86_64/musl.toml new file mode 100644 index 000000000..17985dc60 --- /dev/null +++ b/.cargo/cross/x86_64/musl.toml @@ -0,0 +1,8 @@ +[env] +CC = { value = "x86_64-unknown-linux-musl-clang", relative = false, force = true } + +[build] +target = "x86_64-unknown-linux-musl" + +[target.x86_64-unknown-linux-musl] +rustflags = ["--cfg=tokio_unstable", "-Clinker=x86_64-unknown-linux-musl-clang", "-Clink-arg=-fuse-ld=lld"] diff --git a/.clangd b/.clangd new file mode 120000 index 000000000..748224bb4 --- /dev/null +++ b/.clangd @@ -0,0 +1 @@ +devroot/.clangd \ No newline at end of file diff --git a/.config/nix/nix.conf b/.config/nix/nix.conf new file mode 100644 index 000000000..145e6ce59 --- /dev/null +++ b/.config/nix/nix.conf @@ -0,0 +1,5 @@ +max-jobs = 4 +experimental-features = nix-command +substituters = https://dnoland-test-cache.cachix.org/ https://cache.nixos.org https://cache.nixos.org/ +trusted-public-keys = dnoland-test-cache.cachix.org-1:AsVLS3c7NGIJbUHW5xOlK69zPEzY5jNF+ax0jd1LKUA= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= +always-allow-substitutes = true diff --git a/.envrc b/.envrc deleted file mode 100644 index 41bfc8c5d..000000000 --- a/.envrc +++ /dev/null @@ -1,46 +0,0 @@ -export PROJECT_DIR="$(pwd)" - -if [ -h "${PROJECT_DIR}/compile-env" ] || [ -d "${PROJECT_DIR}/compile-env" ]; then - export PATH="${PROJECT_DIR}/compile-env/bin:$PATH" - export LIBCLANG_PATH="${PROJECT_DIR}/compile-env/bin" - export COMPILE_ENV="${PROJECT_DIR}/compile-env" -else - >&2 echo "no compile environment found" - exit 0 -fi - -export NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 - -CRT="-C target-feature=-crt-static" -DEBUG="-C debuginfo=full -C split-debuginfo=off -C dwarf-version=5" -LINKER="-C linker=${COMPILE_ENV}/bin/clang -C link-arg=--ld-path=${COMPILE_ENV}/bin/ld.lld" -RELRO="-C relro-level=full" -TARGET_CPU="-C target-cpu=x86-64-v3" - -RUSTFLAGS="${CRT} ${DEBUG} ${LINKER} ${RELRO} ${TARGET_CPU}" - -OPTIMIZE="-C opt-level=3 -C linker-plugin-lto -C lto=thin -C embed-bitcode=yes -C codegen-units=1" - -case ${PROFILE:-DEBUG} in - fuzz|FUZZ) - COVERAGE="-C instrument-coverage" - DEBUG_ASSERTIONS="-C debug-assertions=on" - OVERFLOW_CHECK="-C overflow-checks=on" - RUSTFLAGS="${RUSTFLAGS} ${COVERAGE} ${DEBUG_ASSERTIONS} ${OVERFLOW_CHECK}" - ;; - release|RELEASE) - RUSTFLAGS="${RUSTFLAGS} ${OPTIMIZE}" - ;; - debug|DEBUG) - DEBUG_ASSERTIONS="-C debug-assertions=on" - OPTIMIZE="-C opt-level=0" - OVERFLOW_CHECK="-C overflow-checks=on" - RUSTFLAGS="${RUSTFLAGS} ${OPTIMIZE} ${DEBUG_ASSERTIONS} ${OVERFLOW_CHECK}" - ;; - *) - >&2 echo "unknown profile" - exit 1 - ;; -esac - -export RUSTFLAGS diff --git a/.envrc.old b/.envrc.old new file mode 100644 index 000000000..319e53249 --- /dev/null +++ b/.envrc.old @@ -0,0 +1,12 @@ +export PROJECT_DIR="$(pwd)" + +if [ -h "${PROJECT_DIR}/compile-env" ] || [ -d "${PROJECT_DIR}/compile-env" ]; then + export LIBCLANG_PATH="${PROJECT_DIR}/compile-env/bin" + export COMPILE_ENV="${PROJECT_DIR}/compile-env" +else + >&2 echo "no compile environment found" + exit 0 +fi + +export NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 +unset RUSTFLAGS diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml deleted file mode 100644 index f6704646b..000000000 --- a/.github/workflows/dev.yml +++ /dev/null @@ -1,618 +0,0 @@ -# The primary point of this workflow is to ensure that the developer experience is good. -# We take a very vanilla ubuntu image, install all necessary dependencies via "normal" means, -# and then run the build and test steps as described in the README.md file. - -# The artifacts produced by these builds are not intended to be used for anything other than -# ensuring that the developer experience is good. - -# Production artifacts are produced in a sterile environment (in another CI workflow). - -name: "dev.yml" - -on: - pull_request: {} - push: - branches: - - "main" - tags: - - "v*" - merge_group: - types: ["checks_requested"] - workflow_dispatch: - inputs: - debug_enabled: - type: "boolean" - description: "Run with tmate enabled" - required: false - default: false - debug_justfile: - type: "boolean" - description: "enable to see debug statements from just recipes" - required: false - default: false - skip_vlab_tests: - type: "boolean" - description: "Skip VLAB tests (they run by default)" - required: false - default: false - run_hlab_tests: - type: "boolean" - description: "Run hybrid HLAB tests" - required: false - default: false - enable_release_tests: - type: "boolean" - description: "Enable release tests for VLAB/HLAB tests" - required: false - default: false - -concurrency: - group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" - cancel-in-progress: true - -permissions: - contents: "read" - packages: "write" - id-token: "write" - -jobs: - check_changes: - name: "Deduce required tests from code changes" - permissions: - contents: "read" - pull-requests: "read" - runs-on: "ubuntu-latest" - outputs: - devfiles: "${{ steps.changes.outputs.devfiles }}" - steps: - - name: "Checkout" - if: "${{ !github.event.pull_request }}" - uses: "actions/checkout@v6" - with: - persist-credentials: "false" - fetch-depth: "0" - - name: "Check code changes" - uses: "dorny/paths-filter@v3" - id: "changes" - with: - filters: | - devfiles: - - '!(README.md|LICENSE|.gitattributes|.gitignore|.github/**)' - - '.github/workflows/dev.yml' - - version: - runs-on: lab - - permissions: - contents: read - - outputs: - version: "${{ steps.version-gen.outputs.version }}" - ref: "${{ steps.version-gen.outputs.ref }}" - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Generate temp artifacts version - id: version-gen - env: - commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} - run: | - echo "version=v0-${commit_sha::9}" >> "$GITHUB_OUTPUT" - echo "ref=${commit_sha}" >> "$GITHUB_OUTPUT" - - check: - env: - CACHE_REGISTRY: "run.h.hhdev.io:30000" - UPSTREAM_REGISTRY: "ghcr.io" - needs: - - check_changes - - version - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" - permissions: - checks: "write" - pull-requests: "write" - contents: "read" - packages: "write" - id-token: "write" - strategy: - fail-fast: false - matrix: - profile: - - name: "debug" - sterile: "" - - name: "debug" - sterile: "sterile" - - name: "release" - sterile: "sterile" - - name: "fuzz" - sterile: "sterile" - #- name: "release" - # sterile: "" - #- name: "fuzz" - # sterile: "" - debug_justfile: - - "${{ inputs.debug_justfile || false }}" - name: "${{matrix.profile.name}} ${{matrix.profile.sterile}}" - runs-on: "lab" - timeout-minutes: 45 - steps: - - name: "login to ghcr.io" - uses: "docker/login-action@v3" - with: - registry: "${{ env.UPSTREAM_REGISTRY }}" - username: "${{ github.actor }}" - password: "${{ secrets.GITHUB_TOKEN }}" - - - name: "login to image cache" - uses: "docker/login-action@v3" - with: - registry: "${{ env.CACHE_REGISTRY }}" - username: "${{ secrets.LAB_REGISTRY_USERNAME }}" - password: "${{ secrets.LAB_REGISTRY_TOKEN }}" - - # it's temporarily needed to install skopeo - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: stable - cache: true - - - name: "Checkout" - uses: "actions/checkout@v6" - with: - persist-credentials: "false" - fetch-depth: "0" - - - name: "install just" - run: | - # this keeps our GH actions logs from getting messed up with color codes - echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list - sudo apt-get update - sudo apt-get install --yes --no-install-recommends just - - - name: "set up build environment" - run: | - REQUIRED_HUGEPAGES=512 - HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages - docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" - docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" - docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" - just --yes \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - refresh-compile-env - just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix - - - name: "cargo deny check" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo deny check - - - name: "push container" - if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ - target=x86_64-unknown-linux-gnu \ - version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ - oci_repo="ghcr.io" \ - push - - - name: "print container image name" - if: ${{ matrix.profile.sterile == 'sterile' && (matrix.profile.name == 'release' || matrix.profile.name == 'debug') }} - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - version=${{ needs.version.outputs.version }}-${{ matrix.profile.name }} \ - oci_repo="ghcr.io" \ - print-container-tags - - - name: "Check for uncommitted changes" - run: | - git diff --exit-code - if [ $? -ne 0 ]; then - echo "::error::Uncommitted changes detected:" - git diff - exit 1 - fi - echo "No uncommitted changes found" - - - name: "Check for untracked files" - run: | - if [ -n "$(git ls-files --others --exclude-standard)" ]; then - echo "::error::Untracked files detected:" - git ls-files --others --exclude-standard - exit 1 - fi - echo "No untracked files found" - - - id: "test" - name: "test" - run: | - set -euo pipefail - mkdir --parent ./target/nextest - # Run tests. The resulting results.json is not a full JSON object but - # a list of JSON objects, one per line. - if [ ${{ matrix.profile.name }} = "fuzz" ]; then - echo "::notice::Running fuzz tests" - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} coverage \ - --status-level=none \ - --final-status-level=skip \ - --message-format=libtest-json-plus > ./results.json - else - echo "::notice::Running regular tests" - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo nextest run \ - --cargo-profile=${{matrix.profile.name}} \ - --status-level=none \ - --final-status-level=skip \ - --message-format=libtest-json-plus \ - > ./results.json - echo "::notice::Running Shuttle tests" - # We need to rebuild using the shuttle feature. To avoid running - # all tests a second time, we filter to run only tests with pattern - # "shuttle" in their name (test function name, file name, or module - # name). - # - # IF YOUR SHUTTLE TESTS DO NOT HAVE "shuttle" IN THEIR NAME, THEY - # WILL NOT RUN. - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - ${{matrix.profile.sterile}} cargo nextest run \ - --cargo-profile=${{matrix.profile.name}} \ - --status-level=none \ - --final-status-level=none \ - --message-format=libtest-json-plus \ - --features shuttle \ - shuttle \ - >> ./results.json - fi - # look for any flakes (flakes have a #\\d+ match in their name field) - jq \ - --raw-output \ - --slurp '.[] | select(.type == "test" and (.name | test(".*#\\d+"))) | ( .name | split("#") ) | - [.[0], (.[1] | tonumber)] | @csv - ' ./results.json > ./target/nextest/flakes.csv - if [ -s ./target/nextest/flakes.csv ]; then - { - echo "FLAKY_TESTS<> "${GITHUB_ENV}" - fi - rm results.json - - - name: "upload test results to codecov" - if: ${{ always() }} - uses: "codecov/codecov-action@v5" - with: - fail_ci_if_error: true - files: ./target/nextest/default/junit.xml - report_type: "test_results" - disable_search: "true" - use_oidc: "true" - verbose: true - flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" - - - name: "upload codecov analysis" - if: ${{ matrix.profile.name == 'fuzz' }} - uses: "codecov/codecov-action@v5" - with: - fail_ci_if_error: true - files: ./target/nextest/coverage/codecov.json - report_type: "coverage" - disable_search: "true" - use_oidc: "true" - verbose: true - flags: "${{matrix.profile.name}}-${{ matrix.profile.sterile || 'developer' }}" - - - name: "clean up coverage data" - run: | - rm -f codecov codecov.SHA256SUM codecov.SHA256SUM.sig - - - uses: "marocchino/sticky-pull-request-comment@v2" - if: ${{ always() }} - with: - header: "flakes_${{matrix.profile.name}}_${{matrix.profile.sterile}}" - ignore_empty: "true" - message: | - ${{ env.FLAKY_TESTS }} - - - name: "publish test report" - uses: "mikepenz/action-junit-report@v6" - if: "${{ always() }}" - with: - annotate_notice: "false" - annotate_only: "false" - check_annotations: "true" - check_retries: "false" - comment: "false" - detailed_summary: "true" - fail_on_failure: "false" - fail_on_parse_error: "true" - flaky_summary: "true" - include_empty_in_summary: "true" - include_passed: "true" - include_time_in_summary: "true" - report_paths: "target/nextest/default/*junit.xml" - require_passed_tests: "true" - require_tests: "true" - simplified_summary: "true" - truncate_stack_traces: "false" - group_reports: "true" - check_name: "test-report-${{matrix.profile.name}}-sterile:${{matrix.profile.sterile == 'sterile'}}" - skip_success_summary: "false" - job_summary: "true" - verbose_summary: "false" - - - id: "clippy" - name: "run clippy" - run: | - just debug_justfile="${{matrix.debug_justfile}}" profile=${{matrix.profile.name}} \ - ${{matrix.profile.sterile}} cargo clippy --all-targets --all-features -- -D warnings - - - id: "docs" - name: "run rustdoc" - run: | - RUSTDOCFLAGS="-D warnings" just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - ${{matrix.profile.sterile}} cargo doc --no-deps - - - name: "run doctests" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - target=x86_64-unknown-linux-gnu \ - ${{matrix.profile.sterile}} cargo test --doc - - - name: "Setup tmate session for debug" - if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - uses: "mxschmitt/action-tmate@v3" - timeout-minutes: 60 - with: - limit-access-to-actor: true - - vlab: - if: "${{ needs.check_changes.outputs.devfiles == 'true' || startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' }}" - needs: - - check - - version - - name: "${{ matrix.hybrid && 'h' || 'v' }}-${{ matrix.upgradefrom && 'up' || '' }}${{ matrix.upgradefrom }}${{ matrix.upgradefrom && '-' || '' }}${{ matrix.mesh && 'mesh-' || '' }}${{ matrix.gateway && 'gw-' || '' }}${{ matrix.includeonie && 'onie-' || '' }}${{ matrix.buildmode }}-${{ matrix.vpcmode }}" - - uses: githedgehog/fabricator/.github/workflows/run-vlab.yaml@master - with: - # ci:+hlab is required to enable hybrid lab tests on PR - # ci:-vlab disables virtual lab tests on PR - # ci:-upgrade disables upgrade tests on PR - # hlab is disabled for main and merge_queue till we have gateway tests for it - # upgrade jobs are temporarily skipped in merge_queue until we fix the issue with 25.05 - skip: >- - ${{ - github.event_name == 'pull_request' - && ( - matrix.hybrid && !contains(github.event.pull_request.labels.*.name, 'ci:+hlab') - || !matrix.hybrid && contains(github.event.pull_request.labels.*.name, 'ci:-vlab') - || matrix.upgradefrom != '' && contains(github.event.pull_request.labels.*.name, 'ci:-upgrade') - ) - - || github.event_name == 'workflow_dispatch' - && ( - matrix.hybrid && inputs.run_hlab_tests != true - || !matrix.hybrid && inputs.skip_vlab_tests == true - ) - - || (github.event_name == 'push' || github.event_name == 'merge_group') - && (matrix.hybrid || matrix.upgradefrom != '') - }} - fabricatorref: master - prebuild: "just bump dataplane ${{ needs.version.outputs.version }}-release" - fabricmode: ${{ matrix.fabricmode }} - gateway: ${{ matrix.gateway }} - gateway_agentless: true - includeonie: ${{ matrix.includeonie }} - buildmode: ${{ matrix.buildmode }} - vpcmode: ${{ matrix.vpcmode }} - releasetest: ${{ contains(github.event.pull_request.labels.*.name, 'ci:+release') || inputs.enable_release_tests == true }} - hybrid: ${{ matrix.hybrid }} - upgradefrom: ${{ matrix.upgradefrom }} - - strategy: - fail-fast: false - matrix: - fabricmode: - - spine-leaf - gateway: - - true - includeonie: - - false - buildmode: - - iso - vpcmode: - - l2vni - hybrid: - - false - upgradefrom: - - "" - - "25.05" - include: - # gateway l3vni - - fabricmode: spine-leaf - gateway: true - includeonie: false - buildmode: iso - vpcmode: l3vni - hybrid: false - upgradefrom: "" - - # hlab gateway l2vni - - fabricmode: spine-leaf - gateway: true - includeonie: false - buildmode: iso - vpcmode: l2vni - hybrid: true - upgradefrom: "" - - summary: - name: "Summary" - runs-on: "ubuntu-latest" - needs: - - check - - vlab - # Run always, except when the "check" job was skipped. - # - # When the check job is skipped, summary will be marked as skipped, and - # it's OK for CI (it's not a failure). - # Why don't we do the same for check jobs? Because their names depend on - # matrix values, and if we skip them the names won't be generated and - # GitHub won't be able to find skipped jobs for required status checks. - if: ${{ always() }} - steps: - - name: "Flag any check matrix failures" - if: ${{ needs.check.result != 'success' && needs.check.result != 'skipped' }} - run: | - echo '::error:: Some check job(s) failed' - exit 1 - - name: "Flag any vlab matrix failures" - if: ${{ needs.vlab.result != 'success' && needs.vlab.result != 'skipped' }} - run: | - echo '::error:: Some vlab job(s) failed' - exit 1 - - publish: - env: - CACHE_REGISTRY: "run.h.hhdev.io:30000" - UPSTREAM_REGISTRY: "ghcr.io" - runs-on: lab - if: startsWith(github.event.ref, 'refs/tags/v') && github.event_name == 'push' - needs: - - check - - vlab - - permissions: - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: stable - cache: true - - - name: Login to ghcr.io - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: "login to image cache" - uses: "docker/login-action@v3" - with: - registry: "${{ env.CACHE_REGISTRY }}" - username: "${{ secrets.LAB_REGISTRY_USERNAME }}" - password: "${{ secrets.LAB_REGISTRY_TOKEN }}" - - - name: "set up build environment" - run: | - REQUIRED_HUGEPAGES=512 - HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - OVERCOMMIT_HUGEPAGES_PATH=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages - docker run --privileged --rm busybox:latest sh -c "echo $((6 * REQUIRED_HUGEPAGES)) > $OVERCOMMIT_HUGEPAGES_PATH" - docker run --privileged --rm busybox:latest sh -c "echo $((2 * REQUIRED_HUGEPAGES)) > $HUGEPAGES_PATH" - docker pull "${{env.UPSTREAM_REGISTRY}}/githedgehog/testn/n-vm:v0.0.9" - just --yes \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=${{matrix.profile.name}} \ - dpdp_sys_registry="${{env.CACHE_REGISTRY}}" \ - refresh-compile-env - just --yes debug_justfile="${{matrix.debug_justfile}}" fake-nix - - - name: "push container" - run: | - just \ - debug_justfile="${{matrix.debug_justfile}}" \ - profile=release \ - dpdp_sys_registry="${{env.UPSTREAM_REGISTRY}}" \ - target=x86_64-unknown-linux-gnu \ - oci_repo="ghcr.io" \ - push - - # Bump dataplane in the fabricator repository - - - name: Checkout fabricator repository - uses: actions/checkout@v6 - with: - repository: githedgehog/fabricator - path: fab-repo - persist-credentials: false - - - name: Bump dataplane in fabricator - working-directory: fab-repo - run: | - sed -i "s/^\tDataplaneVersion.*/\tDataplaneVersion=meta.Version(\"${{ github.ref_name }}\")/" pkg/fab/versions.go - go fmt pkg/fab/versions.go - - - name: Generate token for the fabricator repository - uses: actions/create-github-app-token@v2 - id: fab-app-token - with: - app-id: ${{ secrets.FAB_APP_ID }} - private-key: ${{ secrets.FAB_PRIVATE_KEY }} - repositories: | - fabricator - - - name: Create Pull Request for fabricator - uses: peter-evans/create-pull-request@v8 - id: fab-pr - with: - token: ${{ steps.fab-app-token.outputs.token }} - path: fab-repo - branch: pr/auto/dataplane-bump - commit-message: | - bump: dataplane to ${{ github.ref_name }} - - This is an automated commit created by GitHub Actions workflow, - in the dataplane repository. - signoff: true - title: "bump: dataplane to ${{ github.ref_name }}" - body: | - This is an automated Pull Request created by GitHub Actions workflow, - in the dataplane repository. diff --git a/.github/workflows/scratch.yml b/.github/workflows/scratch.yml new file mode 100644 index 000000000..36f8ed521 --- /dev/null +++ b/.github/workflows/scratch.yml @@ -0,0 +1,172 @@ +name: "scratch.yml" + +on: + pull_request: {} + push: + branches: + - "main" + tags: + - "v*" + merge_group: + types: ["checks_requested"] + workflow_dispatch: + inputs: + debug_enabled: + type: "boolean" + description: "Run with tmate enabled" + required: false + default: false + debug_justfile: + type: "boolean" + description: "enable to see debug statements from just recipes" + required: false + default: false + skip_vlab_tests: + type: "boolean" + description: "Skip VLAB tests (they run by default)" + required: false + default: false + run_hlab_tests: + type: "boolean" + description: "Run hybrid HLAB tests" + required: false + default: false + enable_release_tests: + type: "boolean" + description: "Enable release tests for VLAB/HLAB tests" + required: false + default: false + +concurrency: + group: "${{ github.workflow }}:${{ github.event.pull_request.number || github.event.after || github.event.merge_group && github.run_id }}" + cancel-in-progress: true + +permissions: + contents: "read" + packages: "write" + id-token: "write" + +jobs: + check: + env: + CACHE_REGISTRY: "run.h.hhdev.io:30000" + UPSTREAM_REGISTRY: "ghcr.io" + USER: "runner" + permissions: + checks: "write" + pull-requests: "write" + contents: "read" + packages: "write" + id-token: "write" + strategy: + fail-fast: false + matrix: + profile: + - name: "debug" + cargo_name: "dev" + - name: "release" + cargo_name: "release" + debug_justfile: + - "${{ inputs.debug_justfile || false }}" + name: "${{matrix.profile.name}}" + runs-on: "lab" + timeout-minutes: 120 + steps: + - name: "install nix" + uses: "cachix/install-nix-action@v31" + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + + - name: "login to ghcr.io" + uses: "docker/login-action@v3" + with: + registry: "${{ env.UPSTREAM_REGISTRY }}" + username: "${{ github.actor }}" + password: "${{ secrets.GITHUB_TOKEN }}" + + - name: "login to image cache" + uses: "docker/login-action@v3" + with: + registry: "${{ env.CACHE_REGISTRY }}" + username: "${{ secrets.LAB_REGISTRY_USERNAME }}" + password: "${{ secrets.LAB_REGISTRY_TOKEN }}" + + - name: "Checkout" + uses: "actions/checkout@v6" + with: + persist-credentials: "false" + fetch-depth: "0" + + - name: "log into cachix" + uses: cachix/cachix-action@v14 + with: + name: "${{ vars.CACHIX_CACHE_NAME }}" + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" + useDaemon: true + + - name: "sysroot" + run: | + nix build \ + --log-format raw \ + --argstr profile ${{matrix.profile.name}} \ + --show-trace \ + --max-jobs 3 \ + --file default.nix \ + sysroot \ + --out-link sysroot + + - name: "devroot" + run: | + nix build \ + --log-format raw \ + --argstr profile ${{matrix.profile.name}} \ + --show-trace \ + --max-jobs 3 \ + --file default.nix \ + devroot \ + --out-link devroot + + - name: "bins" + run: | + for pkg in dataplane cli init; do + nix build --file default.nix \ + --log-format raw \ + --argstr profile ${{matrix.profile.name}} \ + --show-trace \ + --max-jobs 3 \ + packages.dataplane \ + --out-link "packages.${pkg}" + done + + - name: "cargo nextest" + run: | + export PATH="$(pwd)/devroot/bin:$PATH" + nix shell --file default.nix devroot --command \ + cargo nextest archive --cargo-profile ${{matrix.profile.cargo_name}} --archive-file tests.tar.zst + # nix shell --file default.nix devroot --command \ + # cargo nextest run --archive-file tests.tar.zst + + - name: "run doctests" + run: | + nix shell --file default.nix devroot --command \ + cargo test --profile=${{matrix.profile.cargo_name}} --doc + + - id: "clippy" + name: "run clippy" + run: | + nix shell --file default.nix shell --command \ + cargo clippy --profile ${{matrix.profile.cargo_name}} --all-targets --all-features -- -D warnings + + - id: "docs" + name: "run rustdoc" + run: | + nix shell --file default.nix devroot --command \ + sh -c 'RUSTDOCFLAGS="-D warnings" cargo doc --profile=${{matrix.profile_name}} --no-deps' + + - name: "Setup tmate session for debug" + # if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + uses: "mxschmitt/action-tmate@v3" + timeout-minutes: 120 + with: + limit-access-to-actor: true diff --git a/.gitignore b/.gitignore index 341e2cb36..11d895249 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ **.profraw **/__fuzz__/** -**/result*/** +result* +result*/** **/target/** /.bin/** /.vscode/** @@ -13,3 +14,25 @@ /dpdk-sys/dpdk_wrapper-precompile.h* *.pch /bin + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/Cargo.lock b/Cargo.lock index 6da71ebaf..3eb8e6d4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,7 +30,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa514b7c2d4cb8ac9d54925c91900d21fdda508877694661858744211c11c69c" dependencies = [ "futures-lite", - "libc 0.2.178", + "libc", "tokio", ] @@ -68,7 +68,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -145,9 +145,12 @@ checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" [[package]] name = "arc-swap" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +checksum = "51d03449bb8ca2cc2ef70869af31463d1ae5ccc8fa3e334b307203fbf815207e" +dependencies = [ + "rustversion", +] [[package]] name = "arrayvec" @@ -251,9 +254,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b098575ebe77cb6d14fc7f32749631a6e44edbef6b796f89b020e99ba20d425" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ "axum-core", "bytes", @@ -279,9 +282,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59446ce19cd142f8833f856eb31f3eb097812d1479ab224f54d72428ca21ea22" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" dependencies = [ "bytes", "futures-core", @@ -331,7 +334,7 @@ checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ "addr2line", "cfg-if", - "libc 0.2.178", + "libc", "miniz_oxide", "object", "rustc-demangle", @@ -644,7 +647,7 @@ checksum = "4a6e71767585f51c2a33fed6d67147ec0343725fc3c03bf4b89fe67fede56aa5" dependencies = [ "bitflags 1.3.2", "cfg-if", - "libc 0.2.178", + "libc", ] [[package]] @@ -653,7 +656,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd1ddba47aba30b6a889298ad0109c3b8dcb0e8fc993b459daa7067d46f865e0" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -677,13 +680,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.50" +version = "1.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c" +checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" dependencies = [ "find-msvc-tools", "jobserver", - "libc 0.2.178", + "libc", "shlex", ] @@ -729,7 +732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", - "libc 0.2.178", + "libc", "libloading", ] @@ -899,7 +902,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -909,7 +912,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -933,7 +936,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -1329,13 +1332,10 @@ dependencies = [ "bolero", "bytecheck", "capctl", - "dataplane-dpdk-sysroot-helper", "dataplane-id", "dataplane-sysfs", "dataplane-test-utils", - "fixin", "hwlocality", - "n-vm", "num-derive", "num-traits", "pci-ids", @@ -1386,7 +1386,7 @@ dependencies = [ "dataplane-tracectl", "derive_builder 0.20.2", "futures", - "libc 1.0.0-alpha.1", + "libc", "multi_index_map", "nix 0.30.1", "rtnetlink", @@ -1406,20 +1406,18 @@ dependencies = [ "dataplane-lpm", "dataplane-net", "dataplane-tracectl", - "dotenvy", "futures", "k8s-openapi", "kube", "linkme", "rustls", - "schemars 1.1.0", + "schemars 1.2.0", "serde", "serde-duration-ext", "serde_json", "thiserror 2.0.17", "tokio", "tracing", - "ureq", ] [[package]] @@ -1539,7 +1537,7 @@ dependencies = [ "derive_builder 0.20.2", "etherparse", "linkme", - "linux-raw-sys 0.12.0", + "linux-raw-sys 0.12.1", "multi_index_map", "ordermap", "rapidhash", @@ -1655,9 +1653,7 @@ dependencies = [ name = "dataplane-sysfs" version = "0.7.0" dependencies = [ - "dataplane-dpdk-sysroot-helper", "dataplane-id", - "n-vm", "nix 0.30.1", "procfs", "strum", @@ -1674,6 +1670,7 @@ dependencies = [ "caps", "dataplane-gwname", "nix 0.30.1", + "proc-macro-error-attr2", "rtnetlink", "tokio", "tracing", @@ -1798,18 +1795,18 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "convert_case 0.10.0", "proc-macro2", @@ -1851,7 +1848,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ - "libc 0.2.178", + "libc", "redox_users", "winapi", ] @@ -1864,7 +1861,7 @@ checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" dependencies = [ "bitflags 2.10.0", "block2", - "libc 0.2.178", + "libc", "objc2", ] @@ -1885,17 +1882,11 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09b4f5f101177ff01b8ec4ecc81eead416a8aa42819a2869311b3420fa114ffa" dependencies = [ - "libc 0.2.178", + "libc", "once_cell", "winapi", ] -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - [[package]] name = "downcast-rs" version = "2.0.2" @@ -2014,7 +2005,7 @@ version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ - "libc 0.2.178", + "libc", "windows-sys 0.61.2", ] @@ -2081,9 +2072,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" [[package]] name = "findshlibs" @@ -2093,7 +2084,7 @@ checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" dependencies = [ "cc", "lazy_static", - "libc 0.2.178", + "libc", "winapi", ] @@ -2107,16 +2098,6 @@ dependencies = [ "syn 2.0.111", ] -[[package]] -name = "flate2" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -2146,9 +2127,9 @@ dependencies = [ [[package]] name = "fs-err" -version = "3.2.1" +version = "3.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824f08d01d0f496b3eca4f001a13cf17690a6ee930043d20817f547455fd98f8" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" dependencies = [ "autocfg", "tokio", @@ -2303,7 +2284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" dependencies = [ "cc", - "libc 0.2.178", + "libc", "log", "rustversion", "windows", @@ -2317,7 +2298,7 @@ checksum = "52f04ae4152da20c76fe800fa48659201d5cf627c5149ca0b707b69d7eef6cf9" dependencies = [ "cc", "cfg-if", - "libc 0.2.178", + "libc", "log", "rustversion", "windows-link", @@ -2341,7 +2322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "wasi", ] @@ -2352,7 +2333,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "r-efi", "wasip2", ] @@ -2466,7 +2447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "windows-link", ] @@ -2537,7 +2518,7 @@ dependencies = [ "derive_more", "errno", "hwlocality-sys", - "libc 0.2.178", + "libc", "strum", "thiserror 2.0.17", "windows-sys 0.61.2", @@ -2549,7 +2530,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d55ff554bde432473a6d17dc219a2d7fedc1be12d1e150418526f666dc9d096" dependencies = [ - "libc 0.2.178", + "libc", "pkg-config", "windows-sys 0.61.2", ] @@ -2638,7 +2619,7 @@ dependencies = [ "http-body", "hyper", "ipnet", - "libc 0.2.178", + "libc", "percent-encoding", "pin-project-lite", "socket2", @@ -2892,9 +2873,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jobserver" @@ -2903,7 +2884,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ "getrandom 0.3.4", - "libc 0.2.178", + "libc", ] [[package]] @@ -2959,7 +2940,7 @@ checksum = "06d9e5e61dd037cdc51da0d7e2b2be10f497478ea7e120d85dad632adb99882b" dependencies = [ "base64 0.22.1", "chrono", - "schemars 1.1.0", + "schemars 1.2.0", "serde", "serde_json", ] @@ -3035,7 +3016,7 @@ dependencies = [ "http 1.4.0", "json-patch", "k8s-openapi", - "schemars 1.1.0", + "schemars 1.2.0", "serde", "serde-value", "serde_json", @@ -3105,12 +3086,6 @@ version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" -[[package]] -name = "libc" -version = "1.0.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7222002e5385b4d9327755661e3847c970e8fbf9dea6da8c57f16e8cfbff53a8" - [[package]] name = "libflate" version = "1.4.0" @@ -3143,12 +3118,12 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df15f6eac291ed1cf25865b1ee60399f57e7c227e7f51bdbd4c5270396a9ed50" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ "bitflags 2.10.0", - "libc 0.2.178", + "libc", ] [[package]] @@ -3179,9 +3154,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "linux-raw-sys" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b83b49c75b50cb715b09d337b045481493a8ada2bb3e872f2bae71db45b27696" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" @@ -3276,7 +3251,7 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" dependencies = [ - "libc 0.2.178", + "libc", ] [[package]] @@ -3386,7 +3361,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", - "simd-adler32", ] [[package]] @@ -3395,7 +3369,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ - "libc 0.2.178", + "libc", "log", "wasi", "windows-sys 0.61.2", @@ -3493,7 +3467,7 @@ checksum = "35a703aa1a87cd885b9f674922445a42dbb0c0f4f1b28fef21b227ae32375d21" dependencies = [ "dlopen2", "ipnet", - "libc 0.2.178", + "libc", "mac-addr", "netlink-packet-core", "netlink-packet-route 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3519,7 +3493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ec2f5b6839be2a19d7fa5aab5bc444380f6311c2b693551cb80f45caaa7b5ef" dependencies = [ "bitflags 2.10.0", - "libc 0.2.178", + "libc", "log", "netlink-packet-core", ] @@ -3530,7 +3504,7 @@ version = "0.25.1" source = "git+https://github.com/githedgehog/netlink-packet-route.git?branch=pr%2Fdaniel-noland%2Fswing4#09b8ffdf9b4e9bbc8780a3efb4ec3494ee7ee3fd" dependencies = [ "bitflags 2.10.0", - "libc 0.2.178", + "libc", "log", "netlink-packet-core", ] @@ -3568,7 +3542,7 @@ checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23" dependencies = [ "bytes", "futures", - "libc 0.2.178", + "libc", "log", "tokio", ] @@ -3590,7 +3564,7 @@ checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags 1.3.2", "cfg-if", - "libc 0.2.178", + "libc", ] [[package]] @@ -3602,7 +3576,7 @@ dependencies = [ "autocfg", "bitflags 1.3.2", "cfg-if", - "libc 0.2.178", + "libc", "memoffset 0.6.5", "pin-utils", ] @@ -3615,7 +3589,7 @@ checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ "bitflags 2.10.0", "cfg-if", - "libc 0.2.178", + "libc", ] [[package]] @@ -3627,7 +3601,7 @@ dependencies = [ "bitflags 2.10.0", "cfg-if", "cfg_aliases", - "libc 0.2.178", + "libc", "memoffset 0.9.1", ] @@ -3640,7 +3614,7 @@ dependencies = [ "bitflags 2.10.0", "cfg-if", "cfg_aliases", - "libc 0.2.178", + "libc", "memoffset 0.9.1", ] @@ -3784,7 +3758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", - "libc 0.2.178", + "libc", "redox_syscall", "smallvec", "windows-link", @@ -3952,9 +3926,9 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f59e70c4aef1e55797c2e8fd94a4f2a973fc972cfde0e0b05f683667b0cd39dd" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" [[package]] name = "potential_utf" @@ -3980,7 +3954,7 @@ dependencies = [ "backtrace", "cfg-if", "findshlibs", - "libc 0.2.178", + "libc", "log", "nix 0.27.1", "once_cell", @@ -4069,9 +4043,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" dependencies = [ "unicode-ident", ] @@ -4169,7 +4143,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a5f63b0d2727095db59045e6a0ef3259b28b90d481ae88f0e3d866d0234ce8" dependencies = [ - "libc 0.2.178", + "libc", "libflate", "log", "names", @@ -4199,7 +4173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3ab5a9d756f0d97bdc89019bd2e4ea098cf9cde50ee7564dde6b81ccc8f06c7" dependencies = [ "crossbeam-utils", - "libc 0.2.178", + "libc", "once_cell", "raw-cpuid", "wasi", @@ -4253,7 +4227,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "libc 0.2.178", + "libc", "rand_chacha 0.3.1", "rand_core 0.6.4", ] @@ -4326,9 +4300,9 @@ dependencies = [ [[package]] name = "rapidhash" -version = "4.1.1" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e65c75143ce5d47c55b510297eeb1182f3c739b6043c537670e9fc18612dae" +checksum = "2988730ee014541157f48ce4dcc603940e00915edc3c7f9a8d78092256bb2493" dependencies = [ "rustversion", ] @@ -4442,9 +4416,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.26" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64 0.22.1", "bytes", @@ -4483,7 +4457,7 @@ dependencies = [ "cc", "cfg-if", "getrandom 0.2.16", - "libc 0.2.178", + "libc", "untrusted", "windows-sys 0.52.0", ] @@ -4570,13 +4544,13 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags 2.10.0", "errno", - "libc 0.2.178", + "libc", "linux-raw-sys 0.11.0", "windows-sys 0.61.2", ] @@ -4590,7 +4564,6 @@ dependencies = [ "aws-lc-rs", "log", "once_cell", - "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -4654,7 +4627,7 @@ dependencies = [ "bitflags 2.10.0", "cfg-if", "clipboard-win", - "libc 0.2.178", + "libc", "log", "memchr", "nix 0.30.1", @@ -4668,9 +4641,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "safemem" @@ -4710,9 +4683,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" +checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" dependencies = [ "dyn-clone", "ref-cast", @@ -4723,9 +4696,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301858a4023d78debd2353c7426dc486001bddc91ae31a76fb1f55132f7e2633" +checksum = "4908ad288c5035a8eb12cfdf0d49270def0a268ee162b75eeee0f85d155a7c45" dependencies = [ "proc-macro2", "quote", @@ -4769,7 +4742,7 @@ dependencies = [ "bitflags 2.10.0", "core-foundation 0.10.1", "core-foundation-sys", - "libc 0.2.178", + "libc", "security-framework-sys", ] @@ -4780,7 +4753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -4853,15 +4826,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -4908,7 +4881,7 @@ dependencies = [ "indexmap 1.9.3", "indexmap 2.12.1", "schemars 0.9.0", - "schemars 1.1.0", + "schemars 1.2.0", "serde_core", "serde_json", "time", @@ -5017,19 +4990,14 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.7" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ - "libc 0.2.178", + "errno", + "libc", ] -[[package]] -name = "simd-adler32" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" - [[package]] name = "simdutf8" version = "0.1.5" @@ -5103,7 +5071,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ - "libc 0.2.178", + "libc", "windows-sys 0.60.2", ] @@ -5262,7 +5230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", - "libc 0.2.178", + "libc", ] [[package]] @@ -5273,9 +5241,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.23.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ "fastrand 2.3.0", "getrandom 0.3.4", @@ -5436,7 +5404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ "bytes", - "libc 0.2.178", + "libc", "mio", "parking_lot", "pin-project-lite", @@ -5515,7 +5483,7 @@ checksum = "8b319ef9394889dab2e1b4f0085b45ba11d0c79dc9d1a9d1afc057d009d0f1c7" dependencies = [ "bytes", "futures", - "libc 0.2.178", + "libc", "tokio", "vsock", ] @@ -5837,35 +5805,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "ureq" -version = "3.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39cb1dbab692d82a977c0392ffac19e188bd9186a9f32806f0aaa859d75585a" -dependencies = [ - "base64 0.22.1", - "flate2", - "log", - "percent-encoding", - "rustls", - "rustls-pki-types", - "ureq-proto", - "utf-8", - "webpki-roots", -] - -[[package]] -name = "ureq-proto" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d81f9efa9df032be5934a46a068815a10a042b494b6a58cb0a1a97bb5467ed6f" -dependencies = [ - "base64 0.22.1", - "http 1.4.0", - "httparse", - "log", -] - [[package]] name = "url" version = "2.5.7" @@ -5878,12 +5817,6 @@ dependencies = [ "serde", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8_iter" version = "1.0.4" @@ -5927,7 +5860,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2da6e4ac76cd19635dce0f98985378bb62f8044ee2ff80abd2a7334b920ed63" dependencies = [ - "libc 0.2.178", + "libc", "nix 0.30.1", ] @@ -6050,15 +5983,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-roots" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "winapi" version = "0.3.9" @@ -6524,3 +6448,9 @@ dependencies = [ "quote", "syn 2.0.111", ] + +[[package]] +name = "zmij" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5858cd3a46fff31e77adea2935e357e3a2538d870741617bfb7c943e218fee6" diff --git a/Cargo.toml b/Cargo.toml index 5453f089f..3fb4a4852 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,32 @@ [workspace] +default-members = [ + "args", + "cli", + "concurrency", + "concurrency-macros", + "config", + "dataplane", + "errno", + "flow-info", + "id", + "interface-manager", + "k8s-intf", + "left-right-tlcache", + "mgmt", + "nat", + "net", + "pipeline", + "pkt-meta", + "rekon", + "routing", + "stats", + "sysfs", + "test-utils", + "tracectl", + "vpcmap", +] + members = [ "args", "cli", @@ -102,7 +129,7 @@ color-eyre = { version = "0.6.5", default-features = false, features = [] } colored = { version = "3.0.0", default-features = false, features = [] } command-fds = { version = "0.3.2", default-features = false, features = [] } crossbeam-channel = { version = "0.5.15", default-features = false, features = [] } -ctrlc = { version = "3.5.1", default-features = false, features = [] } +ctrlc = { version = "3.5.1", default-features = false, features = [] } # TODO: remove this in favor of tokio signal handling dashmap = { version = "6.1.0", default-features = false, features = [] } derive_builder = { version = "0.20.2", default-features = false, features = [] } dotenvy = { version = "0.15.7", default-features = false, features = [] } @@ -121,7 +148,7 @@ k8s-openapi = { version = "0.26.0", default-features = false, features = [] } kanal = { version = "0.1.1", default-features = false, features = [] } kube = { version = "2.0.1", default-features = false, features = [] } left-right = { version = "0.11.6", default-features = false, features = [] } -libc = { version = "1.0.0-alpha.1", default-features = false, features = [] } +libc = { version = "0.2.178", default-features = false, features = [] } linkme = { version = "0.3.35", default-features = false, features = [] } linux-raw-sys = { version = "0.12.0", default-features = false, features = [] } log = { version = "0.4.29", default-features = false, features = [] } # TODO: try to remove this @@ -133,9 +160,9 @@ metrics-exporter-prometheus = { version = "0.18.1", default-features = false, fe miette = { version = "7.6.0", default-features = false, features = [] } mio = { version = "1.1.1", default-features = false, features = [] } multi_index_map = { version = "0.15.0", default-features = false, features = [] } -n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [], package = "n-vm" } +n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [] } # TODO: merge this in to the main repo netdev = { version = "0.39.0", default-features = false, features = [] } -nix = { version = "0.30.1", default-features = false, features = [] } +nix = { version = "0.30.1", default-features = false, features = ["socket"] } num-derive = { version = "0.4.2", default-features = false, features = [] } num-traits = { version = "0.2.19", default-features = false, features = [] } once_cell = { version = "1.21.3", default-features = false, features = [] } @@ -155,7 +182,7 @@ rand = { version = "0.9.2", default-features = false, features = [] } rapidhash = { version = "4.1.1", default-features = false, features = [] } rkyv = { version = "0.8.12", default-features = false, features = [] } roaring = { version = "0.11.2", default-features = false, features = [] } -rtnetlink = { git = "https://github.com/githedgehog/rtnetlink.git", branch = "hh/tc-actions3", default-features = false, features = [] } +rtnetlink = { git = "https://github.com/githedgehog/rtnetlink.git", branch = "hh/tc-actions3", default-features = false, features = [] } # TODO: update this rustls = { version = "0.23.35", default-features = false, features = [] } rustyline = { version = "17.0.2", default-features = false, features = [] } schemars = { version = "1", default-features = false, features = [] } @@ -183,23 +210,24 @@ tracing-test = { version = "0.2.5", default-features = false, features = [] } ureq = { version = "3.1.4", default-features = false, features = [] } url = { version = "2.5.7", default-features = false, features = [] } uuid = { version = "1.19.0", default-features = false, features = [] } +proc-macro-error2 = { version = "2.0.1", default-features = true } [profile.dev] +opt-level = 0 panic = "unwind" +debug = "full" debug-assertions = true overflow-checks = true -debug = "full" -rpath = true +incremental = false [profile.release] opt-level = 3 panic = "unwind" debug = "full" -lto = "thin" debug-assertions = false overflow-checks = false +lto = "thin" codegen-units = 1 -rpath = true [profile.fuzz] inherits = "release" diff --git a/Dockerfile b/Dockerfile index 6a1cd5433..02db27c1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,16 @@ -ARG BASE -FROM $BASE AS dataplane -ARG ARTIFACT -ARG ARTIFACT_CLI -COPY --link --chown=0:0 "${ARTIFACT}" /dataplane -COPY --link --chown=0:0 "${ARTIFACT_CLI}" /dataplane-cli -WORKDIR / -ENTRYPOINT ["/dataplane"] +# ARG BASE +# FROM $BASE AS dataplane +# ARG ARTIFACT +# ARG ARTIFACT_CLI +# COPY --link --chown=0:0 "${ARTIFACT}" /dataplane +# COPY --link --chown=0:0 "${ARTIFACT_CLI}" /dataplane-cli +# WORKDIR / +# ENTRYPOINT ["/dataplane"] + +FROM containers-base:v0.0.0 as base-image +ADD \ + --unpack=true \ + --chown=root:root \ + --chmod=500 \ + ./dataplane.tar / +ENTRYPOINT [ "/bin/dataplane" ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 533308327..19b69bb88 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -10,6 +10,10 @@ autobins = false name = "cli" path = "bin/main.rs" +[features] +default = [] +sysroot = ["dep:dpdk-sysroot-helper"] + [dependencies] bincode2 = { workspace = true, features = [] } clap = { workspace = true, features = ["derive", "std", "usage"] } @@ -22,6 +26,6 @@ thiserror = { workspace = true } [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } +dpdk-sysroot-helper = { workspace = true, optional = true } # external diff --git a/cli/build.rs b/cli/build.rs index 52f5b0197..1fc109eb8 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -2,7 +2,6 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + #[cfg(feature = "sysroot")] + dpdk_sysroot_helper::use_sysroot(); } diff --git a/dataplane/Cargo.toml b/dataplane/Cargo.toml index fe8d430f2..c70bad32f 100644 --- a/dataplane/Cargo.toml +++ b/dataplane/Cargo.toml @@ -5,6 +5,11 @@ license.workspace = true publish.workspace = true version.workspace = true +[features] +default = [] +dpdk = ["dep:dpdk", "_sysroot"] +_sysroot = ["dep:dpdk-sysroot-helper"] + [dependencies] afpacket = { workspace = true, features = ["async-tokio"] } args = { workspace = true } @@ -13,7 +18,7 @@ axum = { workspace = true, features = ["http1", "tokio"] } axum-server = { workspace = true } concurrency = { workspace = true } ctrlc = { workspace = true, features = ["termination"] } -dpdk = { workspace = true } +dpdk = { workspace = true, optional = true } dyn-iter = { workspace = true } futures = { workspace = true } gwname = { workspace = true } @@ -60,6 +65,6 @@ tracing-subscriber = { workspace = true } [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } +dpdk-sysroot-helper = { workspace = true, optional = true } # external diff --git a/dataplane/build.rs b/dataplane/build.rs index 52f5b0197..1b2a9e546 100644 --- a/dataplane/build.rs +++ b/dataplane/build.rs @@ -2,7 +2,6 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + #[cfg(feature = "_sysroot")] + dpdk_sysroot_helper::use_sysroot(); } diff --git a/dataplane/src/drivers/dpdk.rs b/dataplane/src/drivers/dpdk.rs index f5f9b2a57..0f1903220 100644 --- a/dataplane/src/drivers/dpdk.rs +++ b/dataplane/src/drivers/dpdk.rs @@ -3,6 +3,7 @@ //! DPDK dataplane driver +#![cfg(feature = "dpdk")] #![allow(unused)] use dpdk::dev::{Dev, TxOffloadConfig}; diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..001a89f39 --- /dev/null +++ b/default.nix @@ -0,0 +1,406 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + platform ? "x86-64-v3", + libc ? "gnu", + profile ? "debug", + instrumentation ? "none", + sanitize ? "", +}: +let + lib = (import sources.nixpkgs { }).lib; + # helper method to work around nix's contrived builtin string split function. + split-str = + split-on: string: + if string == "" then + [ ] + else + builtins.filter (elm: builtins.isString elm) (builtins.split split-on string); + sanitizers = split-str ",+" sanitize; + sources = import ./npins; + platform' = import ./nix/platforms.nix { + inherit lib platform libc; + }; + profile' = import ./nix/profiles.nix { + inherit sanitizers instrumentation profile; + arch = platform'.arch; + }; + cargo-profile = + { + "debug" = "dev"; + "release" = "release"; + } + .${profile}; + overlays = import ./nix/overlays { + inherit + sources + sanitizers + ; + profile = profile'; + platform = platform'; + }; + dev-pkgs = import sources.nixpkgs { + overlays = [ + overlays.rust + overlays.llvm + overlays.dataplane-dev + ]; + }; + pkgs = + (import sources.nixpkgs { + overlays = [ + overlays.rust + overlays.llvm + overlays.dataplane + ]; + }).pkgsCross.${platform'.info.nixarch}; + sysroot = pkgs.pkgsHostHost.symlinkJoin { + name = "sysroot"; + paths = with pkgs.pkgsHostHost; [ + pkgs.pkgsHostHost.libc.dev + pkgs.pkgsHostHost.libc.out + fancy.dpdk-wrapper.dev + fancy.dpdk-wrapper.out + fancy.dpdk.dev + fancy.dpdk.static + fancy.hwloc.dev + fancy.hwloc.static + fancy.libbsd.dev + fancy.libbsd.static + fancy.libmd.dev + fancy.libmd.static + fancy.libnl.dev + fancy.libnl.static + fancy.libunwind.out + fancy.numactl.dev + fancy.numactl.static + fancy.rdma-core.dev + fancy.rdma-core.static + ]; + }; + clangd-config = pkgs.writeTextFile { + name = ".clangd"; + text = '' + CompileFlags: + Add: + - "-I${sysroot}/include" + - "-Wno-deprecated-declarations" + - "-Wno-quoted-include-in-framework-header" + ''; + executable = false; + destination = "/.clangd"; + }; + crane = import sources.crane { pkgs = pkgs; }; + craneLib = crane.craneLib.overrideToolchain pkgs.rust-toolchain; + devroot = pkgs.symlinkJoin { + name = "dataplane-dev-shell"; + paths = [ + clangd-config + ] + ++ (with pkgs.pkgsBuildHost.llvmPackages; [ + bintools + clang + libclang.lib + lld + ]) + ++ (with dev-pkgs; [ + bash + cargo-bolero + cargo-deny + cargo-depgraph + cargo-llvm-cov + cargo-nextest + direnv + gateway-crd + just + kopium + llvmPackages.clang # yes, you do actually need the host compiler in order to link proc macros + npins + pkg-config + rust-toolchain + ]); + }; + markdownFilter = p: _type: builtins.match ".*\.md$" p != null; + cHeaderFilter = p: _type: builtins.match ".*\.h$" p != null; + outputsFilter = p: _type: (p != "target") && (p != "sysroot") && (p != "devroot") && (p != ".git"); + src = pkgs.lib.cleanSourceWith { + filter = + p: t: + (markdownFilter p t) + || (cHeaderFilter p t) + || ((outputsFilter p t) && (craneLib.filterCargoSources p t)); + src = ./.; + }; + cargoVendorDir = craneLib.vendorMultipleCargoDeps { + cargoLockList = [ + ./Cargo.lock + "${pkgs.rust-toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock" + ]; + }; + target = pkgs.stdenv'.targetPlatform.rust.rustcTarget; + is-cross-compile = dev-pkgs.stdenv.hostPlatform.rust.rustcTarget != target; + cc = if is-cross-compile then "${target}-clang" else "clang"; + package-list = builtins.fromJSON ( + builtins.readFile ( + pkgs.runCommandLocal "package-list" + { + TOMLQ = "${dev-pkgs.yq}/bin/tomlq"; + JQ = "${dev-pkgs.jq}/bin/jq"; + } + '' + $TOMLQ -r '.workspace.members | sort[]' ${src}/Cargo.toml | while read -r p; do + $TOMLQ --arg p "$p" -r '{ ($p): .package.name }' ${src}/$p/Cargo.toml + done | $JQ --sort-keys --slurp 'add' > $out + '' + ) + ); + version = (craneLib.crateNameFromCargoToml { inherit src; }).version; + cargo-cmd-prefix = [ + "-Zunstable-options" + "-Zbuild-std=compiler_builtins,core,alloc,std,panic_unwind,sysroot" + "-Zbuild-std-features=backtrace,panic-unwind,mem,compiler-builtins-mem,llvm-libunwind" + "--target=${target}" + ]; + invoke = + { + builder, + args ? { + pname = null; + cargoArtifacts = null; + }, + cargo-nextest, + hwloc, + llvmPackages, + pkg-config, + }: + (builder ( + { + inherit + src + version + cargoVendorDir + ; + + doCheck = false; + strictDeps = true; + dontStrip = true; + doRemapPathPrefix = false; # TODO: this setting may be wrong, test with debugger + doNotRemoveReferencesToRustToolchain = true; + doNotRemoveReferencesToVendorDir = true; + separateDebugInfo = true; + + nativeBuildInputs = [ + (dev-pkgs.kopium) + cargo-nextest + llvmPackages.clang + llvmPackages.lld + pkg-config + ]; + + buildInputs = [ + hwloc + ]; + + env = { + CARGO_PROFILE = cargo-profile; + DATAPLANE_SYSROOT = "${sysroot}"; + LIBCLANG_PATH = "${pkgs.pkgsBuildHost.llvmPackages.libclang.lib}/lib"; + C_INCLUDE_PATH = "${sysroot}/include"; + LIBRARY_PATH = "${sysroot}/lib"; + PKG_CONFIG_PATH = "${sysroot}/lib/pkgconfig"; + GW_CRD_PATH = "${dev-pkgs.gateway-crd}/src/gateway/config/crd/bases"; + RUSTC_BOOTSTRAP = "1"; + RUSTFLAGS = builtins.concatStringsSep " " ( + profile'.RUSTFLAGS + ++ [ + "-Clinker=${pkgs.pkgsBuildHost.llvmPackages.clang}/bin/${cc}" + "-Clink-arg=--ld-path=${pkgs.pkgsBuildHost.llvmPackages.lld}/bin/ld.lld" + "-Clink-arg=-L${sysroot}/lib" + # NOTE: this is basically a trick to make our source code available to debuggers. + # Normally remap-path-prefix takes the form --remap-path-prefix=FROM=TO where FROM and TO are directories. + # This is intended to map source code paths to generic, relative, or redacted paths. + # We are sorta using that mechanism in reverse here in that the empty FROM in the next expression maps our + # source code in the debug info from the current working directory to ${src} (the nix store path where we + # have copied our source code). + # + # This is nice in that it should allow us to include ${src} in a container with gdb / lldb + the debug files + # we strip out of the final binaries we cook and include a gdbserver binary in some + # debug/release-with-debug-tools containers. Then, connecting from the gdb/lldb container to the + # gdb/lldbserver container should allow us to actually debug binaries deployed to test machines. + "--remap-path-prefix==${src}" + ] + ); + }; + } + // args + )).overrideAttrs + (orig: { + separateDebugInfo = true; + + # I'm not 100% sure if I would call it a bug in crane or a bug in cargo, but cross compile is tricky here. + # There is no easy way to distinguish RUSTFLAGS intended for the build-time dependencies from the RUSTFLAGS + # intended for the runtime dependencies. + # One unfortunate consequence of this is that if you set platform specific RUSTFLAGS then the postBuild hook + # malfunctions. Fortunately, the "fix" is easy: just unset RUSTFLAGS before the postBuild hook actually runs. + # We don't need to set any optimization flags for postBuild tooling anyway. + postBuild = (orig.postBuild or "") + '' + unset RUSTFLAGS; + ''; + postInstall = (orig.postInstall or "") + '' + mkdir -p $debug/bin + for f in $out/bin/*; do + strip --only-keep-debug "$f" -o "$out/bin/$(basename "$f").dbg" + strip --strip-debug "$f" + cd $out/bin + objcopy --add-gnu-debuglink="$(basename "$f").dbg" "$(basename "$f")" + mv "$(basename "$f")".dbg "$debug/bin/" + done + ''; + postFixup = (orig.postFixup or "") + '' + rm -f $out/target.tar.zst + ''; + }); + package-builder = + { + pname ? null, + cargoArtifacts ? null, + }: + pkgs.callPackage invoke { + builder = craneLib.buildPackage; + args = { + inherit pname cargoArtifacts; + buildPhaseCargoCommand = builtins.concatStringsSep " " ( + [ + "cargoBuildLog=$(mktemp cargoBuildLogXXXX.json);" + "cargo" + "build" + "--package=${pname}" + "--profile=${cargo-profile}" + ] + ++ cargo-cmd-prefix + ++ [ + "--message-format json-render-diagnostics > $cargoBuildLog" + ] + ); + }; + }; + packages = builtins.mapAttrs ( + dir: pname: + package-builder { + inherit pname; + } + ) package-list; + test-builder = + { + pname ? null, + cargoArtifacts ? null, + }: + pkgs.callPackage invoke { + builder = craneLib.mkCargoDerivation; + args = { + inherit pname cargoArtifacts; + buildPhaseCargoCommand = builtins.concatStringsSep " " ( + [ + "mkdir -p $out;" + "cargo" + "nextest" + "archive" + "--archive-file" + "$out/${pname}.tar.zst" + "--cargo-profile=${cargo-profile}" + "--package=${pname}" + ] + ++ cargo-cmd-prefix + ); + }; + }; + tests = builtins.mapAttrs ( + dir: pname: + test-builder { + inherit pname; + } + ) package-list; + clippy-builder = + { + pname ? null, + }: + pkgs.callPackage invoke { + builder = craneLib.mkCargoDerivation; + args = { + inherit pname; + cargoArtifacts = null; + buildPhaseCargoCommand = builtins.concatStringsSep " " ( + [ + "cargo" + "clippy" + "--profile=${cargo-profile}" + "--package=${pname}" + ] + ++ cargo-cmd-prefix + ++ [ + "--" + "-D warnings" + ] + ); + }; + }; + clippy = builtins.mapAttrs ( + dir: pname: + clippy-builder { + inherit pname; + } + ) package-list; + env.base = pkgs.buildEnv { + name = "base-env"; + pathsToLink = [ + "/etc" + "/var" + ]; + paths = [ + pkgs.pkgsHostHost.libc.out + pkgs.pkgsHostHost.libgcc.libgcc + pkgs.pkgsHostHost.dockerTools.fakeNss + ]; + }; + containers.base = pkgs.dockerTools.buildImage { + name = "containers-base"; + tag = "v0.0.0"; + copyToRoot = env.base; + }; + dataplane-tar = pkgs.stdenv'.mkDerivation { + pname = "dataplane-tar"; + version = "0.0.0"; + dontUnpack = true; + src = null; + buildPhase = '' + tmp="$(mktemp -d)" + mkdir -p "$tmp/"{bin,var,run} + mkdir -p "$tmp/run/dataplane" "$tmp/run/frr/hh" "$tmp/run/dataplane" + ln -s /run "$tmp/var/run" + cp "${packages.dataplane}/bin/dataplane" "$tmp/bin/" + cp "${packages.cli}/bin/cli" "$tmp/bin/cli" + ln -s cli "$tmp/bin/sh" + cd "$tmp" + tar -czvf "$out" . + ''; + }; +in +{ + inherit + # cargoArtifacts + pkgs + dev-pkgs + devroot + package-list + sources + sysroot + packages + tests + clippy + containers + env + dataplane-tar + ; + profile = profile'; + platform = platform'; +} diff --git a/dpdk-sys/build.rs b/dpdk-sys/build.rs index 556af520a..d678e6ba3 100644 --- a/dpdk-sys/build.rs +++ b/dpdk-sys/build.rs @@ -20,11 +20,11 @@ impl ParseCallbacks for Cb { } } -fn bind(path: &Path, sysroot: &str) { +fn bind(path: &Path) { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let static_fn_path = out_path.join("generated.h"); bindgen::Builder::default() - .header(format!("{sysroot}/include/dpdk_wrapper.h")) + .header("./dpdk_wrapper.h") .anon_fields_prefix("annon") .use_core() .generate_comments(true) @@ -47,7 +47,6 @@ fn bind(path: &Path, sysroot: &str) { .default_enum_style(bindgen::EnumVariation::ModuleConsts) .blocklist_item("rte_atomic.*") .allowlist_item("rte.*") - .allowlist_item("wrte_.*") .allowlist_item("RTE.*") .blocklist_item("__*") .clang_macro_fallback() @@ -56,7 +55,7 @@ fn bind(path: &Path, sysroot: &str) { .opaque_type("rte_arp_ipv4") .opaque_type("rte_gtp_psc_generic_hdr") .opaque_type("rte_l2tpv2_combined_msg_hdr") - .clang_arg(format!("-I{sysroot}/include")) + // .clang_arg(format!("-I{sysroot}/include")) .clang_arg("-fretain-comments-from-system-headers") .clang_arg("-fparse-all-comments") .rust_edition(bindgen::RustEdition::Edition2024) @@ -69,14 +68,13 @@ fn bind(path: &Path, sysroot: &str) { fn main() { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - let sysroot = dpdk_sysroot_helper::get_sysroot(); + let library_path = env::var("LIBRARY_PATH").unwrap().to_string(); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); - println!("cargo:rustc-link-search=all={sysroot}/lib"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); + println!("cargo:rustc-link-search=all={library_path}"); - // NOTE: DPDK absolutely requires whole-archive in the linking command. - // While I find this very questionable, it is what it is. - // It is just more work for the LTO later on I suppose ¯\_(ツ)_/¯ let depends = [ "dpdk_wrapper", "rte_net_virtio", @@ -100,6 +98,7 @@ fn main() { "rte_rcu", "rte_ring", "rte_eal", + "rte_argparse", "rte_kvargs", "rte_telemetry", "rte_log", @@ -126,6 +125,9 @@ fn main() { "numa", ]; + // NOTE: DPDK absolutely requires whole-archive in the linking command. + // While I find this very questionable, it is what it is. + // It is just more work for the LTO later on I suppose ¯\_(ツ)_/¯ for dep in &depends { println!("cargo:rustc-link-lib=static:+whole-archive,+bundle={dep}"); } @@ -133,5 +135,5 @@ fn main() { for file in &rerun_if_changed { println!("cargo:rerun-if-changed={file}"); } - bind(&out_path, sysroot.as_str()); + bind(&out_path); } diff --git a/dpdk-sys/dpdk_wrapper.h b/dpdk-sys/dpdk_wrapper.h new file mode 100644 index 000000000..3ebfe21e7 --- /dev/null +++ b/dpdk-sys/dpdk_wrapper.h @@ -0,0 +1,1034 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Open Network Fabric Authors + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Things which are either duplicated, totally inapplicable or not needed +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include // this is an internal header +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + +// #include +// #include +// #include +// #include + +/** + * Thin wrapper to expose `rte_errno`. + * + * @return + * The last rte_errno value (thread local value). + */ +int rte_errno_get(); + +/** + * TX offloads to be set in [`rte_eth_tx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum rte_eth_tx_offload : uint64_t { + 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 +}; + +/** + * RX offloads to be set in [`rte_eth_rx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum rte_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, +}; + +int rte_errno_get(); + +// Static wrappers + +void rte_atomic_thread_fence_w(rte_memory_order memorder); +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src); +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val); +void rte_atomic16_init_w(rte_atomic16_t *v); +int16_t rte_atomic16_read_w(const rte_atomic16_t *v); +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value); +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc); +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec); +void rte_atomic16_inc_w(rte_atomic16_t *v); +void rte_atomic16_dec_w(rte_atomic16_t *v); +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc); +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec); +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v); +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v); +int rte_atomic16_test_and_set_w(rte_atomic16_t *v); +void rte_atomic16_clear_w(rte_atomic16_t *v); +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src); +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val); +void rte_atomic32_init_w(rte_atomic32_t *v); +int32_t rte_atomic32_read_w(const rte_atomic32_t *v); +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value); +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc); +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec); +void rte_atomic32_inc_w(rte_atomic32_t *v); +void rte_atomic32_dec_w(rte_atomic32_t *v); +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc); +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec); +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v); +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v); +int rte_atomic32_test_and_set_w(rte_atomic32_t *v); +void rte_atomic32_clear_w(rte_atomic32_t *v); +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src); +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val); +void rte_atomic64_init_w(rte_atomic64_t *v); +int64_t rte_atomic64_read_w(rte_atomic64_t *v); +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value); +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc); +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec); +void rte_atomic64_inc_w(rte_atomic64_t *v); +void rte_atomic64_dec_w(rte_atomic64_t *v); +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc); +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec); +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v); +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v); +int rte_atomic64_test_and_set_w(rte_atomic64_t *v); +void rte_atomic64_clear_w(rte_atomic64_t *v); +void rte_smp_mb_w(void); +uint64_t rte_get_tsc_cycles_w(void); +uint64_t rte_get_timer_cycles_w(void); +uint64_t rte_get_timer_hz_w(void); +void rte_delay_ms_w(unsigned int ms); +uint64_t rte_rdtsc_w(void); +uint64_t rte_rdtsc_precise_w(void); +size_t rte_strlcpy_w(char *dst, const char *src, size_t size); +size_t rte_strlcat_w(char *dst, const char *src, size_t size); +const char *rte_str_skip_leading_spaces_w(const char *src); +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src); +int rte_gettid_w(void); +unsigned int rte_lcore_id_w(void); +void rte_pause_w(void); +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder); +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder); +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder); +void rte_spinlock_init_w(rte_spinlock_t *sl); +void rte_spinlock_lock_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_w(rte_spinlock_t *sl); +int rte_spinlock_is_locked_w(rte_spinlock_t *sl); +int rte_tm_supported_w(void); +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr); +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr); +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr); +unsigned int rte_clz32_w(uint32_t v); +unsigned int rte_clz64_w(uint64_t v); +unsigned int rte_ctz32_w(uint32_t v); +unsigned int rte_ctz64_w(uint64_t v); +unsigned int rte_popcount32_w(uint32_t v); +unsigned int rte_popcount64_w(uint64_t v); +uint32_t rte_combine32ms1b_w(uint32_t x); +uint64_t rte_combine64ms1b_w(uint64_t v); +uint32_t rte_bsf32_w(uint32_t v); +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos); +uint32_t rte_bsf64_w(uint64_t v); +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos); +uint32_t rte_fls_u32_w(uint32_t x); +uint32_t rte_fls_u64_w(uint64_t x); +int rte_is_power_of_2_w(uint32_t n); +uint32_t rte_align32pow2_w(uint32_t x); +uint32_t rte_align32prevpow2_w(uint32_t x); +uint64_t rte_align64pow2_w(uint64_t v); +uint64_t rte_align64prevpow2_w(uint64_t v); +uint32_t rte_log2_u32_w(uint32_t v); +uint32_t rte_log2_u64_w(uint64_t v); +void rte_rwlock_init_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl); +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl); +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r); +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v); +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r); +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v); +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize); +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize); +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize); +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space); +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n); +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n); +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available); +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space); +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_enqueue_w(struct rte_ring *r, void *obj); +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available); +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p); +unsigned int rte_ring_count_w(const struct rte_ring *r); +unsigned int rte_ring_free_count_w(const struct rte_ring *r); +int rte_ring_full_w(const struct rte_ring *r); +int rte_ring_empty_w(const struct rte_ring *r); +unsigned int rte_ring_get_size_w(const struct rte_ring *r); +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_prod_sync_type_w(const struct rte_ring *r); +int rte_ring_is_prod_single_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_cons_sync_type_w(const struct rte_ring *r); +int rte_ring_is_cons_single_w(const struct rte_ring *r); +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available); +void *rte_memcpy_w(void *dst, const void *src, size_t n); +void rte_mov16_w(uint8_t *dst, const uint8_t *src); +void rte_mov32_w(uint8_t *dst, const uint8_t *src); +void rte_mov64_w(uint8_t *dst, const uint8_t *src); +void rte_mov256_w(uint8_t *dst, const uint8_t *src); +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj); +struct rte_mempool *rte_mempool_from_obj_w(void *obj); +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj); +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index); +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n); +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n); +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n); +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id); +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp); +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache); +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, struct rte_mempool_cache *cache); +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n); +void rte_mempool_put_w(struct rte_mempool *mp, void *obj); +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache); +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache); +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n); +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p); +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n); +int rte_mempool_full_w(const struct rte_mempool *mp); +int rte_mempool_empty_w(const struct rte_mempool *mp); +rte_iova_t rte_mempool_virt2iova_w(const void *elt); +void *rte_mempool_get_priv_w(struct rte_mempool *mp); +void rte_prefetch0_w(const void *p); +void rte_prefetch1_w(const void *p); +void rte_prefetch2_w(const void *p); +void rte_prefetch_non_temporal_w(const void *p); +void rte_prefetch0_write_w(const void *p); +void rte_prefetch1_write_w(const void *p); +void rte_prefetch2_write_w(const void *p); +void rte_cldemote_w(const void *p); +uint16_t rte_constant_bswap16_w(uint16_t x); +uint32_t rte_constant_bswap32_w(uint32_t x); +uint64_t rte_constant_bswap64_w(uint64_t x); +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m); +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp); +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m); +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova); +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb); +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb); +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi); +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp); +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb); +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md); +void *rte_mbuf_to_priv_w(struct rte_mbuf *m); +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp); +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m); +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value); +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value); +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo); +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value); +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value); +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp); +void rte_mbuf_raw_free_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp); +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m); +void rte_pktmbuf_reset_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp); +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count); +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque); +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo); +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc); +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m); +void rte_pktmbuf_detach_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_w(struct rte_mbuf *m); +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v); +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m); +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m); +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m); +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf); +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail); +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused); +int rte_validate_tx_offload_w(const struct rte_mbuf *m); +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf); +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m); +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color); +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id); +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class); +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color); +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color); +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2); +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea); +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to); +int rte_vlan_strip_w(struct rte_mbuf *m); +int rte_vlan_insert_w(struct rte_mbuf **m); +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits); +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size); +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size); +void rte_bitmap_free_w(struct rte_bitmap *bmp); +void rte_bitmap_reset_w(struct rte_bitmap *bmp); +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos); +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab); +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos); +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab); +uint16_t rte_raw_cksum_w(const void *buf, size_t len); +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum); +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags); +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr); +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off); +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr); +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off); +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b); +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth); +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth); +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask); +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip); +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip); +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac); +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip); +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip); +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip); +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags); +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr); +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off); +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr); +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off); +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len); +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color); +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color); +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color); +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf); +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts); +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id); +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset); +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset); +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer); +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt); +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info); +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id); +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m); +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v); +int rte_flow_dynf_metadata_avail_w(void); +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val); +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val); +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val); +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val); +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, uint32_t init_val); +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb); +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb); +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval); +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval); +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval); +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval); +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval); +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key); +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket); +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value); +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket); +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key); +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket); +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key); +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht); +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht); +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id); +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id); +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v); +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait); +uint8_t rte_read8_relaxed_w(const void *addr); +uint16_t rte_read16_relaxed_w(const void *addr); +uint32_t rte_read32_relaxed_w(const void *addr); +uint64_t rte_read64_relaxed_w(const void *addr); +void rte_write8_relaxed_w(uint8_t value, void *addr); +void rte_write16_relaxed_w(uint16_t value, void *addr); +void rte_write32_relaxed_w(uint32_t value, void *addr); +void rte_write64_relaxed_w(uint64_t value, void *addr); +uint8_t rte_read8_w(const void *addr); +uint16_t rte_read16_w(const void *addr); +uint32_t rte_read32_w(const void *addr); +uint64_t rte_read64_w(const void *addr); +void rte_write8_w(uint8_t value, void *addr); +void rte_write16_w(uint16_t value, void *addr); +void rte_write32_w(uint32_t value, void *addr); +void rte_write64_w(uint64_t value, void *addr); +void rte_write32_wc_relaxed_w(uint32_t value, void *addr); +void rte_write32_wc_w(uint32_t value, void *addr); +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_is_locked_w(rte_mcslock_t *msl); +void rte_pflock_init_w(struct rte_pflock *pf); +void rte_pflock_read_lock_w(rte_pflock_t *pf); +void rte_pflock_read_unlock_w(rte_pflock_t *pf); +void rte_pflock_write_lock_w(rte_pflock_t *pf); +void rte_pflock_write_unlock_w(rte_pflock_t *pf); +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R); +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R); +void rte_seqcount_init_w(rte_seqcount_t *seqcount); +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount); +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn); +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount); +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount); +void rte_seqlock_init_w(rte_seqlock_t *seqlock); +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock); +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn); +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock); +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock); +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n); +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n); +unsigned int rte_stack_count_w(struct rte_stack *s); +unsigned int rte_stack_free_count_w(struct rte_stack *s); +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key); +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key); +void rte_ticketlock_init_w(rte_ticketlock_t *tl); +void rte_ticketlock_lock_w(rte_ticketlock_t *tl); +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl); +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl); +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl); +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr); +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr); +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles); +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now); +uint64_t rte_timespec_to_ns_w(const struct timespec *ts); +struct timespec rte_ns_to_timespec_w(uint64_t nsec); +bool rte_trace_feature_is_enabled_w(void); diff --git a/dpdk-sysroot-helper/src/lib.rs b/dpdk-sysroot-helper/src/lib.rs index 8c5b81f37..e6d2c1bcf 100644 --- a/dpdk-sysroot-helper/src/lib.rs +++ b/dpdk-sysroot-helper/src/lib.rs @@ -29,27 +29,18 @@ pub fn get_target_name() -> String { .to_string() } -#[must_use] -pub fn get_project_root() -> String { - env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set") -} - -#[must_use] -pub fn get_compile_env() -> String { - env::var("COMPILE_ENV").expect("COMPILE_ENV not set") -} - #[must_use] pub fn get_sysroot() -> String { - let compile_env = env::var("COMPILE_ENV").expect("COMPILE_ENV not set"); - let sysroot_env = format!("{compile_env}/sysroot"); - let target = get_target_name(); - let profile = get_profile_name(); - let expected_sysroot = format!("{sysroot_env}/{target}/{profile}"); - let expected_sysroot_path = Path::new(&expected_sysroot); - if expected_sysroot_path.exists() { - expected_sysroot + let sysroot_env = env::var("DATAPLANE_SYSROOT").expect("DATAPLANE_SYSROOT not set"); + let sysroot_path = Path::new(&sysroot_env); + if sysroot_path.exists() { + sysroot_env } else { - panic!("sysroot not found at {expected_sysroot}") + panic!("sysroot not found at {sysroot_env}") } } + +pub fn use_sysroot() { + let sysroot = get_sysroot(); + println!("cargo:rustc-link-search=all={sysroot}/lib"); +} diff --git a/dpdk/build.rs b/dpdk/build.rs index 52f5b0197..236576084 100644 --- a/dpdk/build.rs +++ b/dpdk/build.rs @@ -2,7 +2,5 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + dpdk_sysroot_helper::use_sysroot(); } diff --git a/dpdk/src/lcore.rs b/dpdk/src/lcore.rs index 7c35c7b97..12a4dbc48 100644 --- a/dpdk/src/lcore.rs +++ b/dpdk/src/lcore.rs @@ -237,7 +237,7 @@ impl LCoreId { #[tracing::instrument(level = "trace")] pub fn current() -> LCoreId { - LCoreId(unsafe { dpdk_sys::rte_lcore_id_w() }) + LCoreId(unsafe { dpdk_sys::rte_lcore_id() }) } #[tracing::instrument(level = "trace")] diff --git a/hardware/Cargo.toml b/hardware/Cargo.toml index 7d4fbf476..f2ba9813e 100644 --- a/hardware/Cargo.toml +++ b/hardware/Cargo.toml @@ -36,9 +36,9 @@ tracing = { workspace = true, features = ["std"] } [dev-dependencies] # internal -fixin = { workspace = true, features = [] } +# fixin = { workspace = true, features = [] } id = { workspace = true, features = ["serde", "rkyv"] } -n-vm = { workspace = true } +# n-vm = { workspace = true } test-utils = { workspace = true, features = [] } # external @@ -49,6 +49,3 @@ serde = { workspace = true, features = ["std"] } serde_yaml_ng = { workspace = true, features = [] } tokio = { workspace = true } tracing-subscriber = { workspace = true } - -[build-dependencies] -dpdk-sysroot-helper = { workspace = true } diff --git a/hardware/build.rs b/hardware/build.rs index 52f5b0197..1c30f3c66 100644 --- a/hardware/build.rs +++ b/hardware/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/hardware/src/group/README.md b/hardware/src/group/README.md deleted file mode 100644 index 04d15393b..000000000 --- a/hardware/src/group/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Logical hardware groupings - -This module provides types for representing logical groups of hardware -components. Groups are used in hardware topology to represent collections -of related components that don't fit into other specific categories. - -Groups can represent: - -- NUMA distances -- I/O groups -- Logical partitions -- Custom hardware groupings defined by the system diff --git a/hardware/src/group/mod.rs b/hardware/src/group/mod.rs index ac63ce03e..a7a67bd92 100644 --- a/hardware/src/group/mod.rs +++ b/hardware/src/group/mod.rs @@ -1,7 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] +//! # Logical hardware groupings +//! +//! This module provides types for representing logical groups of hardware +//! components. Groups are used in hardware topology to represent collections +//! of related components that don't fit into other specific categories. +//! +//! Groups can represent: +//! +//! - NUMA distances +//! - I/O groups +//! - Logical partitions +//! - Custom hardware groupings defined by the system +//! #[cfg(any(test, feature = "scan"))] #[allow(unused_imports)] // re-export diff --git a/hardware/src/lib.rs b/hardware/src/lib.rs index 70ed25389..ed1765846 100644 --- a/hardware/src/lib.rs +++ b/hardware/src/lib.rs @@ -1,7 +1,49 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors +// +// # Hardware topology discovery and representation + +//! The `hardware` crate provides a unified interface for discovering and representing +//! system hardware topology, including CPU architecture, memory hierarchy, PCI devices, +//! and operating system devices. It builds a hierarchical tree structure representing +//! the relationships between different hardware components. +//! +//! ## Overview +//! +//! This crate is designed to provide detailed information about system hardware topology +//! that is useful for: +//! +//! - **Performance optimization**: Understanding cache hierarchy and NUMA topology +//! - **Device management**: Enumerating and identifying PCI devices and OS devices +//! - **Resource allocation**: Making informed decisions about CPU affinity and memory +//! allocation +//! - **System monitoring**: Gathering hardware configuration information +//! +//! ## Architecture +//! +//! The crate represents hardware topology as a tree of `Node`s, where each node has: +//! +//! - A unique identifier +//! - A type and optional subtype +//! - Optional attributes specific to the hardware component +//! - Zero or more child nodes +//! +//! Node types include: +//! +//! - **NUMA nodes**: Non-Uniform Memory Access regions +//! - **Caches**: L1, L2, L3 cache levels +//! - **PCI devices**: Graphics cards, network adapters, etc. +//! - **Bridges**: PCI bridges connecting different buses +//! - **Groups**: Logical groupings of hardware components +//! - **OS devices**: Block devices, network interfaces, etc. +//! +//! ## Features +//! +//! - `scan`: Enables hardware topology scanning using the `hwlocality` crate. +//! This allows runtime discovery of the system's hardware configuration. +//! - `serde`: Adds serialization support for all types using serde. +//! - `bolero`: Enables fuzzing support for testing. -#![doc = include_str!("../README.md")] #![deny(clippy::pedantic, clippy::unwrap_used)] use id::Id; diff --git a/hardware/src/mem/README.md b/hardware/src/mem/README.md deleted file mode 100644 index 53d309611..000000000 --- a/hardware/src/mem/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Memory Subsystem - -Models hardware memory topology for performance-critical packet processing. - -## Components - -### NUMA - -Represents Non-Uniform Memory Access nodes where memory access time depends on -processor location. - -### Cache Attributes - -Models CPU cache hierarchy (L1/L2/L3). - -- **Types**: Unified, Data, and Instruction caches -- **Properties**: Size and line size -- Helps avoid false sharing and optimize data layouts - -### Page Types - -Represents memory page sizes (e.g., 4KB, 2MB, 1GB). - -- Enables huge page utilization -- Reduces TLB pressure for large memory pools diff --git a/hardware/src/mem/mod.rs b/hardware/src/mem/mod.rs index 0d0769b4b..542c370d1 100644 --- a/hardware/src/mem/mod.rs +++ b/hardware/src/mem/mod.rs @@ -1,7 +1,31 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] +//! # Memory Subsystem +//! +//! Models hardware memory topology for performance-critical packet processing. +//! +//! ## Components +//! +//! ### NUMA +//! +//! Represents Non-Uniform Memory Access nodes where memory access time depends on +//! processor location. +//! +//! ### Cache Attributes +//! +//! Models CPU cache hierarchy (L1/L2/L3). +//! +//! - **Types**: Unified, Data, and Instruction caches +//! - **Properties**: Size and line size +//! - Helps avoid false sharing and optimize data layouts +//! +//! ### Page Types +//! +//! Represents memory page sizes (e.g., 4KB, 2MB, 1GB). +//! +//! - Enables huge page utilization +//! - Reduces TLB pressure for large memory pools pub mod cache; pub mod numa; diff --git a/hardware/src/os/README.md b/hardware/src/os/README.md deleted file mode 100644 index a227cdc50..000000000 --- a/hardware/src/os/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Operating system device representation - -This module provides types for representing devices as seen by the operating -system, including storage devices, network interfaces, GPUs, and other -hardware exposed through the OS. - -## Device Types - -The module supports various OS device types: - -- **Storage**: Block devices, disks, SSDs -- **GPU**: Graphics processing units -- **Network**: Network interfaces -- **OpenFabrics**: High-performance fabric devices (InfiniBand, etc.) -- **DMA**: Direct Memory Access engines -- **CoProcessor**: Specialized compute accelerators -- **Memory**: Memory-like devices (e.g., persistent memory) diff --git a/hardware/src/os/mod.rs b/hardware/src/os/mod.rs index b9b13fe8d..b549ed88d 100644 --- a/hardware/src/os/mod.rs +++ b/hardware/src/os/mod.rs @@ -1,7 +1,23 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] +//! # Operating system device representation +//! +//! This module provides types for representing devices as seen by the operating +//! system, including storage devices, network interfaces, GPUs, and other +//! hardware exposed through the OS. +//! +//! ## Device Types +//! +//! The module supports various OS device types: +//! +//! - **Storage**: Block devices, disks, SSDs +//! - **GPU**: Graphics processing units +//! - **Network**: Network interfaces +//! - **OpenFabrics**: High-performance fabric devices (InfiniBand, etc.) +//! - **DMA**: Direct Memory Access engines +//! - **CoProcessor**: Specialized compute accelerators +//! - **Memory**: Memory-like devices (e.g., persistent memory) #![allow(clippy::doc_markdown)] // abbreviations were trigging spurious backtick lints /// Type of operating system device. diff --git a/hardware/src/pci/README.md b/hardware/src/pci/README.md deleted file mode 100644 index 020760640..000000000 --- a/hardware/src/pci/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# PCI device enumeration and attributes - -This module provides comprehensive support for PCI (Peripheral Component Interconnect) -device representation, including device addressing, attributes, and topology. - -## Overview - -PCI devices are identified by a hierarchical addressing scheme: - -- **Domain**: The PCI domain (segment) number -- **Bus**: The bus number within the domain -- **Device**: The device number on the bus -- **Function**: The function number within the device - -Together these form a PCI address like `0000:03:00.0` - -```mermaid ---- -title: PCI address format ---- -packet -+16: "domain" -+8: "bus" -+5: "device" -+3: "function" -``` diff --git a/hardware/src/pci/mod.rs b/hardware/src/pci/mod.rs index 38b2963a2..2db3640ec 100644 --- a/hardware/src/pci/mod.rs +++ b/hardware/src/pci/mod.rs @@ -1,7 +1,32 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("README.md")] +//! # PCI device enumeration and attributes +//! +//! This module provides comprehensive support for PCI (Peripheral Component Interconnect) +//! device representation, including device addressing, attributes, and topology. +//! +//! ## Overview +//! +//! PCI devices are identified by a hierarchical addressing scheme: +//! +//! - **Domain**: The PCI domain (segment) number +//! - **Bus**: The bus number within the domain +//! - **Device**: The device number on the bus +//! - **Function**: The function number within the device +//! +//! Together these form a PCI address like `0000:03:00.0` +//! +//! ```mermaid +//! --- +//! title: PCI address format +//! --- +//! packet +//! +16: "domain" +//! +8: "bus" +//! +5: "device" +//! +3: "function" +//! ``` use crate::pci::{address::PciAddress, device::DeviceId, vendor::VendorId}; diff --git a/hardware/src/scan.rs b/hardware/src/scan.rs index ef8899164..1e20b49a9 100644 --- a/hardware/src/scan.rs +++ b/hardware/src/scan.rs @@ -225,82 +225,82 @@ mod test { support::{SupportedDevice, SupportedVendor}, }; - #[test] - #[n_vm::in_vm] - fn collect_them_all_and_bind_them() { - let system = Node::scan_all(); - let nics: Vec<_> = system - .iter() - .filter_map(|node| match node.attributes() { - Some(NodeAttributes::Pci(dev)) => { - if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() - && SupportedDevice::VirtioNet - .device_ids() - .contains(&dev.device_id()) - { - let mut nic = PciNic::new(dev.address()).unwrap(); - nic.bind_to_vfio_pci().unwrap(); - Some(nic) - } else { - None - } - } - _ => None, - }) - .collect(); - assert_eq!(nics.len(), 3, "expected exactly 3 virtio network cards"); - } + // #[test] + // #[n_vm::in_vm] + // fn collect_them_all_and_bind_them() { + // let system = Node::scan_all(); + // let nics: Vec<_> = system + // .iter() + // .filter_map(|node| match node.attributes() { + // Some(NodeAttributes::Pci(dev)) => { + // if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() + // && SupportedDevice::VirtioNet + // .device_ids() + // .contains(&dev.device_id()) + // { + // let mut nic = PciNic::new(dev.address()).unwrap(); + // nic.bind_to_vfio_pci().unwrap(); + // Some(nic) + // } else { + // None + // } + // } + // _ => None, + // }) + // .collect(); + // assert_eq!(nics.len(), 3, "expected exactly 3 virtio network cards"); + // } - #[test] - #[n_vm::in_vm] - fn bind_fabric_nics_and_skip_mgmt_nic() { - let system = Node::scan_all(); - let mgmt_nic_pci_address = "0000:00:02.0".try_into().unwrap(); - let nics: Vec<_> = system - .iter() - .filter_map(|node| match node.attributes() { - Some(NodeAttributes::Pci(dev)) => { - if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() - && SupportedDevice::VirtioNet - .device_ids() - .contains(&dev.device_id()) - && dev.address() != mgmt_nic_pci_address - { - let mut nic = PciNic::new(dev.address()).unwrap(); - nic.bind_to_vfio_pci().unwrap(); - Some(nic) - } else { - None - } - } - _ => None, - }) - .collect(); - assert_eq!(nics.len(), 2, "expected exactly 2 virtio network cards"); - } + // #[test] + // #[n_vm::in_vm] + // fn bind_fabric_nics_and_skip_mgmt_nic() { + // let system = Node::scan_all(); + // let mgmt_nic_pci_address = "0000:00:02.0".try_into().unwrap(); + // let nics: Vec<_> = system + // .iter() + // .filter_map(|node| match node.attributes() { + // Some(NodeAttributes::Pci(dev)) => { + // if dev.vendor_id() == SupportedVendor::RedHat.vendor_id() + // && SupportedDevice::VirtioNet + // .device_ids() + // .contains(&dev.device_id()) + // && dev.address() != mgmt_nic_pci_address + // { + // let mut nic = PciNic::new(dev.address()).unwrap(); + // nic.bind_to_vfio_pci().unwrap(); + // Some(nic) + // } else { + // None + // } + // } + // _ => None, + // }) + // .collect(); + // assert_eq!(nics.len(), 2, "expected exactly 2 virtio network cards"); + // } - #[test] - #[n_vm::in_vm] - fn bind_nic_test() { - let system = Node::scan_all(); - let target_pci_address = "0001:00:02.0".try_into().unwrap(); - let Some(mut nic) = system.iter().find_map(|node| match node.attributes() { - Some(NodeAttributes::Pci(dev)) => { - if dev.address() == target_pci_address - && dev.vendor_id() == SupportedVendor::RedHat.vendor_id() - && SupportedDevice::VirtioNet - .device_ids() - .contains(&dev.device_id()) - { - Some(PciNic::new(dev.address()).unwrap()) - } else { - None - } - } - _ => None, - }) else { - panic!("target nic not found"); - }; - nic.bind_to_vfio_pci().unwrap(); - } + // #[test] + // #[n_vm::in_vm] + // fn bind_nic_test() { + // let system = Node::scan_all(); + // let target_pci_address = "0001:00:02.0".try_into().unwrap(); + // let Some(mut nic) = system.iter().find_map(|node| match node.attributes() { + // Some(NodeAttributes::Pci(dev)) => { + // if dev.address() == target_pci_address + // && dev.vendor_id() == SupportedVendor::RedHat.vendor_id() + // && SupportedDevice::VirtioNet + // .device_ids() + // .contains(&dev.device_id()) + // { + // Some(PciNic::new(dev.address()).unwrap()) + // } else { + // None + // } + // } + // _ => None, + // }) else { + // panic!("target nic not found"); + // }; + // nic.bind_to_vfio_pci().unwrap(); + // } } diff --git a/init/Cargo.toml b/init/Cargo.toml index 0b8f2a8ac..e28ff9696 100644 --- a/init/Cargo.toml +++ b/init/Cargo.toml @@ -5,6 +5,10 @@ license.workspace = true publish.workspace = true version.workspace = true +[features] +default = [] +sysroot = ["dep:dpdk-sysroot-helper"] + [dependencies] # internal hardware = { workspace = true, features = ["serde", "scan"] } @@ -27,6 +31,6 @@ tracing-subscriber = { workspace = true, features = ["fmt"] } [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } +dpdk-sysroot-helper = { workspace = true, optional = true } # external diff --git a/init/build.rs b/init/build.rs index 52f5b0197..1fc109eb8 100644 --- a/init/build.rs +++ b/init/build.rs @@ -2,7 +2,6 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + #[cfg(feature = "sysroot")] + dpdk_sysroot_helper::use_sysroot(); } diff --git a/init/src/main.rs b/init/src/main.rs index e32833636..8a0b6c688 100644 --- a/init/src/main.rs +++ b/init/src/main.rs @@ -1,7 +1,56 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -#![doc = include_str!("../README.md")] +//! # dataplane-init +//! +//! This program is responsible for initializing the dataplane. +//! +//! The primary steps of this program are to: +//! +//! 1. Drive the NIC into the configuration needed by DPDK to use the NIC +//! 2. (TODO) Drop some hazardous privileges (especially [`CAP_SYS_ADMIN`]) +//! 3. (TODO) `exec` the dataplane process on success +//! +//! For most network cards, this configuration step involves unbinding the NIC from the kernel driver and re-binding it to +//! the [vfio-pci] driver. +//! +//! **Note**: Not all NICs should be bound to [vfio-pci]. +//! Some network cards use the so-called bifurcated driver and must remain bound to the kernel driver. +//! In particular, all network cards which use the mlx5 driver must remain bound to the [mlx5] kernel driver. +//! +//! **Warning**: This program is _not_ responsible for full life cycle management of the NIC. +//! In particular, it makes no attempt to rebind the NIC back to the kernel driver. +//! Thus, expect this program to make network cards disappear from the perspective of tooling like [iproute2] and [ethtool]. +//! +//! Only a very limited set of network cards are currently supported, although this set can easily be expanded over time. +//! +//! ## Error Handling Strategy +//! +//! As a short-lived program which is only run once per gateway initialization, this program has significantly different +//! error handling requirements from the other software in this workspace. +//! +//! Essentially, it will either succeed or fail, and if it fails it will likely require outside intervention to recover. +//! There is little we can or should attempt to do in terms of sophisticated error handling beyond logging clear error +//! messages. +//! +//! ## Privileges +//! +//! This program is, by necessity, run with elevated privileges. +//! As such, we need to take special caution when writing to files. +//! +//! Because [sysfs] is basically a maze of symlinks, it is important to be careful when manipulating paths under [sysfs]. +//! Mistakes can lead you to write data in highly unexpected places, with totally unknown consequences. +//! Some care has been taken in the design of the types used here to discourage programmer errors which might lead to +//! unintended writes by a privileged process. +//! +//! +//! [iproute2]: https://www.kernel.org/pub/linux/utils/net/iproute2/ +//! [ethtool]: https://www.kernel.org/pub/linux/utils/net/ethtool/ +//! [sysfs]: https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt +//! [vfio-pci]: https://docs.kernel.org/driver-api/vfio.html +//! [mlx5]: https://docs.kernel.org/networking/device_drivers/ethernet/mellanox/mlx5/index.html +//! [`CAP_SYS_ADMIN`]: + #![deny(clippy::pedantic, missing_docs)] use hardware::nic::{BindToVfioPci, PciNic}; diff --git a/justfile b/justfile index 10d23f344..0b6d5edb4 100644 --- a/justfile +++ b/justfile @@ -158,15 +158,15 @@ cargo *args: for arg in "${args[@]}"; do case "$arg" in --debug|--profile=debug|--cargo-profile=debug) - declare -rx RUSTFLAGS="${RUSTFLAGS_DEBUG}" + declare -x RUSTFLAGS="${RUSTFLAGS_DEBUG}" declare -rx LIBC_ENV_PROFILE="debug" ;; --release|--profile=release|--cargo-profile=release) - declare -rx RUSTFLAGS="${RUSTFLAGS_RELEASE}" + declare -x RUSTFLAGS="${RUSTFLAGS_RELEASE}" extra_args+=("$arg") ;; --profile=fuzz|--cargo-profile=fuzz) - declare -rx RUSTFLAGS="${RUSTFLAGS_FUZZ}" + declare -x RUSTFLAGS="${RUSTFLAGS_FUZZ}" export RUSTC_BOOTSTRAP=1 extra_args+=("$arg") ;; @@ -176,10 +176,11 @@ cargo *args: esac done if [ -z "${RUSTFLAGS:-}" ]; then - declare -rx RUSTFLAGS="${RUSTFLAGS_DEBUG}" + #declare -x RUSTFLAGS="${RUSTFLAGS_DEBUG}" + unset RUSTFLAGS fi - export RUSTDOCFLAGS="${RUSTDOCFLAGS:-} ${RUSTFLAGS} --html-in-header $(pwd)/scripts/doc/custom-header.html" + #export RUSTDOCFLAGS="${RUSTDOCFLAGS:-} ${RUSTFLAGS} --html-in-header $(pwd)/scripts/doc/custom-header.html" ./compile-env/bin/cargo "${extra_args[@]}" # Run the (very minimal) compile environment diff --git a/k8s-intf/Cargo.toml b/k8s-intf/Cargo.toml index a3efed406..73d542f03 100644 --- a/k8s-intf/Cargo.toml +++ b/k8s-intf/Cargo.toml @@ -37,5 +37,5 @@ lpm = { workspace = true, features = [] } net = { workspace = true, features = ["bolero", "test_buffer"] } [build-dependencies] -dotenvy = { workspace = true, features = [] } -ureq = { workspace = true, features = ["rustls", "gzip"] } +# dotenvy = { workspace = true, features = [] } +# ureq = { workspace = true, features = ["rustls", "gzip"] } diff --git a/k8s-intf/build.rs b/k8s-intf/build.rs index 05d58f45d..1db474cd1 100644 --- a/k8s-intf/build.rs +++ b/k8s-intf/build.rs @@ -1,47 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors -use std::env; use std::fs; +use std::io::Read; use std::path::PathBuf; -fn workspace_root() -> PathBuf { - PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set")) - .ancestors() - .nth(1) - .expect("Workspace root not found") - .to_path_buf() -} - -fn get_agent_crd_url() -> String { - let env_file_path = workspace_root().join("scripts").join("k8s-crd.env"); - println!("cargo:rerun-if-changed={}", env_file_path.display()); - - let env_file = - dotenvy::from_path_iter(env_file_path).expect("Failed to read scripts/k8s-crd.env"); - - env_file - .filter_map(Result::ok) - .find_map(|(key, value)| { - if key == "K8S_GATEWAY_AGENT_CRD_URL" { - Some(value) - } else { - None - } - }) - .expect("K8S_GATEWAY_AGENT_CRD_URL not found in scripts/k8s-crd.env") -} - -fn fetch_crd(url: &str) -> String { - println!("cargo:note=Fetching CRD from: {url}"); - ureq::get(url) - .call() - .expect("Failed to fetch agent CRD from url") - .body_mut() - .read_to_string() - .expect("Failed to read response body") -} - const LICENSE_PREAMBLE: &str = "// SPDX-License-Identifier: Apache-2.0 // Copyright Open Network Fabric Authors @@ -126,8 +89,31 @@ fn code_needs_regen(new_code: &str) -> bool { } fn main() { - let agent_crd_url = get_agent_crd_url(); - let agent_crd_contents = fetch_crd(&agent_crd_url); + let agent_crd_contents = { + let agent_crd_path = + PathBuf::from(std::env::var("GW_CRD_PATH").expect("GW_CRD_PATH var unset")) + .join("gwint.githedgehog.com_gatewayagents.yaml"); + let mut agent_crd_file = std::fs::OpenOptions::new() + .read(true) + .write(false) + .open(&agent_crd_path) + .unwrap_or_else(|e| { + panic!( + "failed to open {path}: {e}", + path = agent_crd_path.to_str().expect("non unicode crd path") + ) + }); + let mut contents = String::with_capacity( + agent_crd_file + .metadata() + .expect("unable to get crd metadata") + .len() as usize, + ); + agent_crd_file + .read_to_string(&mut contents) + .unwrap_or_else(|e| panic!("unable to read crd data into string: {e}")); + contents + }; let agent_generated_code = generate_rust_for_crd(&agent_crd_contents); if !code_needs_regen(&agent_generated_code) { diff --git a/net/src/buffer/test_buffer.rs b/net/src/buffer/test_buffer.rs index 1b6829a06..f50ba01b6 100644 --- a/net/src/buffer/test_buffer.rs +++ b/net/src/buffer/test_buffer.rs @@ -14,16 +14,14 @@ use crate::buffer::{ }; use tracing::trace; -// only included for doc ref -#[cfg(doc)] -use crate::buffer::PacketBuffer; - // Caution: do not implement Clone for `TestBuffer`. // Clone would significantly deviate from the actual mechanics of a DPDK mbuf. /// Toy data structure which implements [`PacketBuffer`] /// /// The core function of this structure is to facilitate testing by "faking" many useful properties /// of a real DPDK mbuf (without the need to spin up a full EAL). +/// +/// [`PacketBuffer`]: crate::buffer::PacketBuffer #[derive(Debug, Clone)] pub struct TestBuffer { buffer: Vec, diff --git a/nix/overlays/dataplane-dev.nix b/nix/overlays/dataplane-dev.nix new file mode 100644 index 000000000..e548ef9e8 --- /dev/null +++ b/nix/overlays/dataplane-dev.nix @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + sources, + ... +}: +final: prev: +let + override-packages = { + stdenv = final.llvmPackages.stdenv; + rustPlatform = final.rustPlatform'-dev; + }; +in +{ + kopium = import ../pkgs/kopium ( + override-packages + // { + src = sources.kopium; + } + ); + cargo-bolero = prev.cargo-bolero.override { inherit (override-packages) rustPlatform; }; + cargo-deny = prev.cargo-deny.override { inherit (override-packages) rustPlatform; }; + cargo-llvm-cov = prev.cargo-llvm-cov.override override-packages; + cargo-nextest = prev.cargo-nextest.override override-packages; + just = prev.just.override override-packages; + npins = prev.npins.override { inherit (override-packages) rustPlatform; }; + gateway-crd = + let + p = "config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml"; + in + final.writeTextFile { + name = "gateway-crd"; + text = builtins.readFile "${sources.gateway}/${p}"; + executable = false; + destination = "/src/gateway/${p}"; + }; +} diff --git a/nix/overlays/dataplane.nix b/nix/overlays/dataplane.nix new file mode 100644 index 000000000..f61090748 --- /dev/null +++ b/nix/overlays/dataplane.nix @@ -0,0 +1,244 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + sources, + sanitizers, + ... +}: +final: prev: +let + dataplane-dep = pkg: pkg.override { stdenv = final.stdenv'; }; +in +{ + # libmd is used by libbsd (et al) which is an optional dependency of dpdk. + # + # We _might_ actually care about perf here, so we lto this package. + # At minimum, the provided functions are generally quite small and likely to benefit from inlining, so static linking + # is a solid plan. + fancy.libmd = (dataplane-dep prev.libmd).overrideAttrs (orig: { + outputs = (orig.outputs or [ "out" ]) ++ [ + "man" + "dev" + "static" + ]; + # we need to enable shared libs (in addition to static) to make dpdk's build happy. Basically, DPDK's build has no + # means of disabling shared libraries, and it doesn't really make any sense to static link this into each .so + # file. Ideally we would just _not_ build those .so files, but that would require doing brain surgery on dpdk's + # meson build, and maintaining such a change set is not worth it to avoid building some .so files. + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p "$static/lib"; + mv $out/lib/*.a $static/lib; + ''; + }); + + # This is a (technically optional) dependency of DPDK used for secure string manipulation and some hashes we value; + # static link + lto for sure. + # + # This is also a reasonably important target for `-fsanitize=cfi` and or `-fsanitize=safe-stack` as libbsd provides + # more secure versions of classic C string manipulation utilities, and I'm all about that defense-in-depth. + fancy.libbsd = + ((dataplane-dep prev.libbsd).override { libmd = final.fancy.libmd; }).overrideAttrs + (orig: { + outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; + # we need to enable shared (in addition to static) to build dpdk. + # See the note on libmd for reasoning. + configureFlags = orig.configureFlags ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p "$static/lib"; + mv $out/lib/*.a $static/lib; + ''; + }); + + # This is (for better or worse) used by dpdk to parse / manipulate netlink messages. + # + # We don't care about performance here, so this may be a good candidate for size reduction compiler flags like -Os. + # + # That said, we don't currently have infrastructure to pass flags at a per package level and building that is more + # trouble than a minor reduction in binary size / instruction cache pressure is likely worth. Also, lto doesn't + # currently love size optimizations. The better option is likely to use PGO + BOLT to put these functions far away + # from the hot path in the final ELF file's layout and just ignore that this stuff is compiled with -O3 and friends. + # + # More, this is a very low level library designed to send messages between a privileged process and the kernel. + # The simple fact that this appears in our toolchain justifies sanitizers like safe-stack and cfi and/or flags like + # -fcf-protection=full. + fancy.libnl = (dataplane-dep prev.libnl).overrideAttrs (orig: { + outputs = (orig.outputs or [ "out" ]) ++ [ "static" ]; + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib + find $out/lib -name '*.la' -exec rm {} \; + mv $out/lib/*.a $static/lib/ + ''; + }); + + # This is needed by DPDK in order to determine which pinned core runs on which numa node and which NIC is most + # efficiently connected to which NUMA node. You can disable the need for this library entirely by editing dpdk's + # build to specify `-Dmax_numa_nodes=1`. + # + # While we don't currently hide NUMA mechanics from DPDK, there is something to be said for eliminating this library + # from our toolchain as a fair level of permissions and a lot of different low level trickery is required to make it + # function. In "the glorious future" we should bump all of this logic up to the dataplane's init process, compute + # what we need to, pre-mmap _all_ of our heap memory, configure our cgroups and CPU affinities, and then pin our cores + # and use memory pools local to the numa node of the pinned core. That would be a fair amount of work, but it would + # eliminate a dependency and likely increase the performance and security of the dataplane. + # + # For now, we leave this on so DPDK can do some of that for us. That said, this logic is quite cold and would ideally + # be size optimized and punted far from all hot paths. BOLT should be helpful here. + fancy.numactl = (dataplane-dep prev.numactl).overrideAttrs (orig: { + outputs = (prev.lib.lists.remove "man" orig.outputs) ++ [ "static" ]; + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p "$static/lib"; + mv $out/lib/*.a $static/lib; + ''; + }); + + # This is one of the two most important to optimize components of the whole build (along with dpdk itself). + # + # RDMA-core is the low level building block for many of the PMDs within DPDK including the mlx5 PMD. It is a + # performance and security critical library which we will likely never be able to remove from our dependencies. + # + # Some of this library is almost always called in a very tight loop, especially as used by DPDK PMDs. It is happy to + # link dynamically or statically, and we should make a strong effort to make sure that we always pick static linking + # to enable inlining (wherever the compiler decides it makes sense). You very likely want to enable lto here in any + # release build. + fancy.rdma-core = + ((dataplane-dep prev.rdma-core).override { + docutils = null; + ethtool = null; + iproute2 = null; + libnl = final.fancy.libnl; + pandoc = null; + udev = null; + udevCheckHook = null; + }).overrideAttrs + (orig: { + version = sources.rdma-core.branch; + src = sources.rdma-core.outPath; + + # Patching the shebang lines in the perl scripts causes nixgraph to (incorrectly) think we depend on perl at + # runtime. We absolutely do not (we don't even ship a perl interpreter), so don't patch these shebang lines. + # In fact, we don't use any of the scripts from this package. + dontPatchShebangs = true; + + # The upstream postFixup is broken by dontPatchShebangs = true + # It's whole function was to further mutate the shebang lines in perl scripts, so we don't care. + # Just null it. + postFixup = null; + + outputs = (orig.outputs or [ ]) ++ [ + "static" + ]; + # CMake depends on -Werror to function, but the test program it uses to confirm that -Werror works "always produces + # warnings." The reason for this is that we have injected our own CFLAGS and they have nothing to do with the + # trivial program. This causes the unused-command-line-argument warning to trigger. + # We disable that warning here to make sure rdma-core can build (more specifically, to make sure that it can build + # with debug symbols). + CFLAGS = "-Wno-unused-command-line-argument"; + cmakeFlags = + orig.cmakeFlags + ++ [ + "-DENABLE_STATIC=1" + # we don't need pyverbs, and turning it off reduces build time / complexity. + "-DNO_PYVERBS=1" + # no need for docs in container images. + "-DNO_MAN_PAGES=1" + # we don't care about this lib's exported symbols / compat situation _at all_ because we static link (which + # doesn't have symbol versioning in the first place). Turning this off just reduces the build's internal + # complexity and makes lto easier. + "-DNO_COMPAT_SYMS=1" + # IOCTL_MODE can be "write" or "ioctl" or "both" (default). + # Very old versions of rdma-core used what they call the "legacy write path" to support rdma-operations. + # These have (long since) been superseded by the ioctl mode, but the library generates both code paths by + # default due to rdma-core's fairly aggressive backwards compatibility stance. + # We have absolutely no need or desire to support the legacy mode, and we can potentially save ourselves + # some instruction cache pressure by disabling that old code at compile time. + "-DIOCTL_MODE=ioctl" + ] + ++ + final.lib.optionals + ( + (builtins.elem "thread" sanitizers) + || (builtins.elem "address" sanitizers) + || (builtins.elem "safe-stack" sanitizers) + ) + [ + # This allows address / thread sanitizer to build (thread/ub sanitizers do not like -Wl,-z,defs or + # -Wl,--no-undefined). + # This isn't a hack: undefined symbols from sanitizers is a known issue and is not unique to us. + "-DSUPPORTS_NO_UNDEFINED=0" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib $man; + mv $out/lib/*.a $static/lib/ + mv $out/share $man/ + ''; + }); + + # Compiling DPDK is the primary objective of this overlay. + # + # We care _a lot_ about how this is compiled and should always use flags which are either optimized for performance + # or debugging. After all, if you aren't doing something performance critical then I don't know why you want DPDK at + # all :) + # + # Also, while this library has a respectable security track record, this is also a very strong candidate for + # cfi, safe-stack, and cf-protection. + fancy.dpdk = dataplane-dep ( + final.callPackage ../pkgs/dpdk (final.fancy // { src = sources.dpdk; }) + ); + + # DPDK is largely composed of static-inline functions. + # We need to wrap those functions with "_w" variants so that we can actually call them from rust. + # + # This wrapping process does not really cause any performance issue due to lto; the compiler is going to "unwrap" + # these methods anyway. + fancy.dpdk-wrapper = dataplane-dep (final.callPackage ../pkgs/dpdk-wrapper final.fancy); + + # TODO: consistent packages + fancy.pciutils = dataplane-dep ( + final.pciutils.override { + static = true; + kmod = null; + zlib = null; + } + ); + + fancy.libunwind = (dataplane-dep final.llvmPackages.libunwind).override { enableShared = false; }; + + # TODO: consistent packages, min deps + fancy.hwloc = + ((dataplane-dep prev.hwloc).override { + inherit (final.fancy) numactl; + cairo = null; + cudaPackages = null; + enableCuda = false; + expat = null; + libX11 = null; + ncurses = null; + x11Support = false; + }).overrideAttrs + (orig: { + outputs = (orig.outputs or [ ]) ++ [ "static" ]; + configureFlags = (orig.configureFlags or [ ]) ++ [ + "--enable-static" + ]; + postInstall = (orig.postInstall or "") + '' + mkdir -p $static/lib + mv $lib/lib/*.a $static/lib/ + ''; + }); + + # This isn't directly required by dataplane, + fancy.perftest = dataplane-dep ( + final.callPackage ../pkgs/perftest final.fancy // { src = sources.perftest; } + ); +} diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix new file mode 100644 index 000000000..b54445b75 --- /dev/null +++ b/nix/overlays/default.nix @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +inputs@{ + sources, + ... +}: +{ + rust = import sources.rust-overlay; + llvm = import ./llvm.nix inputs; # requires rust + dataplane = import ./dataplane.nix inputs; # requires llvm + dataplane-dev = import ./dataplane-dev.nix inputs; # requires llvm +} diff --git a/nix/overlays/llvm.nix b/nix/overlays/llvm.nix new file mode 100644 index 000000000..4e7f4f977 --- /dev/null +++ b/nix/overlays/llvm.nix @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + platform, + profile, + ... +}: +final: prev: +let + helpers.addToEnv = + new: orig: + orig + // ( + with builtins; (mapAttrs (var: val: (toString (orig.${var} or "")) + " " + (toString val)) new) + ); + adapt = final.stdenvAdapters; + bintools = final.pkgsBuildHost.llvmPackages.bintools; + lld = final.pkgsBuildHost.llvmPackages.lld; + added-to-env = helpers.addToEnv platform.override.stdenv.env profile; + stdenv' = adapt.addAttrsToDerivation (orig: { + doCheck = false; + separateDebugInfo = true; + env = helpers.addToEnv added-to-env (orig.env or { }); + nativeBuildInputs = (orig.nativeBuildInputs or [ ]) ++ [ + bintools + lld + ]; + }) final.llvmPackages.stdenv; + # note: rust-bin comes from oxa's overlay, not nixpkgs. This overlay only works if you have a rust overlay as well. + rust-toolchain = prev.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml; + rustPlatform' = prev.makeRustPlatform { + stdenv = stdenv'; + cargo = rust-toolchain; + rustc = rust-toolchain; + }; + rustPlatform'-dev = prev.makeRustPlatform { + stdenv = final.llvmPackages.stdenv; + cargo = rust-toolchain; + rustc = rust-toolchain; + }; + # It is essential that we always use the same version of llvm that our rustc is backed by. + # To minimize maintenance burden, we explicitly compute the version of LLVM we need by asking rustc + # which version it is using. + # This is significantly less error prone than hunting around for all versions of pkgs.llvmPackages_${version} + # every time rust updates. + # Unfortunately, this is also IFD, so it slows down the nix build a bit :shrug: + llvm-version = builtins.readFile ( + prev.runCommand "llvm-version-for-our-rustc" + { + RUSTC = "${rust-toolchain.out}/bin/rustc"; + GREP = "${prev.pkgsBuildHost.gnugrep}/bin/grep"; + SED = "${prev.pkgsBuildHost.gnused}/bin/sed"; + } + '' + $RUSTC --version --verbose | \ + $GREP '^LLVM version:' | \ + $SED -z 's|LLVM version: \([0-9]\+\)\.[0-9]\+\.[0-9]\+\n|\1|' > $out + '' + ); +in +{ + inherit rust-toolchain rustPlatform' rustPlatform'-dev stdenv'; + llvmPackages' = prev."llvmPackages_${llvm-version}"; +} diff --git a/nix/pkgs/dpdk-wrapper/default.nix b/nix/pkgs/dpdk-wrapper/default.nix new file mode 100644 index 000000000..4ea99b383 --- /dev/null +++ b/nix/pkgs/dpdk-wrapper/default.nix @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + stdenv, + dpdk, + libbsd, + ... +}: +stdenv.mkDerivation { + pname = "dpdk-wrapper"; + version = dpdk.version; + + src = ./src; + + nativeBuildInptus = [ + dpdk + libbsd + ]; + + outputs = [ + "dev" + "out" + ]; + + # DPDK marks all experimental apis as deprecated, but we wish to wrap such apis as well. Thus, turn off deprecation + # warnings. + CFLAGS = [ "-Wno-deprecated-declarations" ]; + + buildPhase = '' + set euxo pipefail + mkdir -p $dev/include $out/lib + $CC $CFLAGS -I${dpdk}/include -I${libbsd.dev}/include -c $src/dpdk_wrapper.c -o wrapper.o; + $AR rcs $out/lib/libdpdk_wrapper.a wrapper.o; + $RANLIB $out/lib/libdpdk_wrapper.a; + cp $src/*.h $dev/include + ''; + +} diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c new file mode 100644 index 000000000..2309a4ec9 --- /dev/null +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.c @@ -0,0 +1,1518 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Open Network Fabric Authors + +#include "dpdk_wrapper.h" + +int rte_errno_get() { return rte_errno; } + +// Static wrappers + +int rte_is_aligned_w(const void *const ptr, const unsigned int align) { + return rte_is_aligned(ptr, align); +} +void rte_atomic_thread_fence_w(rte_memory_order memorder) { + rte_atomic_thread_fence(memorder); +} +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src) { + return rte_atomic16_cmpset(dst, exp, src); +} +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val) { + return rte_atomic16_exchange(dst, val); +} +void rte_atomic16_init_w(rte_atomic16_t *v) { rte_atomic16_init(v); } +int16_t rte_atomic16_read_w(const rte_atomic16_t *v) { + return rte_atomic16_read(v); +} +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value) { + rte_atomic16_set(v, new_value); +} +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc) { + rte_atomic16_add(v, inc); +} +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec) { + rte_atomic16_sub(v, dec); +} +void rte_atomic16_inc_w(rte_atomic16_t *v) { rte_atomic16_inc(v); } +void rte_atomic16_dec_w(rte_atomic16_t *v) { rte_atomic16_dec(v); } +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc) { + return rte_atomic16_add_return(v, inc); +} +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec) { + return rte_atomic16_sub_return(v, dec); +} +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_inc_and_test(v); +} +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v) { + return rte_atomic16_dec_and_test(v); +} +int rte_atomic16_test_and_set_w(rte_atomic16_t *v) { + return rte_atomic16_test_and_set(v); +} +void rte_atomic16_clear_w(rte_atomic16_t *v) { rte_atomic16_clear(v); } +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src) { + return rte_atomic32_cmpset(dst, exp, src); +} +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val) { + return rte_atomic32_exchange(dst, val); +} +void rte_atomic32_init_w(rte_atomic32_t *v) { rte_atomic32_init(v); } +int32_t rte_atomic32_read_w(const rte_atomic32_t *v) { + return rte_atomic32_read(v); +} +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value) { + rte_atomic32_set(v, new_value); +} +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc) { + rte_atomic32_add(v, inc); +} +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec) { + rte_atomic32_sub(v, dec); +} +void rte_atomic32_inc_w(rte_atomic32_t *v) { rte_atomic32_inc(v); } +void rte_atomic32_dec_w(rte_atomic32_t *v) { rte_atomic32_dec(v); } +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc) { + return rte_atomic32_add_return(v, inc); +} +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec) { + return rte_atomic32_sub_return(v, dec); +} +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_inc_and_test(v); +} +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v) { + return rte_atomic32_dec_and_test(v); +} +int rte_atomic32_test_and_set_w(rte_atomic32_t *v) { + return rte_atomic32_test_and_set(v); +} +void rte_atomic32_clear_w(rte_atomic32_t *v) { rte_atomic32_clear(v); } +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src) { + return rte_atomic64_cmpset(dst, exp, src); +} +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val) { + return rte_atomic64_exchange(dst, val); +} +void rte_atomic64_init_w(rte_atomic64_t *v) { rte_atomic64_init(v); } +int64_t rte_atomic64_read_w(rte_atomic64_t *v) { return rte_atomic64_read(v); } +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value) { + rte_atomic64_set(v, new_value); +} +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc) { + rte_atomic64_add(v, inc); +} +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec) { + rte_atomic64_sub(v, dec); +} +void rte_atomic64_inc_w(rte_atomic64_t *v) { rte_atomic64_inc(v); } +void rte_atomic64_dec_w(rte_atomic64_t *v) { rte_atomic64_dec(v); } +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc) { + return rte_atomic64_add_return(v, inc); +} +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec) { + return rte_atomic64_sub_return(v, dec); +} +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_inc_and_test(v); +} +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v) { + return rte_atomic64_dec_and_test(v); +} +int rte_atomic64_test_and_set_w(rte_atomic64_t *v) { + return rte_atomic64_test_and_set(v); +} +void rte_atomic64_clear_w(rte_atomic64_t *v) { rte_atomic64_clear(v); } +void rte_smp_mb_w(void) { rte_smp_mb(); } +uint64_t rte_get_tsc_cycles_w(void) { return rte_get_tsc_cycles(); } +uint64_t rte_get_timer_cycles_w(void) { return rte_get_timer_cycles(); } +uint64_t rte_get_timer_hz_w(void) { return rte_get_timer_hz(); } +void rte_delay_ms_w(unsigned int ms) { rte_delay_ms(ms); } +uint64_t rte_rdtsc_w(void) { return rte_rdtsc(); } +uint64_t rte_rdtsc_precise_w(void) { return rte_rdtsc_precise(); } +size_t rte_strlcpy_w(char *dst, const char *src, size_t size) { + return rte_strlcpy(dst, src, size); +} +size_t rte_strlcat_w(char *dst, const char *src, size_t size) { + return rte_strlcat(dst, src, size); +} +const char *rte_str_skip_leading_spaces_w(const char *src) { + return rte_str_skip_leading_spaces(src); +} +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src) { + rte_uuid_copy(dst, src); +} +int rte_gettid_w(void) { return rte_gettid(); } +unsigned int rte_lcore_id_w(void) { return rte_lcore_id(); } +void rte_pause_w(void) { rte_pause(); } +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_16(addr, expected, memorder); +} +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_32(addr, expected, memorder); +} +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder) { + rte_wait_until_equal_64(addr, expected, memorder); +} +void rte_spinlock_init_w(rte_spinlock_t *sl) { rte_spinlock_init(sl); } +void rte_spinlock_lock_w(rte_spinlock_t *sl) { rte_spinlock_lock(sl); } +void rte_spinlock_unlock_w(rte_spinlock_t *sl) { rte_spinlock_unlock(sl); } +int rte_spinlock_trylock_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock(sl); +} +int rte_spinlock_is_locked_w(rte_spinlock_t *sl) { + return rte_spinlock_is_locked(sl); +} +int rte_tm_supported_w(void) { return rte_tm_supported(); } +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl) { rte_spinlock_lock_tm(sl); } +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl) { + rte_spinlock_unlock_tm(sl); +} +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl) { + return rte_spinlock_trylock_tm(sl); +} +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_init(slr); +} +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock(slr); +} +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock(slr); +} +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock(slr); +} +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_lock_tm(slr); +} +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr) { + rte_spinlock_recursive_unlock_tm(slr); +} +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr) { + return rte_spinlock_recursive_trylock_tm(slr); +} +// unsigned int rte_xbegin_w(void) { return rte_xbegin(); } +// void rte_xend_w(void) { rte_xend(); } +// int rte_xtest_w(void) { return rte_xtest(); } +// int rte_try_tm_w(int *lock) { return rte_try_tm(lock); } +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_get32(nr, addr); +} +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_set32(nr, addr); +} +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr) { + rte_bit_relaxed_clear32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_set32(nr, addr); +} +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr) { + return rte_bit_relaxed_test_and_clear32(nr, addr); +} +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_get64(nr, addr); +} +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_set64(nr, addr); +} +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr) { + rte_bit_relaxed_clear64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_set64(nr, addr); +} +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr) { + return rte_bit_relaxed_test_and_clear64(nr, addr); +} +unsigned int rte_clz32_w(uint32_t v) { return rte_clz32(v); } +unsigned int rte_clz64_w(uint64_t v) { return rte_clz64(v); } +unsigned int rte_ctz32_w(uint32_t v) { return rte_ctz32(v); } +unsigned int rte_ctz64_w(uint64_t v) { return rte_ctz64(v); } +unsigned int rte_popcount32_w(uint32_t v) { return rte_popcount32(v); } +unsigned int rte_popcount64_w(uint64_t v) { return rte_popcount64(v); } +uint32_t rte_combine32ms1b_w(uint32_t x) { return rte_combine32ms1b(x); } +uint64_t rte_combine64ms1b_w(uint64_t v) { return rte_combine64ms1b(v); } +uint32_t rte_bsf32_w(uint32_t v) { return rte_bsf32(v); } +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos) { + return rte_bsf32_safe(v, pos); +} +uint32_t rte_bsf64_w(uint64_t v) { return rte_bsf64(v); } +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos) { + return rte_bsf64_safe(v, pos); +} +uint32_t rte_fls_u32_w(uint32_t x) { return rte_fls_u32(x); } +uint32_t rte_fls_u64_w(uint64_t x) { return rte_fls_u64(x); } +int rte_is_power_of_2_w(uint32_t n) { return rte_is_power_of_2(n); } +uint32_t rte_align32pow2_w(uint32_t x) { return rte_align32pow2(x); } +uint32_t rte_align32prevpow2_w(uint32_t x) { return rte_align32prevpow2(x); } +uint64_t rte_align64pow2_w(uint64_t v) { return rte_align64pow2(v); } +uint64_t rte_align64prevpow2_w(uint64_t v) { return rte_align64prevpow2(v); } +uint32_t rte_log2_u32_w(uint32_t v) { return rte_log2_u32(v); } +uint32_t rte_log2_u64_w(uint64_t v) { return rte_log2_u64(v); } +void rte_rwlock_init_w(rte_rwlock_t *rwl) { rte_rwlock_init(rwl); } +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl) { rte_rwlock_read_lock(rwl); } +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_read_trylock(rwl); +} +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock(rwl); +} +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_trylock(rwl); +} +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl) { rte_rwlock_write_lock(rwl); } +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock(rwl); +} +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl) { + return rte_rwlock_write_is_locked(rwl); +} +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_lock_tm(rwl); +} +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_read_unlock_tm(rwl); +} +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_lock_tm(rwl); +} +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl) { + rte_rwlock_write_unlock_tm(rwl); +} +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_hts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_hts_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_rts_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_mc_rts_dequeue_burst(r, obj_table, n, available); +} +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_prod_htd_max(r); +} +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_prod_htd_max(r, v); +} +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r) { + return rte_ring_get_cons_htd_max(r); +} +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v) { + return rte_ring_set_cons_htd_max(r, v); +} +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem(r, obj_table, esize, n, free_space); +} +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_mp_enqueue_elem(r, obj, esize); +} +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize) { + return rte_ring_sp_enqueue_elem(r, obj, esize); +} +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize) { + return rte_ring_enqueue_elem(r, obj, esize); +} +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem(r, obj_table, esize, n, available); +} +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_mc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_sc_dequeue_elem(r, obj_p, esize); +} +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize) { + return rte_ring_dequeue_elem(r, obj_p, esize); +} +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem(r, obj_table, esize, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem(r, obj_table, esize, n, available); +} +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_bulk_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_elem_start(r, n, free_space); +} +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst_start(r, n, free_space); +} +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n) { + rte_ring_enqueue_elem_finish(r, obj_table, esize, n); +} +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n) { + rte_ring_enqueue_finish(r, obj_table, n); +} +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_bulk_start(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_elem_start(r, obj_table, esize, n, available); +} +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available) { + return rte_ring_dequeue_burst_start(r, obj_table, n, available); +} +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_elem_finish(r, n); +} +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_finish(r, n); +} +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_bulk_start(r, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_elem_start(r, esize, n, zcd, free_space); +} +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space) { + return rte_ring_enqueue_zc_burst_start(r, n, zcd, free_space); +} +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_elem_finish(r, n); +} +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_enqueue_zc_finish(r, n); +} +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_bulk_start(r, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available) { + return rte_ring_dequeue_zc_burst_elem_start(r, esize, n, zcd, available); +} +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available) { + return rte_ring_dequeue_zc_burst_start(r, n, zcd, available); +} +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_elem_finish(r, n); +} +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n) { + rte_ring_dequeue_zc_finish(r, n); +} +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_bulk(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space) { + return rte_ring_enqueue_bulk(r, obj_table, n, free_space); +} +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_mp_enqueue(r, obj); +} +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_sp_enqueue(r, obj); +} +int rte_ring_enqueue_w(struct rte_ring *r, void *obj) { + return rte_ring_enqueue(r, obj); +} +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_bulk(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_bulk(r, obj_table, n, available); +} +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_mc_dequeue(r, obj_p); +} +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_sc_dequeue(r, obj_p); +} +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p) { + return rte_ring_dequeue(r, obj_p); +} +unsigned int rte_ring_count_w(const struct rte_ring *r) { + return rte_ring_count(r); +} +unsigned int rte_ring_free_count_w(const struct rte_ring *r) { + return rte_ring_free_count(r); +} +int rte_ring_full_w(const struct rte_ring *r) { return rte_ring_full(r); } +int rte_ring_empty_w(const struct rte_ring *r) { return rte_ring_empty(r); } +unsigned int rte_ring_get_size_w(const struct rte_ring *r) { + return rte_ring_get_size(r); +} +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r) { + return rte_ring_get_capacity(r); +} +enum rte_ring_sync_type +rte_ring_get_prod_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_prod_sync_type(r); +} +int rte_ring_is_prod_single_w(const struct rte_ring *r) { + return rte_ring_is_prod_single(r); +} +enum rte_ring_sync_type +rte_ring_get_cons_sync_type_w(const struct rte_ring *r) { + return rte_ring_get_cons_sync_type(r); +} +int rte_ring_is_cons_single_w(const struct rte_ring *r) { + return rte_ring_is_cons_single(r); +} +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_sp_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space) { + return rte_ring_enqueue_burst(r, obj_table, n, free_space); +} +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_mc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available) { + return rte_ring_sc_dequeue_burst(r, obj_table, n, available); +} +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available) { + return rte_ring_dequeue_burst(r, obj_table, n, available); +} +void *rte_memcpy_w(void *dst, const void *src, size_t n) { + return rte_memcpy(dst, src, n); +} +// void *rte_mov15_or_less_w(void *dst, const void *src, size_t n) { +// return rte_mov15_or_less(dst, src, n); +// } +void rte_mov16_w(uint8_t *dst, const uint8_t *src) { rte_mov16(dst, src); } +void rte_mov32_w(uint8_t *dst, const uint8_t *src) { rte_mov32(dst, src); } +void rte_mov64_w(uint8_t *dst, const uint8_t *src) { rte_mov64(dst, src); } +void rte_mov256_w(uint8_t *dst, const uint8_t *src) { rte_mov256(dst, src); } +// void *rte_memcpy_generic_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_generic(dst, src, n); +// } +// void *rte_memcpy_aligned_w(void *dst, const void *src, size_t n) { +// return rte_memcpy_aligned(dst, src, n); +// } +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj) { + return rte_mempool_get_header(obj); +} +struct rte_mempool *rte_mempool_from_obj_w(void *obj) { + return rte_mempool_from_obj(obj); +} +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj) { + return rte_mempool_get_trailer(obj); +} +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index) { + return rte_mempool_get_ops(ops_index); +} +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_bulk(mp, obj_table, n); +} +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n) { + return rte_mempool_ops_dequeue_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n) { + return rte_mempool_ops_enqueue_bulk(mp, obj_table, n); +} +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id) { + return rte_mempool_default_cache(mp, lcore_id); +} +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp) { + rte_mempool_cache_flush(cache, mp); +} +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_do_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + rte_mempool_generic_put(mp, obj_table, n, cache); +} +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n) { + rte_mempool_put_bulk(mp, obj_table, n); +} +void rte_mempool_put_w(struct rte_mempool *mp, void *obj) { + rte_mempool_put(mp, obj); +} +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache) { + return rte_mempool_do_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache) { + return rte_mempool_generic_get(mp, obj_table, n, cache); +} +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n) { + return rte_mempool_get_bulk(mp, obj_table, n); +} +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p) { + return rte_mempool_get(mp, obj_p); +} +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n) { + return rte_mempool_get_contig_blocks(mp, first_obj_table, n); +} +int rte_mempool_full_w(const struct rte_mempool *mp) { + return rte_mempool_full(mp); +} +int rte_mempool_empty_w(const struct rte_mempool *mp) { + return rte_mempool_empty(mp); +} +rte_iova_t rte_mempool_virt2iova_w(const void *elt) { + return rte_mempool_virt2iova(elt); +} +void *rte_mempool_get_priv_w(struct rte_mempool *mp) { + return rte_mempool_get_priv(mp); +} +void rte_prefetch0_w(const void *p) { rte_prefetch0(p); } +void rte_prefetch1_w(const void *p) { rte_prefetch1(p); } +void rte_prefetch2_w(const void *p) { rte_prefetch2(p); } +void rte_prefetch_non_temporal_w(const void *p) { + rte_prefetch_non_temporal(p); +} +void rte_prefetch0_write_w(const void *p) { rte_prefetch0_write(p); } +void rte_prefetch1_write_w(const void *p) { rte_prefetch1_write(p); } +void rte_prefetch2_write_w(const void *p) { rte_prefetch2_write(p); } +void rte_cldemote_w(const void *p) { rte_cldemote(p); } +uint16_t rte_constant_bswap16_w(uint16_t x) { return rte_constant_bswap16(x); } +uint32_t rte_constant_bswap32_w(uint32_t x) { return rte_constant_bswap32(x); } +uint64_t rte_constant_bswap64_w(uint64_t x) { return rte_constant_bswap64(x); } +// uint16_t rte_arch_bswap16_w(uint16_t _x) { return rte_arch_bswap16(_x); } +// uint32_t rte_arch_bswap32_w(uint32_t _x) { return rte_arch_bswap32(_x); } +// uint64_t rte_arch_bswap64_w(uint64_t _x) { return rte_arch_bswap64(_x); } +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part1(m); +} +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m) { + rte_mbuf_prefetch_part2(m); +} +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_size(mp); +} +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m) { + return rte_mbuf_iova_get(m); +} +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova) { + rte_mbuf_iova_set(m, iova); +} +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova(mb); +} +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb) { + return rte_mbuf_data_iova_default(mb); +} +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi) { + return rte_mbuf_from_indirect(mi); +} +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp) { + return rte_mbuf_buf_addr(mb, mp); +} +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb) { + return rte_mbuf_data_addr_default(mb); +} +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md) { return rte_mbuf_to_baddr(md); } +void *rte_mbuf_to_priv_w(struct rte_mbuf *m) { return rte_mbuf_to_priv(m); } +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp) { + return rte_pktmbuf_priv_flags(mp); +} +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m) { + return rte_mbuf_refcnt_read(m); +} +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value) { + rte_mbuf_refcnt_set(m, new_value); +} +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value) { + return rte_mbuf_refcnt_update(m, value); +} +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo) { + return rte_mbuf_ext_refcnt_read(shinfo); +} +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value) { + rte_mbuf_ext_refcnt_set(shinfo, new_value); +} +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value) { + return rte_mbuf_ext_refcnt_update(shinfo, value); +} +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp) { + return rte_mbuf_raw_alloc(mp); +} +void rte_mbuf_raw_free_w(struct rte_mbuf *m) { rte_mbuf_raw_free(m); } +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp) { + return rte_pktmbuf_data_room_size(mp); +} +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m) { + rte_pktmbuf_reset_headroom(m); +} +void rte_pktmbuf_reset_w(struct rte_mbuf *m) { rte_pktmbuf_reset(m); } +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp) { + return rte_pktmbuf_alloc(mp); +} +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count) { + return rte_pktmbuf_alloc_bulk(pool, mbufs, count); +} +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque) { + return rte_pktmbuf_ext_shinfo_init_helper(buf_addr, buf_len, free_cb, + fcb_opaque); +} +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo) { + rte_pktmbuf_attach_extbuf(m, buf_addr, buf_iova, buf_len, shinfo); +} +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc) { + rte_mbuf_dynfield_copy(mdst, msrc); +} +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m) { + rte_pktmbuf_attach(mi, m); +} +void rte_pktmbuf_detach_w(struct rte_mbuf *m) { rte_pktmbuf_detach(m); } +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m) { + return rte_pktmbuf_prefree_seg(m); +} +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m) { rte_pktmbuf_free_seg(m); } +void rte_pktmbuf_free_w(struct rte_mbuf *m) { rte_pktmbuf_free(m); } +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v) { + rte_pktmbuf_refcnt_update(m, v); +} +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_headroom(m); +} +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m) { + return rte_pktmbuf_tailroom(m); +} +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m) { + return rte_pktmbuf_lastseg(m); +} +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_prepend(m, len); +} +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_append(m, len); +} +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_adj(m, len); +} +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len) { + return rte_pktmbuf_trim(m, len); +} +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m) { + return rte_pktmbuf_is_contiguous(m); +} +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf) { + return rte_pktmbuf_read(m, off, len, buf); +} +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail) { + return rte_pktmbuf_chain(head, tail); +} +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused) { + return rte_mbuf_tx_offload(il2, il3, il4, tso, ol3, ol2, unused); +} +int rte_validate_tx_offload_w(const struct rte_mbuf *m) { + return rte_validate_tx_offload(m); +} +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf) { + return rte_pktmbuf_linearize(mbuf); +} +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_queue_get(m); +} +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_traffic_class_get(m); +} +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m) { + return rte_mbuf_sched_color_get(m); +} +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color) { + rte_mbuf_sched_get(m, queue_id, traffic_class, color); +} +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id) { + rte_mbuf_sched_queue_set(m, queue_id); +} +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class) { + rte_mbuf_sched_traffic_class_set(m, traffic_class); +} +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color) { + rte_mbuf_sched_color_set(m, color); +} +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color) { + rte_mbuf_sched_set(m, queue_id, traffic_class, color); +} +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2) { + return rte_is_same_ether_addr(ea1, ea2); +} +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_zero_ether_addr(ea); +} +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_unicast_ether_addr(ea); +} +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_multicast_ether_addr(ea); +} +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_broadcast_ether_addr(ea); +} +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_universal_ether_addr(ea); +} +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_local_admin_ether_addr(ea); +} +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea) { + return rte_is_valid_assigned_ether_addr(ea); +} +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { + rte_ether_addr_copy(ea_from, ea_to); +} +int rte_vlan_strip_w(struct rte_mbuf *m) { return rte_vlan_strip(m); } +int rte_vlan_insert_w(struct rte_mbuf **m) { return rte_vlan_insert(m); } +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits) { + return rte_bitmap_get_memory_footprint(n_bits); +} +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init(n_bits, mem, mem_size); +} +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size) { + return rte_bitmap_init_with_all_set(n_bits, mem, mem_size); +} +void rte_bitmap_free_w(struct rte_bitmap *bmp) { return rte_bitmap_free(bmp); } +void rte_bitmap_reset_w(struct rte_bitmap *bmp) { rte_bitmap_reset(bmp); } +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_prefetch0(bmp, pos); +} +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos) { + return rte_bitmap_get(bmp, pos); +} +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_set(bmp, pos); +} +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, + uint64_t slab) { + rte_bitmap_set_slab(bmp, pos, slab); +} +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos) { + rte_bitmap_clear(bmp, pos); +} +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) { + return rte_bitmap_scan(bmp, pos, slab); +} +uint16_t rte_raw_cksum_w(const void *buf, size_t len) { + return rte_raw_cksum(buf, len); +} +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum) { + return rte_raw_cksum_mbuf(m, off, len, cksum); +} +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_hdr_len(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum(ipv4_hdr); +} +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr) { + return rte_ipv4_cksum_simple(ipv4_hdr); +} +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags) { + return rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); +} +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum(ipv4_hdr, l4_hdr); +} +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); +} +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr) { + return rte_ipv4_udptcp_cksum_verify(ipv4_hdr, l4_hdr); +} +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off) { + return rte_ipv4_udptcp_cksum_mbuf_verify(m, ipv4_hdr, l4_off); +} +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b) { + return rte_ipv6_addr_eq(a, b); +} +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth) { + rte_ipv6_addr_mask(ip, depth); +} +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth) { + return rte_ipv6_addr_eq_prefix(a, b, depth); +} +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask) { + return rte_ipv6_mask_depth(mask); +} +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_unspec(ip); +} +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_loopback(ip); +} +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_linklocal(ip); +} +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_sitelocal(ip); +} +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4compat(ip); +} +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_v4mapped(ip); +} +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_addr_is_mcast(ip); +} +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip) { + return rte_ipv6_mc_scope(ip); +} +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac) { + rte_ipv6_llocal_from_ethernet(ip, mac); +} +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip) { + rte_ipv6_solnode_from_addr(sol, ip); +} +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip) { + rte_ether_mcast_from_ipv6(mac, ip); +} +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip) { + return rte_ipv6_check_version(ip); +} +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags) { + return rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); +} +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum(ipv6_hdr, l4_hdr); +} +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); +} +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr) { + return rte_ipv6_udptcp_cksum_verify(ipv6_hdr, l4_hdr); +} +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off) { + return rte_ipv6_udptcp_cksum_mbuf_verify(m, ipv6_hdr, l4_off); +} +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len) { + return rte_ipv6_get_next_ext(p, proto, ext_len); +} +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_srtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_srtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len) { + return rte_meter_trtcm_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color) { + return rte_meter_trtcm_color_aware_check(m, p, time, pkt_len, pkt_color); +} +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, + uint32_t pkt_len) { + return rte_meter_trtcm_rfc4115_color_blind_check(m, p, time, pkt_len); +} +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color) { + return rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len, + pkt_color); +} +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf) { + return rte_eth_rss_hf_refine(rss_hf); +} + +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) { + return rte_eth_rx_burst(port_id, queue_id, rx_pkts, nb_pkts); +} +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_rx_queue_count(port_id, queue_id); +} +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_rx_descriptor_status(port_id, queue_id, offset); +} +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset) { + return rte_eth_tx_descriptor_status(port_id, queue_id, offset); +} +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_burst(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_prepare(port_id, queue_id, tx_pkts, nb_pkts); +} +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer) { + return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); +} +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt) { + return rte_eth_tx_buffer(port_id, queue_id, buffer, tx_pkt); +} +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info) { + return rte_eth_recycle_mbufs(rx_port_id, rx_queue_id, tx_port_id, tx_queue_id, + recycle_rxq_info); +} +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id) { + return rte_eth_tx_queue_count(port_id, queue_id); +} +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m) { + return rte_flow_dynf_metadata_get(m); +} +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v) { + rte_flow_dynf_metadata_set(m, v); +} +int rte_flow_dynf_metadata_avail_w(void) { + return rte_flow_dynf_metadata_avail(); +} +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val) { + return rte_hash_crc_1byte(data, init_val); +} +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val) { + return rte_hash_crc_2byte(data, init_val); +} +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val) { + return rte_hash_crc_4byte(data, init_val); +} +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val) { + return rte_hash_crc_8byte(data, init_val); +} +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, + uint32_t init_val) { + return rte_hash_crc(data, data_len, init_val); +} +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_2hashes(key, length, pc, pb); +} +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb) { + rte_jhash_32b_2hashes(k, length, pc, pb); +} +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval) { + return rte_jhash(key, length, initval); +} +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval) { + return rte_jhash_32b(k, length, initval); +} +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval) { + return rte_jhash_3words(a, b, c, initval); +} +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval) { + return rte_jhash_2words(a, b, initval); +} +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval) { + return rte_jhash_1word(a, initval); +} +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key) { + return rte_fbk_hash_get_bucket(ht, key); +} +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket) { + return rte_fbk_hash_add_key_with_bucket(ht, key, value, bucket); +} +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value) { + return rte_fbk_hash_add_key(ht, key, value); +} +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_delete_key_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_delete_key(ht, key); +} +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket) { + return rte_fbk_hash_lookup_with_bucket(ht, key, bucket); +} +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key) { + return rte_fbk_hash_lookup(ht, key); +} +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht) { + rte_fbk_hash_clear_all(ht); +} +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht) { + return rte_fbk_hash_get_load_factor(ht); +} +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_online(v, thread_id); +} +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id) { + rte_rcu_qsbr_thread_offline(v, thread_id); +} +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_lock(v, thread_id); +} +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_unlock(v, thread_id); +} +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v) { + return rte_rcu_qsbr_start(v); +} +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id) { + rte_rcu_qsbr_quiescent(v, thread_id); +} +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { + return rte_rcu_qsbr_check(v, t, wait); +} +uint8_t rte_read8_relaxed_w(const void *addr) { + return rte_read8_relaxed(addr); +} +uint16_t rte_read16_relaxed_w(const void *addr) { + return rte_read16_relaxed(addr); +} +uint32_t rte_read32_relaxed_w(const void *addr) { + return rte_read32_relaxed(addr); +} +uint64_t rte_read64_relaxed_w(const void *addr) { + return rte_read64_relaxed(addr); +} +void rte_write8_relaxed_w(uint8_t value, void *addr) { + rte_write8_relaxed(value, addr); +} +void rte_write16_relaxed_w(uint16_t value, void *addr) { + rte_write16_relaxed(value, addr); +} +void rte_write32_relaxed_w(uint32_t value, void *addr) { + rte_write32_relaxed(value, addr); +} +void rte_write64_relaxed_w(uint64_t value, void *addr) { + rte_write64_relaxed(value, addr); +} +uint8_t rte_read8_w(const void *addr) { return rte_read8(addr); } +uint16_t rte_read16_w(const void *addr) { return rte_read16(addr); } +uint32_t rte_read32_w(const void *addr) { return rte_read32(addr); } +uint64_t rte_read64_w(const void *addr) { return rte_read64(addr); } +void rte_write8_w(uint8_t value, void *addr) { rte_write8(value, addr); } +void rte_write16_w(uint16_t value, void *addr) { rte_write16(value, addr); } +void rte_write32_w(uint32_t value, void *addr) { rte_write32(value, addr); } +void rte_write64_w(uint64_t value, void *addr) { rte_write64(value, addr); } +void rte_write32_wc_relaxed_w(uint32_t value, void *addr) { + rte_write32_wc_relaxed(value, addr); +} +void rte_write32_wc_w(uint32_t value, void *addr) { + rte_write32_wc(value, addr); +} +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_lock(msl, me); +} +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + rte_mcslock_unlock(msl, me); +} +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me) { + return rte_mcslock_trylock(msl, me); +} +int rte_mcslock_is_locked_w(rte_mcslock_t *msl) { + return rte_mcslock_is_locked(msl); +} +void rte_pflock_init_w(struct rte_pflock *pf) { rte_pflock_init(pf); } +void rte_pflock_read_lock_w(rte_pflock_t *pf) { rte_pflock_read_lock(pf); } +void rte_pflock_read_unlock_w(rte_pflock_t *pf) { rte_pflock_read_unlock(pf); } +void rte_pflock_write_lock_w(rte_pflock_t *pf) { rte_pflock_write_lock(pf); } +void rte_pflock_write_unlock_w(rte_pflock_t *pf) { + rte_pflock_write_unlock(pf); +} +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R) { + return rte_reciprocal_divide(a, R); +} +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R) { + return rte_reciprocal_divide_u64(a, R); +} +void rte_seqcount_init_w(rte_seqcount_t *seqcount) { + rte_seqcount_init(seqcount); +} +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount) { + return rte_seqcount_read_begin(seqcount); +} +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn) { + return rte_seqcount_read_retry(seqcount, begin_sn); +} +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_begin(seqcount); +} +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount) { + rte_seqcount_write_end(seqcount); +} +void rte_seqlock_init_w(rte_seqlock_t *seqlock) { rte_seqlock_init(seqlock); } +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock) { + return rte_seqlock_read_begin(seqlock); +} +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn) { + return rte_seqlock_read_retry(seqlock, begin_sn); +} +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_lock(seqlock); +} +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock) { + rte_seqlock_write_unlock(seqlock); +} +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n) { + return rte_stack_push(s, obj_table, n); +} +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n) { + return rte_stack_pop(s, obj_table, n); +} +unsigned int rte_stack_count_w(struct rte_stack *s) { + return rte_stack_count(s); +} +unsigned int rte_stack_free_count_w(struct rte_stack *s) { + return rte_stack_free_count(s); +} +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss(input_tuple, input_len, rss_key); +} +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key) { + return rte_softrss_be(input_tuple, input_len, rss_key); +} +void rte_ticketlock_init_w(rte_ticketlock_t *tl) { rte_ticketlock_init(tl); } +void rte_ticketlock_lock_w(rte_ticketlock_t *tl) { rte_ticketlock_lock(tl); } +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl) { + rte_ticketlock_unlock(tl); +} +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl) { + return rte_ticketlock_trylock(tl); +} +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl) { + return rte_ticketlock_is_locked(tl); +} +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_init(tlr); +} +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_lock(tlr); +} +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr) { + rte_ticketlock_recursive_unlock(tlr); +} +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr) { + return rte_ticketlock_recursive_trylock(tlr); +} +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles) { + return rte_cyclecounter_cycles_to_ns(tc, cycles); +} +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now) { + return rte_timecounter_update(tc, cycle_now); +} +uint64_t rte_timespec_to_ns_w(const struct timespec *ts) { + return rte_timespec_to_ns(ts); +} +struct timespec rte_ns_to_timespec_w(uint64_t nsec) { + return rte_ns_to_timespec(nsec); +} +bool rte_trace_feature_is_enabled_w(void) { + return rte_trace_feature_is_enabled(); +} diff --git a/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h new file mode 100644 index 000000000..3ebfe21e7 --- /dev/null +++ b/nix/pkgs/dpdk-wrapper/src/dpdk_wrapper.h @@ -0,0 +1,1034 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Open Network Fabric Authors + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Things which are either duplicated, totally inapplicable or not needed +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include // this is an internal header +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + +// #include +// #include +// #include +// #include + +/** + * Thin wrapper to expose `rte_errno`. + * + * @return + * The last rte_errno value (thread local value). + */ +int rte_errno_get(); + +/** + * TX offloads to be set in [`rte_eth_tx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum rte_eth_tx_offload : uint64_t { + 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 +}; + +/** + * RX offloads to be set in [`rte_eth_rx_mode.offloads`]. + * + * This is a bitfield. Union these to enable multiple offloads. + * + * I wrapped these because the enum must be explicitly typed as 64 bit, but + * DPDK is not yet using the C23 standard (which would allow the inheritance + * notation with `uint64_t` seen here.). + */ +enum rte_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, +}; + +int rte_errno_get(); + +// Static wrappers + +void rte_atomic_thread_fence_w(rte_memory_order memorder); +int rte_atomic16_cmpset_w(uint16_t *dst, uint16_t exp, uint16_t src); +uint16_t rte_atomic16_exchange_w(uint16_t *dst, uint16_t val); +void rte_atomic16_init_w(rte_atomic16_t *v); +int16_t rte_atomic16_read_w(const rte_atomic16_t *v); +void rte_atomic16_set_w(rte_atomic16_t *v, int16_t new_value); +void rte_atomic16_add_w(rte_atomic16_t *v, int16_t inc); +void rte_atomic16_sub_w(rte_atomic16_t *v, int16_t dec); +void rte_atomic16_inc_w(rte_atomic16_t *v); +void rte_atomic16_dec_w(rte_atomic16_t *v); +int16_t rte_atomic16_add_return_w(rte_atomic16_t *v, int16_t inc); +int16_t rte_atomic16_sub_return_w(rte_atomic16_t *v, int16_t dec); +int rte_atomic16_inc_and_test_w(rte_atomic16_t *v); +int rte_atomic16_dec_and_test_w(rte_atomic16_t *v); +int rte_atomic16_test_and_set_w(rte_atomic16_t *v); +void rte_atomic16_clear_w(rte_atomic16_t *v); +int rte_atomic32_cmpset_w(uint32_t *dst, uint32_t exp, uint32_t src); +uint32_t rte_atomic32_exchange_w(uint32_t *dst, uint32_t val); +void rte_atomic32_init_w(rte_atomic32_t *v); +int32_t rte_atomic32_read_w(const rte_atomic32_t *v); +void rte_atomic32_set_w(rte_atomic32_t *v, int32_t new_value); +void rte_atomic32_add_w(rte_atomic32_t *v, int32_t inc); +void rte_atomic32_sub_w(rte_atomic32_t *v, int32_t dec); +void rte_atomic32_inc_w(rte_atomic32_t *v); +void rte_atomic32_dec_w(rte_atomic32_t *v); +int32_t rte_atomic32_add_return_w(rte_atomic32_t *v, int32_t inc); +int32_t rte_atomic32_sub_return_w(rte_atomic32_t *v, int32_t dec); +int rte_atomic32_inc_and_test_w(rte_atomic32_t *v); +int rte_atomic32_dec_and_test_w(rte_atomic32_t *v); +int rte_atomic32_test_and_set_w(rte_atomic32_t *v); +void rte_atomic32_clear_w(rte_atomic32_t *v); +int rte_atomic64_cmpset_w(uint64_t *dst, uint64_t exp, uint64_t src); +uint64_t rte_atomic64_exchange_w(uint64_t *dst, uint64_t val); +void rte_atomic64_init_w(rte_atomic64_t *v); +int64_t rte_atomic64_read_w(rte_atomic64_t *v); +void rte_atomic64_set_w(rte_atomic64_t *v, int64_t new_value); +void rte_atomic64_add_w(rte_atomic64_t *v, int64_t inc); +void rte_atomic64_sub_w(rte_atomic64_t *v, int64_t dec); +void rte_atomic64_inc_w(rte_atomic64_t *v); +void rte_atomic64_dec_w(rte_atomic64_t *v); +int64_t rte_atomic64_add_return_w(rte_atomic64_t *v, int64_t inc); +int64_t rte_atomic64_sub_return_w(rte_atomic64_t *v, int64_t dec); +int rte_atomic64_inc_and_test_w(rte_atomic64_t *v); +int rte_atomic64_dec_and_test_w(rte_atomic64_t *v); +int rte_atomic64_test_and_set_w(rte_atomic64_t *v); +void rte_atomic64_clear_w(rte_atomic64_t *v); +void rte_smp_mb_w(void); +uint64_t rte_get_tsc_cycles_w(void); +uint64_t rte_get_timer_cycles_w(void); +uint64_t rte_get_timer_hz_w(void); +void rte_delay_ms_w(unsigned int ms); +uint64_t rte_rdtsc_w(void); +uint64_t rte_rdtsc_precise_w(void); +size_t rte_strlcpy_w(char *dst, const char *src, size_t size); +size_t rte_strlcat_w(char *dst, const char *src, size_t size); +const char *rte_str_skip_leading_spaces_w(const char *src); +void rte_uuid_copy_w(rte_uuid_t dst, const rte_uuid_t src); +int rte_gettid_w(void); +unsigned int rte_lcore_id_w(void); +void rte_pause_w(void); +void rte_wait_until_equal_16_w(uint16_t *addr, uint16_t expected, + rte_memory_order memorder); +void rte_wait_until_equal_32_w(uint32_t *addr, uint32_t expected, + rte_memory_order memorder); +void rte_wait_until_equal_64_w(uint64_t *addr, uint64_t expected, + rte_memory_order memorder); +void rte_spinlock_init_w(rte_spinlock_t *sl); +void rte_spinlock_lock_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_w(rte_spinlock_t *sl); +int rte_spinlock_is_locked_w(rte_spinlock_t *sl); +int rte_tm_supported_w(void); +void rte_spinlock_lock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_unlock_tm_w(rte_spinlock_t *sl); +int rte_spinlock_trylock_tm_w(rte_spinlock_t *sl); +void rte_spinlock_recursive_init_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_lock_tm_w(rte_spinlock_recursive_t *slr); +void rte_spinlock_recursive_unlock_tm_w(rte_spinlock_recursive_t *slr); +int rte_spinlock_recursive_trylock_tm_w(rte_spinlock_recursive_t *slr); +uint32_t rte_bit_relaxed_get32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_set32_w(unsigned int nr, uint32_t *addr); +void rte_bit_relaxed_clear32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_set32_w(unsigned int nr, uint32_t *addr); +uint32_t rte_bit_relaxed_test_and_clear32_w(unsigned int nr, uint32_t *addr); +uint64_t rte_bit_relaxed_get64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_set64_w(unsigned int nr, uint64_t *addr); +void rte_bit_relaxed_clear64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_set64_w(unsigned int nr, uint64_t *addr); +uint64_t rte_bit_relaxed_test_and_clear64_w(unsigned int nr, uint64_t *addr); +unsigned int rte_clz32_w(uint32_t v); +unsigned int rte_clz64_w(uint64_t v); +unsigned int rte_ctz32_w(uint32_t v); +unsigned int rte_ctz64_w(uint64_t v); +unsigned int rte_popcount32_w(uint32_t v); +unsigned int rte_popcount64_w(uint64_t v); +uint32_t rte_combine32ms1b_w(uint32_t x); +uint64_t rte_combine64ms1b_w(uint64_t v); +uint32_t rte_bsf32_w(uint32_t v); +int rte_bsf32_safe_w(uint32_t v, uint32_t *pos); +uint32_t rte_bsf64_w(uint64_t v); +int rte_bsf64_safe_w(uint64_t v, uint32_t *pos); +uint32_t rte_fls_u32_w(uint32_t x); +uint32_t rte_fls_u64_w(uint64_t x); +int rte_is_power_of_2_w(uint32_t n); +uint32_t rte_align32pow2_w(uint32_t x); +uint32_t rte_align32prevpow2_w(uint32_t x); +uint64_t rte_align64pow2_w(uint64_t v); +uint64_t rte_align64prevpow2_w(uint64_t v); +uint32_t rte_log2_u32_w(uint32_t v); +uint32_t rte_log2_u64_w(uint64_t v); +void rte_rwlock_init_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_w(rte_rwlock_t *rwl); +int rte_rwlock_read_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_trylock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_w(rte_rwlock_t *rwl); +int rte_rwlock_write_is_locked_w(rte_rwlock_t *rwl); +void rte_rwlock_read_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_read_unlock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_lock_tm_w(rte_rwlock_t *rwl); +void rte_rwlock_write_unlock_tm_w(rte_rwlock_t *rwl); +unsigned int rte_ring_mp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mp_hts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_hts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_hts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_bulk_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +unsigned int rte_ring_mp_rts_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_rts_dequeue_burst_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +uint32_t rte_ring_get_prod_htd_max_w(const struct rte_ring *r); +int rte_ring_set_prod_htd_max_w(struct rte_ring *r, uint32_t v); +uint32_t rte_ring_get_cons_htd_max_w(const struct rte_ring *r); +int rte_ring_set_cons_htd_max_w(struct rte_ring *r, uint32_t v); +unsigned int rte_ring_enqueue_bulk_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +int rte_ring_mp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize); +int rte_ring_sp_enqueue_elem_w(struct rte_ring *r, void *obj, + unsigned int esize); +int rte_ring_enqueue_elem_w(struct rte_ring *r, void *obj, unsigned int esize); +unsigned int rte_ring_mc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_bulk_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +int rte_ring_mc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +int rte_ring_sc_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +int rte_ring_dequeue_elem_w(struct rte_ring *r, void *obj_p, + unsigned int esize); +unsigned int rte_ring_mp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_elem_w(struct rte_ring *r, + const void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_burst_elem_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_elem_w(struct rte_ring *r, void *obj_table, + unsigned int esize, unsigned int n, + unsigned int *available); +unsigned int rte_ring_enqueue_bulk_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_bulk_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_elem_start_w(struct rte_ring *r, + unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_start_w(struct rte_ring *r, unsigned int n, + unsigned int *free_space); +void rte_ring_enqueue_elem_finish_w(struct rte_ring *r, const void *obj_table, + unsigned int esize, unsigned int n); +void rte_ring_enqueue_finish_w(struct rte_ring *r, void *const *obj_table, + unsigned int n); +unsigned int rte_ring_dequeue_bulk_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_start_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_elem_start_w(struct rte_ring *r, + void *obj_table, + unsigned int esize, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_start_w(struct rte_ring *r, + void **obj_table, unsigned int n, + unsigned int *available); +void rte_ring_dequeue_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_enqueue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *free_space); +unsigned int rte_ring_enqueue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *free_space); +void rte_ring_enqueue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_enqueue_zc_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_dequeue_zc_bulk_elem_start_w(struct rte_ring *r, + unsigned int esize, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +unsigned int rte_ring_dequeue_zc_bulk_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +unsigned int rte_ring_dequeue_zc_burst_elem_start_w( + struct rte_ring *r, unsigned int esize, unsigned int n, + struct rte_ring_zc_data *zcd, unsigned int *available); +unsigned int rte_ring_dequeue_zc_burst_start_w(struct rte_ring *r, + unsigned int n, + struct rte_ring_zc_data *zcd, + unsigned int *available); +void rte_ring_dequeue_zc_elem_finish_w(struct rte_ring *r, unsigned int n); +void rte_ring_dequeue_zc_finish_w(struct rte_ring *r, unsigned int n); +unsigned int rte_ring_mp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_bulk_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_bulk_w(struct rte_ring *r, void *const *obj_table, + unsigned int n, unsigned int *free_space); +int rte_ring_mp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_sp_enqueue_w(struct rte_ring *r, void *obj); +int rte_ring_enqueue_w(struct rte_ring *r, void *obj); +unsigned int rte_ring_mc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_bulk_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available); +int rte_ring_mc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_sc_dequeue_w(struct rte_ring *r, void **obj_p); +int rte_ring_dequeue_w(struct rte_ring *r, void **obj_p); +unsigned int rte_ring_count_w(const struct rte_ring *r); +unsigned int rte_ring_free_count_w(const struct rte_ring *r); +int rte_ring_full_w(const struct rte_ring *r); +int rte_ring_empty_w(const struct rte_ring *r); +unsigned int rte_ring_get_size_w(const struct rte_ring *r); +unsigned int rte_ring_get_capacity_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_prod_sync_type_w(const struct rte_ring *r); +int rte_ring_is_prod_single_w(const struct rte_ring *r); +enum rte_ring_sync_type rte_ring_get_cons_sync_type_w(const struct rte_ring *r); +int rte_ring_is_cons_single_w(const struct rte_ring *r); +unsigned int rte_ring_mp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_sp_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_enqueue_burst_w(struct rte_ring *r, + void *const *obj_table, unsigned int n, + unsigned int *free_space); +unsigned int rte_ring_mc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_sc_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, + unsigned int *available); +unsigned int rte_ring_dequeue_burst_w(struct rte_ring *r, void **obj_table, + unsigned int n, unsigned int *available); +void *rte_memcpy_w(void *dst, const void *src, size_t n); +void rte_mov16_w(uint8_t *dst, const uint8_t *src); +void rte_mov32_w(uint8_t *dst, const uint8_t *src); +void rte_mov64_w(uint8_t *dst, const uint8_t *src); +void rte_mov256_w(uint8_t *dst, const uint8_t *src); +struct rte_mempool_objhdr *rte_mempool_get_header_w(void *obj); +struct rte_mempool *rte_mempool_from_obj_w(void *obj); +struct rte_mempool_objtlr *rte_mempool_get_trailer_w(void *obj); +struct rte_mempool_ops *rte_mempool_get_ops_w(int ops_index); +int rte_mempool_ops_dequeue_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n); +int rte_mempool_ops_dequeue_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, + unsigned int n); +int rte_mempool_ops_enqueue_bulk_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n); +struct rte_mempool_cache *rte_mempool_default_cache_w(struct rte_mempool *mp, + unsigned int lcore_id); +void rte_mempool_cache_flush_w(struct rte_mempool_cache *cache, + struct rte_mempool *mp); +void rte_mempool_do_generic_put_w(struct rte_mempool *mp, + void *const *obj_table, unsigned int n, + struct rte_mempool_cache *cache); +void rte_mempool_generic_put_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n, struct rte_mempool_cache *cache); +void rte_mempool_put_bulk_w(struct rte_mempool *mp, void *const *obj_table, + unsigned int n); +void rte_mempool_put_w(struct rte_mempool *mp, void *obj); +int rte_mempool_do_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, + struct rte_mempool_cache *cache); +int rte_mempool_generic_get_w(struct rte_mempool *mp, void **obj_table, + unsigned int n, struct rte_mempool_cache *cache); +int rte_mempool_get_bulk_w(struct rte_mempool *mp, void **obj_table, + unsigned int n); +int rte_mempool_get_w(struct rte_mempool *mp, void **obj_p); +int rte_mempool_get_contig_blocks_w(struct rte_mempool *mp, + void **first_obj_table, unsigned int n); +int rte_mempool_full_w(const struct rte_mempool *mp); +int rte_mempool_empty_w(const struct rte_mempool *mp); +rte_iova_t rte_mempool_virt2iova_w(const void *elt); +void *rte_mempool_get_priv_w(struct rte_mempool *mp); +void rte_prefetch0_w(const void *p); +void rte_prefetch1_w(const void *p); +void rte_prefetch2_w(const void *p); +void rte_prefetch_non_temporal_w(const void *p); +void rte_prefetch0_write_w(const void *p); +void rte_prefetch1_write_w(const void *p); +void rte_prefetch2_write_w(const void *p); +void rte_cldemote_w(const void *p); +uint16_t rte_constant_bswap16_w(uint16_t x); +uint32_t rte_constant_bswap32_w(uint32_t x); +uint64_t rte_constant_bswap64_w(uint64_t x); +void rte_mbuf_prefetch_part1_w(struct rte_mbuf *m); +void rte_mbuf_prefetch_part2_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_priv_size_w(struct rte_mempool *mp); +rte_iova_t rte_mbuf_iova_get_w(const struct rte_mbuf *m); +void rte_mbuf_iova_set_w(struct rte_mbuf *m, rte_iova_t iova); +rte_iova_t rte_mbuf_data_iova_w(const struct rte_mbuf *mb); +rte_iova_t rte_mbuf_data_iova_default_w(const struct rte_mbuf *mb); +struct rte_mbuf *rte_mbuf_from_indirect_w(struct rte_mbuf *mi); +char *rte_mbuf_buf_addr_w(struct rte_mbuf *mb, struct rte_mempool *mp); +char *rte_mbuf_data_addr_default_w(struct rte_mbuf *mb); +char *rte_mbuf_to_baddr_w(struct rte_mbuf *md); +void *rte_mbuf_to_priv_w(struct rte_mbuf *m); +uint32_t rte_pktmbuf_priv_flags_w(struct rte_mempool *mp); +uint16_t rte_mbuf_refcnt_read_w(const struct rte_mbuf *m); +void rte_mbuf_refcnt_set_w(struct rte_mbuf *m, uint16_t new_value); +uint16_t rte_mbuf_refcnt_update_w(struct rte_mbuf *m, int16_t value); +uint16_t +rte_mbuf_ext_refcnt_read_w(const struct rte_mbuf_ext_shared_info *shinfo); +void rte_mbuf_ext_refcnt_set_w(struct rte_mbuf_ext_shared_info *shinfo, + uint16_t new_value); +uint16_t rte_mbuf_ext_refcnt_update_w(struct rte_mbuf_ext_shared_info *shinfo, + int16_t value); +struct rte_mbuf *rte_mbuf_raw_alloc_w(struct rte_mempool *mp); +void rte_mbuf_raw_free_w(struct rte_mbuf *m); +uint16_t rte_pktmbuf_data_room_size_w(struct rte_mempool *mp); +void rte_pktmbuf_reset_headroom_w(struct rte_mbuf *m); +void rte_pktmbuf_reset_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_alloc_w(struct rte_mempool *mp); +int rte_pktmbuf_alloc_bulk_w(struct rte_mempool *pool, struct rte_mbuf **mbufs, + unsigned int count); +struct rte_mbuf_ext_shared_info * +rte_pktmbuf_ext_shinfo_init_helper_w(void *buf_addr, uint16_t *buf_len, + rte_mbuf_extbuf_free_callback_t free_cb, + void *fcb_opaque); +void rte_pktmbuf_attach_extbuf_w(struct rte_mbuf *m, void *buf_addr, + rte_iova_t buf_iova, uint16_t buf_len, + struct rte_mbuf_ext_shared_info *shinfo); +void rte_mbuf_dynfield_copy_w(struct rte_mbuf *mdst, + const struct rte_mbuf *msrc); +void rte_pktmbuf_attach_w(struct rte_mbuf *mi, struct rte_mbuf *m); +void rte_pktmbuf_detach_w(struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_prefree_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_seg_w(struct rte_mbuf *m); +void rte_pktmbuf_free_w(struct rte_mbuf *m); +void rte_pktmbuf_refcnt_update_w(struct rte_mbuf *m, int16_t v); +uint16_t rte_pktmbuf_headroom_w(const struct rte_mbuf *m); +uint16_t rte_pktmbuf_tailroom_w(const struct rte_mbuf *m); +struct rte_mbuf *rte_pktmbuf_lastseg_w(struct rte_mbuf *m); +char *rte_pktmbuf_prepend_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_append_w(struct rte_mbuf *m, uint16_t len); +char *rte_pktmbuf_adj_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_trim_w(struct rte_mbuf *m, uint16_t len); +int rte_pktmbuf_is_contiguous_w(const struct rte_mbuf *m); +const void *rte_pktmbuf_read_w(const struct rte_mbuf *m, uint32_t off, + uint32_t len, void *buf); +int rte_pktmbuf_chain_w(struct rte_mbuf *head, struct rte_mbuf *tail); +uint64_t rte_mbuf_tx_offload_w(uint64_t il2, uint64_t il3, uint64_t il4, + uint64_t tso, uint64_t ol3, uint64_t ol2, + uint64_t unused); +int rte_validate_tx_offload_w(const struct rte_mbuf *m); +int rte_pktmbuf_linearize_w(struct rte_mbuf *mbuf); +uint32_t rte_mbuf_sched_queue_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_traffic_class_get_w(const struct rte_mbuf *m); +uint8_t rte_mbuf_sched_color_get_w(const struct rte_mbuf *m); +void rte_mbuf_sched_get_w(const struct rte_mbuf *m, uint32_t *queue_id, + uint8_t *traffic_class, uint8_t *color); +void rte_mbuf_sched_queue_set_w(struct rte_mbuf *m, uint32_t queue_id); +void rte_mbuf_sched_traffic_class_set_w(struct rte_mbuf *m, + uint8_t traffic_class); +void rte_mbuf_sched_color_set_w(struct rte_mbuf *m, uint8_t color); +void rte_mbuf_sched_set_w(struct rte_mbuf *m, uint32_t queue_id, + uint8_t traffic_class, uint8_t color); +int rte_is_same_ether_addr_w(const struct rte_ether_addr *ea1, + const struct rte_ether_addr *ea2); +int rte_is_zero_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_unicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_multicast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_broadcast_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_universal_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_local_admin_ether_addr_w(const struct rte_ether_addr *ea); +int rte_is_valid_assigned_ether_addr_w(const struct rte_ether_addr *ea); +void rte_ether_addr_copy_w(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to); +int rte_vlan_strip_w(struct rte_mbuf *m); +int rte_vlan_insert_w(struct rte_mbuf **m); +uint32_t rte_bitmap_get_memory_footprint_w(uint32_t n_bits); +struct rte_bitmap *rte_bitmap_init_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size); +struct rte_bitmap *rte_bitmap_init_with_all_set_w(uint32_t n_bits, uint8_t *mem, + uint32_t mem_size); +void rte_bitmap_free_w(struct rte_bitmap *bmp); +void rte_bitmap_reset_w(struct rte_bitmap *bmp); +void rte_bitmap_prefetch0_w(struct rte_bitmap *bmp, uint32_t pos); +uint64_t rte_bitmap_get_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_w(struct rte_bitmap *bmp, uint32_t pos); +void rte_bitmap_set_slab_w(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab); +void rte_bitmap_clear_w(struct rte_bitmap *bmp, uint32_t pos); +int rte_bitmap_scan_w(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab); +uint16_t rte_raw_cksum_w(const void *buf, size_t len); +int rte_raw_cksum_mbuf_w(const struct rte_mbuf *m, uint32_t off, uint32_t len, + uint16_t *cksum); +uint8_t rte_ipv4_hdr_len_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_cksum_simple_w(const struct rte_ipv4_hdr *ipv4_hdr); +uint16_t rte_ipv4_phdr_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + uint64_t ol_flags); +uint16_t rte_ipv4_udptcp_cksum_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr); +uint16_t rte_ipv4_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off); +int rte_ipv4_udptcp_cksum_verify_w(const struct rte_ipv4_hdr *ipv4_hdr, + const void *l4_hdr); +int rte_ipv4_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv4_hdr *ipv4_hdr, + uint16_t l4_off); +bool rte_ipv6_addr_eq_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b); +void rte_ipv6_addr_mask_w(struct rte_ipv6_addr *ip, uint8_t depth); +bool rte_ipv6_addr_eq_prefix_w(const struct rte_ipv6_addr *a, + const struct rte_ipv6_addr *b, uint8_t depth); +uint8_t rte_ipv6_mask_depth_w(const struct rte_ipv6_addr *mask); +bool rte_ipv6_addr_is_unspec_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_loopback_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_linklocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_sitelocal_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4compat_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_v4mapped_w(const struct rte_ipv6_addr *ip); +bool rte_ipv6_addr_is_mcast_w(const struct rte_ipv6_addr *ip); +enum rte_ipv6_mc_scope rte_ipv6_mc_scope_w(const struct rte_ipv6_addr *ip); +void rte_ipv6_llocal_from_ethernet_w(struct rte_ipv6_addr *ip, + const struct rte_ether_addr *mac); +void rte_ipv6_solnode_from_addr_w(struct rte_ipv6_addr *sol, + const struct rte_ipv6_addr *ip); +void rte_ether_mcast_from_ipv6_w(struct rte_ether_addr *mac, + const struct rte_ipv6_addr *ip); +int rte_ipv6_check_version_w(const struct rte_ipv6_hdr *ip); +uint16_t rte_ipv6_phdr_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + uint64_t ol_flags); +uint16_t rte_ipv6_udptcp_cksum_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr); +uint16_t rte_ipv6_udptcp_cksum_mbuf_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off); +int rte_ipv6_udptcp_cksum_verify_w(const struct rte_ipv6_hdr *ipv6_hdr, + const void *l4_hdr); +int rte_ipv6_udptcp_cksum_mbuf_verify_w(const struct rte_mbuf *m, + const struct rte_ipv6_hdr *ipv6_hdr, + uint16_t l4_off); +int rte_ipv6_get_next_ext_w(const uint8_t *p, int proto, size_t *ext_len); +enum rte_color +rte_meter_srtcm_color_blind_check_w(struct rte_meter_srtcm *m, + struct rte_meter_srtcm_profile *p, + uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_srtcm_color_aware_check_w( + struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color); +enum rte_color +rte_meter_trtcm_color_blind_check_w(struct rte_meter_trtcm *m, + struct rte_meter_trtcm_profile *p, + uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_trtcm_color_aware_check_w( + struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, + uint32_t pkt_len, enum rte_color pkt_color); +enum rte_color rte_meter_trtcm_rfc4115_color_blind_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len); +enum rte_color rte_meter_trtcm_rfc4115_color_aware_check_w( + struct rte_meter_trtcm_rfc4115 *m, + struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, + enum rte_color pkt_color); +uint64_t rte_eth_rss_hf_refine_w(uint64_t rss_hf); +uint16_t rte_eth_rx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts); +int rte_eth_rx_queue_count_w(uint16_t port_id, uint16_t queue_id); +int rte_eth_rx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset); +int rte_eth_tx_descriptor_status_w(uint16_t port_id, uint16_t queue_id, + uint16_t offset); +uint16_t rte_eth_tx_burst_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t rte_eth_tx_prepare_w(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t rte_eth_tx_buffer_flush_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer); +uint16_t rte_eth_tx_buffer_w(uint16_t port_id, uint16_t queue_id, + struct rte_eth_dev_tx_buffer *buffer, + struct rte_mbuf *tx_pkt); +uint16_t +rte_eth_recycle_mbufs_w(uint16_t rx_port_id, uint16_t rx_queue_id, + uint16_t tx_port_id, uint16_t tx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info); +int rte_eth_tx_queue_count_w(uint16_t port_id, uint16_t queue_id); +uint32_t rte_flow_dynf_metadata_get_w(struct rte_mbuf *m); +void rte_flow_dynf_metadata_set_w(struct rte_mbuf *m, uint32_t v); +int rte_flow_dynf_metadata_avail_w(void); +uint32_t rte_hash_crc_1byte_w(uint8_t data, uint32_t init_val); +uint32_t rte_hash_crc_2byte_w(uint16_t data, uint32_t init_val); +uint32_t rte_hash_crc_4byte_w(uint32_t data, uint32_t init_val); +uint32_t rte_hash_crc_8byte_w(uint64_t data, uint32_t init_val); +uint32_t rte_hash_crc_w(const void *data, uint32_t data_len, uint32_t init_val); +void rte_jhash_2hashes_w(const void *key, uint32_t length, uint32_t *pc, + uint32_t *pb); +void rte_jhash_32b_2hashes_w(const uint32_t *k, uint32_t length, uint32_t *pc, + uint32_t *pb); +uint32_t rte_jhash_w(const void *key, uint32_t length, uint32_t initval); +uint32_t rte_jhash_32b_w(const uint32_t *k, uint32_t length, uint32_t initval); +uint32_t rte_jhash_3words_w(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval); +uint32_t rte_jhash_2words_w(uint32_t a, uint32_t b, uint32_t initval); +uint32_t rte_jhash_1word_w(uint32_t a, uint32_t initval); +uint32_t rte_fbk_hash_get_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key); +int rte_fbk_hash_add_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint16_t value, + uint32_t bucket); +int rte_fbk_hash_add_key_w(struct rte_fbk_hash_table *ht, uint32_t key, + uint16_t value); +int rte_fbk_hash_delete_key_with_bucket_w(struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket); +int rte_fbk_hash_delete_key_w(struct rte_fbk_hash_table *ht, uint32_t key); +int rte_fbk_hash_lookup_with_bucket_w(const struct rte_fbk_hash_table *ht, + uint32_t key, uint32_t bucket); +int rte_fbk_hash_lookup_w(const struct rte_fbk_hash_table *ht, uint32_t key); +void rte_fbk_hash_clear_all_w(struct rte_fbk_hash_table *ht); +double rte_fbk_hash_get_load_factor_w(struct rte_fbk_hash_table *ht); +void rte_rcu_qsbr_thread_online_w(struct rte_rcu_qsbr *v, + unsigned int thread_id); +void rte_rcu_qsbr_thread_offline_w(struct rte_rcu_qsbr *v, + unsigned int thread_id); +void rte_rcu_qsbr_lock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +void rte_rcu_qsbr_unlock_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +uint64_t rte_rcu_qsbr_start_w(struct rte_rcu_qsbr *v); +void rte_rcu_qsbr_quiescent_w(struct rte_rcu_qsbr *v, unsigned int thread_id); +int rte_rcu_qsbr_check_w(struct rte_rcu_qsbr *v, uint64_t t, bool wait); +uint8_t rte_read8_relaxed_w(const void *addr); +uint16_t rte_read16_relaxed_w(const void *addr); +uint32_t rte_read32_relaxed_w(const void *addr); +uint64_t rte_read64_relaxed_w(const void *addr); +void rte_write8_relaxed_w(uint8_t value, void *addr); +void rte_write16_relaxed_w(uint16_t value, void *addr); +void rte_write32_relaxed_w(uint32_t value, void *addr); +void rte_write64_relaxed_w(uint64_t value, void *addr); +uint8_t rte_read8_w(const void *addr); +uint16_t rte_read16_w(const void *addr); +uint32_t rte_read32_w(const void *addr); +uint64_t rte_read64_w(const void *addr); +void rte_write8_w(uint8_t value, void *addr); +void rte_write16_w(uint16_t value, void *addr); +void rte_write32_w(uint32_t value, void *addr); +void rte_write64_w(uint64_t value, void *addr); +void rte_write32_wc_relaxed_w(uint32_t value, void *addr); +void rte_write32_wc_w(uint32_t value, void *addr); +void rte_mcslock_lock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +void rte_mcslock_unlock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_trylock_w(rte_mcslock_t **msl, rte_mcslock_t *me); +int rte_mcslock_is_locked_w(rte_mcslock_t *msl); +void rte_pflock_init_w(struct rte_pflock *pf); +void rte_pflock_read_lock_w(rte_pflock_t *pf); +void rte_pflock_read_unlock_w(rte_pflock_t *pf); +void rte_pflock_write_lock_w(rte_pflock_t *pf); +void rte_pflock_write_unlock_w(rte_pflock_t *pf); +uint32_t rte_reciprocal_divide_w(uint32_t a, struct rte_reciprocal R); +uint64_t rte_reciprocal_divide_u64_w(uint64_t a, + const struct rte_reciprocal_u64 *R); +void rte_seqcount_init_w(rte_seqcount_t *seqcount); +uint32_t rte_seqcount_read_begin_w(const rte_seqcount_t *seqcount); +bool rte_seqcount_read_retry_w(const rte_seqcount_t *seqcount, + uint32_t begin_sn); +void rte_seqcount_write_begin_w(rte_seqcount_t *seqcount); +void rte_seqcount_write_end_w(rte_seqcount_t *seqcount); +void rte_seqlock_init_w(rte_seqlock_t *seqlock); +uint32_t rte_seqlock_read_begin_w(const rte_seqlock_t *seqlock); +bool rte_seqlock_read_retry_w(const rte_seqlock_t *seqlock, uint32_t begin_sn); +void rte_seqlock_write_lock_w(rte_seqlock_t *seqlock); +void rte_seqlock_write_unlock_w(rte_seqlock_t *seqlock); +unsigned int rte_stack_push_w(struct rte_stack *s, void *const *obj_table, + unsigned int n); +unsigned int rte_stack_pop_w(struct rte_stack *s, void **obj_table, + unsigned int n); +unsigned int rte_stack_count_w(struct rte_stack *s); +unsigned int rte_stack_free_count_w(struct rte_stack *s); +uint32_t rte_softrss_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key); +uint32_t rte_softrss_be_w(uint32_t *input_tuple, uint32_t input_len, + const uint8_t *rss_key); +void rte_ticketlock_init_w(rte_ticketlock_t *tl); +void rte_ticketlock_lock_w(rte_ticketlock_t *tl); +void rte_ticketlock_unlock_w(rte_ticketlock_t *tl); +int rte_ticketlock_trylock_w(rte_ticketlock_t *tl); +int rte_ticketlock_is_locked_w(rte_ticketlock_t *tl); +void rte_ticketlock_recursive_init_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_lock_w(rte_ticketlock_recursive_t *tlr); +void rte_ticketlock_recursive_unlock_w(rte_ticketlock_recursive_t *tlr); +int rte_ticketlock_recursive_trylock_w(rte_ticketlock_recursive_t *tlr); +uint64_t rte_cyclecounter_cycles_to_ns_w(struct rte_timecounter *tc, + uint64_t cycles); +uint64_t rte_timecounter_update_w(struct rte_timecounter *tc, + uint64_t cycle_now); +uint64_t rte_timespec_to_ns_w(const struct timespec *ts); +struct timespec rte_ns_to_timespec_w(uint64_t nsec); +bool rte_trace_feature_is_enabled_w(void); diff --git a/nix/pkgs/dpdk/default.nix b/nix/pkgs/dpdk/default.nix new file mode 100644 index 000000000..abfcc8644 --- /dev/null +++ b/nix/pkgs/dpdk/default.nix @@ -0,0 +1,331 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + src, + stdenv, + lib, + pkg-config, + meson, + ninja, + libbsd, + # numactl, + rdma-core, + libnl, + python3, + build-params ? { + lto = "true"; + build-type = "release"; # "debug" | "release" + platform = "bluefield3"; + }, + writeText, + ... +}: + +stdenv.mkDerivation { + pname = "dpdk"; + version = src.branch; + src = src.outPath; + nativeBuildInputs = [ + meson + ninja + pkg-config + python3 + python3.pkgs.pyelftools + ]; + + buildInputs = [ + libbsd + libnl + # numactl + rdma-core + ]; + + postPatch = '' + patchShebangs config/arm buildtools + # We have no use for RTE_TRACE at all and it makes things more difficult from a security POV so disable it + sed -i 's/#define RTE_TRACE 1/#undef RTE_TRACE/g' config/rte_config.h + # We have no use for receive or transmit callbacks at this time so disable them + sed -i 's/#define RTE_ETHDEV_RXTX_CALLBACKS 1/#undef RTE_ETHDEV_RXTX_CALLBACKS/g' config/rte_config.h + ''; + + mesonFlags = + let + disabledLibs = [ + "acl" + "argparse" + "bbdev" + "bitratestats" + "bpf" + "cfgfile" + "compressdev" + "dispatcher" + "distributor" + "efd" + "fib" + "gpudev" + "graph" + "gro" + "gso" + "ip_frag" + "ipsec" + "jobstats" + "latencystats" + "lpm" + "member" + "metrics" + "mldev" + "node" + "pcapng" + "pdcp" + "pdump" + "pipeline" + "port" + "power" + "ptr_compress" + "rawdev" + "regexdev" + "reorder" + "rib" + "sched" + "table" + ]; + enabledLibs = [ + "cryptodev" # required for vhost + "dmadev" # required by vhost + "ethdev" + "eventdev" + "pci" + "security" + "timer" + "vhost" + ]; + disabledDrivers = [ + "baseband/*" + "bus/ifpga" + "bus/vdev" + "bus/vmbus" + "common/cnxk" + "common/cpt" + "common/dpaax" + "common/octeontx" + "common/octeontx2" + "common/qat" + "common/sfc_efx" + "compress/*" + "compress/mlx5" + "compress/zlib" + "crypto/*" + "crypto/aesni_gcm" + "crypto/aesni_mb" + "crypto/bcmfs" + "crypto/ccp" + "crypto/kasumi" + "crypto/mlx5" + "crypto/nitrox" + "crypto/null" + "crypto/openssl" + "crypto/scheduler" + "crypto/snow3g" + "crypto/virtio" + "crypto/zuc" + "event/dlb" + "event/dsw" + "event/opdl" + "event/skeleton" + "event/sw" + "net/acc100" + "net/af_packet" + "net/af_xdp" + "net/ark" + "net/atlantic" + "net/avp" + "net/axgbe" + "net/bcmfs" + "net/bnx2x" + "net/bnxt" + "net/bond" + "net/caam_jr" + "net/ccp" + "net/cnxk" + "net/cnxk_bphy" + "net/cpt" + "net/cxgbe" + "net/dlb2" + "net/dpaa" + "net/dpaa2" + "net/dpaa2_cmdif" + "net/dpaa2_qdma" + "net/dpaa2_sec" + "net/dpaa_sec" + "net/dpaax" + "net/dsw" + "net/ena" + "net/enetc" + "net/enic" + "net/failsafe" + "net/fm10k" + "net/fpga_5gnr_fec" + "net/fpga_lte_fec" + "net/fslmc" + "net/hinic" + "net/hns3" + "net/ifc" + "net/ifpga" + "net/igc" + "net/ioat" + "net/ionic" + "net/ipn3ke" + "net/kasumi" + "net/kni" + "net/liquidio" + "net/memif" + "net/mlx4" + "net/netvsc" + "net/nfp" + "net/ngbe" + "net/nitrox" + "net/ntb" + "net/null" + "net/octeontx" + "net/octeontx2" + "net/octeontx2_dma" + "net/octeontx2_ep" + "net/octeontx_ep" + "net/opdl" + "net/pcap" + "net/pfe" + "net/qede" + "net/sfc" + "net/sfc_efx" + "net/skeleton" + "net/snow3g" + "net/softnic" + "net/tap" + "net/thunderx" + "net/turbo_sw" + "net/txgbe" + "net/vdev" + "net/vdev_netvsc" + "net/vmbus" + "net/vmxnet3" + "net/zuc" + "raw/*" + "raw/ioat" + "raw/ntb" + "raw/skeleton" + "regex/*" + "regex/mlx5" + "vdpa/*" + "vdpa/ifc" + ]; + enabledDrivers = [ + "bus/auxiliary" + "bus/pci" + "common/mlx5" + "mempool/bucket" + "mempool/ring" + "mempool/stack" + "net/auxiliary" + "net/dmadev" + "net/intel/e1000" + "net/intel/i40e" + "net/intel/iavf" + "net/intel/ixgbe" + "net/mlx5" + "net/ring" + "net/vhost" + "net/virtio" + "vdpa/mlx5" + ]; + arch = stdenv.hostPlatform.parsed.cpu.name; + cpu = stdenv.hostPlatform.parsed.cpu.arch; + kernel = stdenv.hostPlatform.parsed.kernel.name; + endian = + { + littleEndian = "little"; + bigEndian = "big"; + } + .${stdenv.hostPlatform.parsed.cpu.significantByte.name}; + libc-vendor = + { + glibc = "gnu"; + musl = "musl"; + } + .${stdenv.hostPlatform.libc}; + isCrossCompile = stdenv.buildPlatform.parsed != stdenv.hostPlatform.parsed; + cross-prefix = "${arch}-unknown-${kernel}-${libc-vendor}"; + cross-file = writeText "cross-file.ini" '' + [binaries] + c = '${cross-prefix}-cc' + cpp = '${cross-prefix}-c++' + ar = '${cross-prefix}-ar' + strip = '${cross-prefix}-strip' + pkgconfig = '${cross-prefix}-pkg-config' + pkg-config = '${cross-prefix}-pkg-config' + + [host_machine] + system = '${kernel}' + cpu_family = '${arch}' + cpu = '${cpu}' + endian = '${endian}' + + [properties] + platform = '${build-params.platform}' + libc = '${libc-vendor}' + ''; + in + with build-params; + [ + "--buildtype=${build-type}" + "-Dauto_features=disabled" + "-Db_colorout=never" + "-Db_lto=${lto}" + "-Db_lundef=false" + "-Db_pgo=off" + "-Db_pie=true" + "-Dbackend=ninja" + "-Ddefault_library=static" + "-Denable_docs=false" + "-Denable_driver_sdk=false" + "-Dmax_numa_nodes=1" + "-Dtests=false" # Running DPDK tests in CI is usually silly + "-Duse_hpet=false" + "-Ddebug=false" + ''-Ddisable_drivers=${lib.concatStringsSep "," disabledDrivers}'' + ''-Denable_drivers=${lib.concatStringsSep "," enabledDrivers}'' + ''-Denable_libs=${lib.concatStringsSep "," enabledLibs}'' + ''-Ddisable_apps=*'' + ''-Ddisable_libs=${lib.concatStringsSep "," disabledLibs}'' + ] + ++ (if isCrossCompile then [ ''--cross-file=${cross-file}'' ] else [ ]); + + outputs = [ + "dev" + "out" + "share" + "static" + ]; + + CFLAGS = if stdenv.targetPlatform.parsed.cpu.name == "aarch64" then "-ffat-lto-objects" else ""; + + postInstall = '' + # Remove docs. We don't want these anyway + rm -rf $out/share/doc + # Remove python files from bin output (we never use them and they confuse dependency reports) + rm $out/bin/*.py + mkdir -p $static/lib $share; + mv $out/lib/*.a $static/lib + mv $out/share $share + ''; + + meta = with lib; { + description = "Set of libraries and drivers for fast packet processing"; + homepage = "http://dpdk.org/"; + license = with licenses; [ + lgpl21 + gpl2 + bsd2 + ]; + platforms = platforms.linux; + }; +} diff --git a/nix/pkgs/kopium/default.nix b/nix/pkgs/kopium/default.nix new file mode 100644 index 000000000..d5d9b4dd7 --- /dev/null +++ b/nix/pkgs/kopium/default.nix @@ -0,0 +1,12 @@ +{ + src, + rustPlatform, + ... +}: +rustPlatform.buildRustPackage (final: { + pname = "kopium"; + version = src.version; + src = src.outPath; + cargoLock.lockFile = "${final.src}/Cargo.lock"; + doCheck = false; +}) diff --git a/nix/pkgs/perftest/default.nix b/nix/pkgs/perftest/default.nix new file mode 100644 index 000000000..8b1bc9b3e --- /dev/null +++ b/nix/pkgs/perftest/default.nix @@ -0,0 +1,20 @@ +{ + src, + stdenv, + rdma-core, + autoreconfHook, + pciutils, + ... +}: +stdenv.mkDerivation (final: { + pname = "perftest"; + version = src.version; + src = src.outPath; + nativeBuildInputs = [ + autoreconfHook + ]; + buildInputs = [ + pciutils + rdma-core + ]; +}) diff --git a/nix/platforms.nix b/nix/platforms.nix new file mode 100644 index 000000000..50ee66e34 --- /dev/null +++ b/nix/platforms.nix @@ -0,0 +1,122 @@ +{ + lib ? (import { }).lib, + platform, + kernel ? "linux", + libc, +}: +let + platforms = rec { + x86-64-v3 = rec { + arch = "x86_64"; + march = "x86-64-v3"; + numa = { + max-nodes = 8; + }; + override = { + stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + }; + x86-64-v4 = lib.recursiveUpdate x86-64-v3 rec { + march = "x86-64-v4"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen3 = lib.recursiveUpdate x86-64-v4 rec { + march = "znver3"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen4 = lib.recursiveUpdate zen3 rec { + march = "znver4"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + zen5 = lib.recursiveUpdate zen4 rec { + march = "znver5"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-march=${march}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + bluefield2 = rec { + arch = "aarch64"; + march = "armv8.2-a"; + mcpu = "cortex-a72"; + numa = { + max-nodes = 1; + }; + override = { + stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + }; + bluefield3 = lib.recursiveUpdate bluefield2 rec { + march = "armv8.4-a"; + mcpu = "cortex-a78ae"; + override.stdenv.env = rec { + NIX_CFLAGS_COMPILE = [ "-mcpu=${mcpu}" ]; + NIX_CXXFLAGS_COMPILE = NIX_CFLAGS_COMPILE; + NIX_CFLAGS_LINK = [ ]; + }; + }; + }; +in +lib.fix ( + final: + platforms.${platform} + // { + info = + { + x86_64 = { + linux = { + gnu = { + target = "x86_64-unknown-linux-gnu"; + machine = "x86_64"; + nixarch = "gnu64"; + libc = "gnu"; + }; + musl = { + target = "x86_64-unknown-linux-musl"; + machine = "x86_64"; + nixarch = "musl64"; + libc = "musl"; + }; + }; + }; + aarch64 = { + linux = { + gnu = { + target = "aarch64-unknown-linux-gnu"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform"; + libc = "gnu"; + }; + musl = { + target = "aarch64-unknown-linux-musl"; + machine = "aarch64"; + nixarch = "aarch64-multiplatform-musl"; + libc = "musl"; + }; + }; + }; + } + .${final.arch}.${kernel}.${libc}; + } +) diff --git a/nix/profiles.nix b/nix/profiles.nix new file mode 100644 index 000000000..98af3083c --- /dev/null +++ b/nix/profiles.nix @@ -0,0 +1,237 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Open Network Fabric Authors +{ + arch, + profile, + sanitizers, + instrumentation, +}: +let + common.NIX_CFLAGS_COMPILE = [ + "-g3" + "-gdwarf-5" + # odr or strict-aliasing violations are indicative of LTO incompatibility, so check for that + "-Werror=odr" + "-Werror=strict-aliasing" + "-Wno-error=unused-command-line-argument" + ]; + common.NIX_CXXFLAGS_COMPILE = common.NIX_CFLAGS_COMPILE; + common.NIX_CFLAGS_LINK = [ + # getting proper LTO from LLVM compiled objects is best done with lld rather than ld, mold, or wild (at least at the + # time of writing) + "-fuse-ld=lld" + "-Wl,--build-id" + ]; + common.RUSTFLAGS = [ + "--cfg=tokio_unstable" + "-Cdebuginfo=full" + "-Cdwarf-version=5" + "-Csymbol-mangling-version=v0" + ] + ++ (map (flag: "-Clink-arg=${flag}") common.NIX_CFLAGS_LINK); + optimize-for.debug.NIX_CFLAGS_COMPILE = [ + "-fno-inline" + "-fno-omit-frame-pointer" + ]; + optimize-for.debug.NIX_CXXFLAGS_COMPILE = optimize-for.debug.NIX_CFLAGS_COMPILE; + optimize-for.debug.NIX_CFLAGS_LINK = [ ]; + optimize-for.debug.RUSTFLAGS = [ + "-Copt-level=0" + "-Cdebug-assertions=on" + "-Coverflow-checks=on" + ] + ++ (map (flag: "-Clink-arg=${flag}") optimize-for.debug.NIX_CFLAGS_LINK); + optimize-for.performance.NIX_CFLAGS_COMPILE = [ + "-O3" + "-flto=thin" + ]; + optimize-for.performance.NIX_CXXFLAGS_COMPILE = optimize-for.performance.NIX_CFLAGS_COMPILE ++ [ + "-fwhole-program-vtables" + ]; + optimize-for.performance.NIX_CFLAGS_LINK = optimize-for.performance.NIX_CXXFLAGS_COMPILE ++ [ + "-Wl,--lto-whole-program-visibility" + "-Wl,--gc-sections" + "-Wl,--as-needed" + ]; + optimize-for.performance.RUSTFLAGS = [ + "-Clinker-plugin-lto" + "-Cembed-bitcode=yes" + ] + ++ (map (flag: "-Clink-arg=${flag}") optimize-for.performance.NIX_CFLAGS_LINK); + secure.NIX_CFLAGS_COMPILE = [ + "-fstack-protector-strong" + "-fstack-clash-protection" + # we always want pic/pie and GOT offsets should be computed at compile time whenever possible + "-Wl,-z,relro,-z,now" + # "-fcf-protection=full" # requires extra testing before we enable + ]; + secure.NIX_CXXFLAGS_COMPILE = secure.NIX_CFLAGS_COMPILE; + # handing the CFLAGS back to clang/lld is basically required for -fsanitize + secure.NIX_CFLAGS_LINK = secure.NIX_CFLAGS_COMPILE; + secure.RUSTFLAGS = [ + "-Crelro-level=full" + # "-Zcf-protection=full" + ] + ++ (map (flag: "-Clink-arg=${flag}") secure.NIX_CFLAGS_LINK); + march.x86_64.NIX_CFLAGS_COMPILE = [ + # DPDK functionally requires some -m flags on x86_64. + # These features have been available for a long time and can be found on any reasonably recent machine, so just + # enable them here for all x86_64 builds. + # In the (very) unlikely event that you need to edit these flags, also edit the associated RUSTFLAGS to match. + "-mrtm" # TODO: try to convince DPDK not to rely on rtm + "-mcrc32" + "-mssse3" + ]; + march.x86_64.NIX_CXXFLAGS_COMPILE = march.x86_64.NIX_CFLAGS_COMPILE; + march.x86_64.NIX_CFLAGS_LINK = march.x86_64.NIX_CXXFLAGS_COMPILE; + march.x86_64.RUSTFLAGS = [ + # Ideally these should be kept in 1:1 alignment with the x86_64 NIX_CFLAGS_COMPILE settings. + # That said, rtm and crc32 are only kinda supported by rust, and rtm is functionally deprecated anyway, so we should + # try to remove DPDK's insistence on it. We are absolutely not using hardware memory transactions anyway; they + # proved to be broken in Intel's implementation, and AMD never built them in the first place. + # "-Ctarget-feature=+rtm,+crc32,+ssse3" + "-Ctarget-feature=+ssse3" + ] + ++ (map (flag: "-Clink-arg=${flag}") march.x86_64.NIX_CFLAGS_LINK); + march.aarch64.NIX_CFLAGS_COMPILE = [ ]; + march.aarch64.NIX_CXXFLAGS_COMPILE = march.aarch64.NIX_CFLAGS_COMPILE; + march.aarch64.NIX_CFLAGS_LINK = [ ]; + march.aarch64.RUSTFLAGS = [ ] ++ (map (flag: "-Clink-arg=${flag}") march.aarch64.NIX_CFLAGS_LINK); + sanitize.address.NIX_CFLAGS_COMPILE = [ + "-fsanitize=address,local-bounds" + ]; + sanitize.address.NIX_CXXFLAGS_COMPILE = sanitize.address.NIX_CFLAGS_COMPILE; + sanitize.address.NIX_CFLAGS_LINK = sanitize.address.NIX_CFLAGS_COMPILE ++ [ + "-static-libasan" + ]; + sanitize.address.RUSTFLAGS = [ + "-Zsanitizer=address" + "-Zexternal-clangrt" + ] + ++ (map (flag: "-Clink-arg=${flag}") sanitize.address.NIX_CFLAGS_LINK); + sanitize.leak.NIX_CFLAGS_COMPILE = [ + "-fsanitize=leak" + ]; + sanitize.leak.NIX_CXXFLAGS_COMPILE = sanitize.leak.NIX_CFLAGS_COMPILE; + sanitize.leak.NIX_CFLAGS_LINK = sanitize.leak.NIX_CFLAGS_COMPILE; + sanitize.leak.RUSTFLAGS = [ + "-Zsanitizer=leak" + "-Zexternal-clangrt" + ] + ++ (map (flag: "-Clink-arg=${flag}") sanitize.leak.NIX_CFLAGS_LINK); + sanitize.thread.NIX_CFLAGS_COMPILE = [ + "-fsanitize=thread" + ]; + sanitize.thread.NIX_CXXFLAGS_COMPILE = sanitize.thread.NIX_CFLAGS_COMPILE; + sanitize.thread.NIX_CFLAGS_LINK = sanitize.thread.NIX_CFLAGS_COMPILE ++ [ + "-Wl,--allow-shlib-undefined" + ]; + sanitize.thread.RUSTFLAGS = [ + "-Zsanitizer=thread" + "-Zexternal-clangrt" + # gimli doesn't like thread sanitizer, but it shouldn't be an issue since that is all build time logic + "-Cunsafe-allow-abi-mismatch=sanitizer" + ] + ++ (map (flag: "-Clink-arg=${flag}") sanitize.thread.NIX_CFLAGS_LINK); + # note: cfi _requires_ LTO and is fundamentally ill suited to debug builds + sanitize.cfi.NIX_CFLAGS_COMPILE = [ + "-fsanitize=cfi" + # visibility=default is functionally required if you use basically any cfi higher than icall. + # In theory we could set -fvisibility=hidden, but in practice that doesn't work because too many dependencies + # fail to build with that setting enabled. + # NOTE: you also want to enable -Wl,--lto-whole-program-visibility in the linker flags if visibility=default so that + # symbols can be refined to hidden visibility at link time. + # This "whole-program-visibility" flag is already enabled by the optimize profile, and + # given that the optimize profile is required for cfi to even build, we don't explicitly enable it again here. + "-fvisibility=default" + # required to properly link with rust + "-fsanitize-cfi-icall-experimental-normalize-integers" + # required in cases where perfect type strictness is not maintained but you still want to use CFI. + # Type fudging is common in C code, especially in cases where function pointers are used with lax const correctness. + # Ideally we wouldn't enable this, but we can't really re-write all of the C code in the world. + "-fsanitize-cfi-icall-generalize-pointers" + # "-fsanitize-cfi-cross-dso" + "-fsplit-lto-unit" # important for compatibility with rust's LTO + ]; + sanitize.cfi.NIX_CXXFLAGS_COMPILE = sanitize.cfi.NIX_CFLAGS_COMPILE; + sanitize.cfi.NIX_CFLAGS_LINK = sanitize.cfi.NIX_CFLAGS_COMPILE; + sanitize.cfi.RUSTFLAGS = [ + "-Zsanitizer=cfi" + "-Zsanitizer-cfi-normalize-integers" + "-Zsanitizer-cfi-generalize-pointers" + # "-Zsanitizer-cfi-cross-dso" + "-Zsplit-lto-unit" + ] + ++ (map (flag: "-Clink-arg=${flag}") sanitize.cfi.NIX_CFLAGS_LINK); + sanitize.safe-stack.NIX_CFLAGS_COMPILE = [ + "-fsanitize=safe-stack" + ]; + sanitize.safe-stack.NIX_CXXFLAGS_COMPILE = sanitize.safe-stack.NIX_CFLAGS_COMPILE; + sanitize.safe-stack.NIX_CFLAGS_LINK = sanitize.safe-stack.NIX_CFLAGS_COMPILE ++ [ + "-Wl,--allow-shlib-undefined" + ]; + sanitize.safe-stack.RUSTFLAGS = [ + "-Zsanitizer=safestack" + "-Zexternal-clangrt" + # gimli doesn't like thread sanitizer, but it shouldn't be an issue since that is all build time logic + "-Cunsafe-allow-abi-mismatch=sanitizer" + "-Ctarget-feature=-crt-static" # safe-stack doesn't work with any static libc of any kind + ] + ++ (map (flag: "-Clink-arg=${flag}") sanitize.safe-stack.NIX_CFLAGS_LINK); + sanitize.shadow-stack.NIX_CFLAGS_COMPILE = [ + "-ffixed-x18" + "-fsanitize=shadow-call-stack" + ]; + sanitize.shadow-stack.NIX_CXXFLAGS_COMPILE = sanitize.shadow-stack.NIX_CFLAGS_COMPILE; + sanitize.shadow-stack.NIX_CFLAGS_LINK = sanitize.shadow-stack.NIX_CFLAGS_COMPILE ++ [ + # "-Wl,--allow-shlib-undefined" + ]; + sanitize.shadow-stack.RUSTFLAGS = [ + "-Zfixed-x18" + "-Zsanitizer=shadow-call-stack" + "-Zexternal-clangrt" + # gimli doesn't like shadow-stack sanitizer, but it shouldn't be an issue since that is all build time logic + "-Cunsafe-allow-abi-mismatch=sanitizer,fixed-x18" + "-Ctarget-feature=-crt-static" # shadow-stack doesn't work with static libc + ] + ++ (map (flag: "-Clink-arg=${flag}") sanitize.shadow-stack.NIX_CFLAGS_LINK); + instrument.none.NIX_CFLAGS_COMPILE = [ ]; + instrument.none.NIX_CXXFLAGS_COMPILE = instrument.none.NIX_CFLAGS_COMPILE; + instrument.none.NIX_CFLAGS_LINK = instrument.none.NIX_CFLAGS_COMPILE; + instrument.none.RUSTFLAGS = + [ ] ++ (map (flag: "-Clink-arg=${flag}") instrument.none.NIX_CFLAGS_LINK); + instrument.coverage.NIX_CFLAGS_COMPILE = [ + "-fprofile-instr-generate" + "-fcoverage-mapping" + ]; + instrument.coverage.NIX_CXXFLAGS_COMPILE = instrument.coverage.NIX_CFLAGS_COMPILE; + instrument.coverage.NIX_CFLAGS_LINK = instrument.coverage.NIX_CFLAGS_COMPILE; + instrument.coverage.RUSTFLAGS = [ + "-Cinstrument-coverage" + ] + ++ (map (flag: "-Clink-arg=${flag}") instrument.coverage.NIX_CFLAGS_LINK); + combine-profiles = + features: + builtins.foldl' ( + acc: element: acc // (builtins.mapAttrs (var: val: (acc.${var} or [ ]) ++ val) element) + ) { } features; + profile-map = { + debug = combine-profiles [ + common + optimize-for.debug + ]; + release = combine-profiles [ + common + optimize-for.performance + secure + ]; + }; +in +combine-profiles ( + [ + profile-map."${profile}" + march."${arch}" + instrument."${instrumentation}" + ] + ++ (map (s: sanitize.${s}) sanitizers) +) diff --git a/npins/default.nix b/npins/default.nix new file mode 100644 index 000000000..884fc8cc5 --- /dev/null +++ b/npins/default.nix @@ -0,0 +1,249 @@ +/* + This file is provided under the MIT licence: + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +# Generated by npins. Do not modify; will be overwritten regularly +let + # Backwards-compatibly make something that previously didn't take any arguments take some + # The function must return an attrset, and will unfortunately be eagerly evaluated + # Same thing, but it catches eval errors on the default argument so that one may still call it with other arguments + mkFunctor = + fn: + let + e = builtins.tryEval (fn { }); + in + (if e.success then e.value else { error = fn { }; }) // { __functor = _self: fn; }; + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 + range = + first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); + concatStrings = builtins.concatStringsSep ""; + + # If the environment variable NPINS_OVERRIDE_${name} is set, then use + # the path directly as opposed to the fetched source. + # (Taken from Niv for compatibility) + mayOverride = + name: path: + let + envVarName = "NPINS_OVERRIDE_${saneName}"; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; + ersatz = builtins.getEnv envVarName; + in + if ersatz == "" then + path + else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( + if builtins.substring 0 1 ersatz == "/" then + /. + ersatz + else + /. + builtins.getEnv "PWD" + "/${ersatz}" + ); + + mkSource = + name: spec: + { + pkgs ? null, + }: + assert spec ? type; + let + # Unify across builtin and pkgs fetchers. + # `fetchGit` requires a wrapper because of slight API differences. + fetchers = + if pkgs == null then + { + inherit (builtins) fetchTarball fetchurl; + # For some fucking reason, fetchGit has a different signature than the other builtin fetchers … + fetchGit = args: (builtins.fetchGit args).outPath; + } + else + { + fetchTarball = + { + url, + sha256, + }: + pkgs.fetchzip { + inherit url sha256; + extension = "tar"; + }; + inherit (pkgs) fetchurl; + fetchGit = + { + url, + submodules, + rev, + name, + narHash, + }: + pkgs.fetchgit { + inherit url rev name; + fetchSubmodules = submodules; + hash = narHash; + }; + }; + + # Dispatch to the correct code path based on the type + path = + if spec.type == "Git" then + mkGitSource fetchers spec + else if spec.type == "GitRelease" then + mkGitSource fetchers spec + else if spec.type == "PyPi" then + mkPyPiSource fetchers spec + else if spec.type == "Channel" then + mkChannelSource fetchers spec + else if spec.type == "Tarball" then + mkTarballSource fetchers spec + else if spec.type == "Container" then + mkContainerSource pkgs spec + else + builtins.throw "Unknown source type ${spec.type}"; + in + spec // { outPath = mayOverride name path; }; + + mkGitSource = + { + fetchTarball, + fetchGit, + ... + }: + { + repository, + revision, + url ? null, + submodules, + hash, + ... + }: + assert repository ? type; + # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository + # In the latter case, there we will always be an url to the tarball + if url != null && !submodules then + fetchTarball { + inherit url; + sha256 = hash; + } + else + let + url = + if repository.type == "Git" then + repository.url + else if repository.type == "GitHub" then + "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" then + "${repository.server}/${repository.repo_path}.git" + else if repository.type == "Forgejo" then + "${repository.server}/${repository.owner}/${repository.repo}.git" + else + throw "Unrecognized repository type ${repository.type}"; + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; + + short = builtins.substring 0 7 rev; + + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; + in + "${if matched == null then "source" else builtins.head matched}${appendShort}"; + name = urlToName url revision; + in + fetchGit { + rev = revision; + narHash = hash; + + inherit name submodules url; + }; + + mkPyPiSource = + { fetchurl, ... }: + { + url, + hash, + ... + }: + fetchurl { + inherit url; + sha256 = hash; + }; + + mkChannelSource = + { fetchTarball, ... }: + { + url, + hash, + ... + }: + fetchTarball { + inherit url; + sha256 = hash; + }; + + mkTarballSource = + { fetchTarball, ... }: + { + url, + locked_url ? url, + hash, + ... + }: + fetchTarball { + url = locked_url; + sha256 = hash; + }; + + mkContainerSource = + pkgs: + { + image_name, + image_tag, + image_digest, + ... + }: + if pkgs == null then + builtins.throw "container sources require passing in a Nixpkgs value: https://github.com/andir/npins/blob/master/README.md#using-the-nixpkgs-fetchers" + else + pkgs.dockerTools.pullImage { + imageName = image_name; + imageDigest = image_digest; + finalImageTag = image_tag; + }; +in +mkFunctor ( + { + input ? ./sources.json, + }: + let + data = + if builtins.isPath input then + # while `readFile` will throw an error anyways if the path doesn't exist, + # we still need to check beforehand because *our* error can be caught but not the one from the builtin + # *piegames sighs* + if builtins.pathExists input then + builtins.fromJSON (builtins.readFile input) + else + throw "Input path ${toString input} does not exist" + else if builtins.isAttrs input then + input + else + throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset"; + version = data.version; + in + if version == 7 then + builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins + else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" +) diff --git a/npins/sources.json b/npins/sources.json new file mode 100644 index 000000000..b7b792557 --- /dev/null +++ b/npins/sources.json @@ -0,0 +1,124 @@ +{ + "pins": { + "crane": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "ipetkov", + "repo": "crane" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v0.22.0", + "revision": "40203daff663c9e0b70d052aae12819dea8e6798", + "url": "https://api.github.com/repos/ipetkov/crane/tarball/refs/tags/v0.22.0", + "hash": "sha256-8qxEFpj4dVmIuPn9j9z6NTbU+hrcGjBOvaxTzre5HmM=" + }, + "dpdk": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "githedgehog", + "repo": "dpdk" + }, + "branch": "pr/daniel-noland/cross-compile-fix", + "submodules": false, + "revision": "6736a6e32f5b3a8d16b2bd0e84b73af32540de77", + "url": "https://github.com/githedgehog/dpdk/archive/6736a6e32f5b3a8d16b2bd0e84b73af32540de77.tar.gz", + "hash": "sha256-aVtrmUtFkkC2SsnfWJmRN/Klwfb/EGLG+YYtSLm5tBY=" + }, + "gateway": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "githedgehog", + "repo": "gateway" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v0.33.0", + "revision": "18913fe34d78af396deb1e6a034d0258168122b1", + "url": "https://api.github.com/repos/githedgehog/gateway/tarball/v0.33.0", + "hash": "sha256-X4sbwW60BIiAh0N/Y4P3HQWoZb/vXOSu5GjVeu9TTWo=" + }, + "kopium": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "kube-rs", + "repo": "kopium" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "0.22.5", + "revision": "f346e2044500c8d71523c35d474bc2f6235a0060", + "url": "https://api.github.com/repos/kube-rs/kopium/tarball/0.22.5", + "hash": "sha256-zYmb+HxwEKEnzdqAzvki5M+NA2fGP174pRkU6B4WmZI=" + }, + "naersk": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "naersk" + }, + "branch": "master", + "submodules": false, + "revision": "d4155d6ebb70fbe2314959842f744aa7cabbbf6a", + "url": "https://github.com/nix-community/naersk/archive/d4155d6ebb70fbe2314959842f744aa7cabbbf6a.tar.gz", + "hash": "sha256-r+wgI+WvNaSdxQmqaM58lVNvJYJ16zoq+tKN20cLst4=" + }, + "nixpkgs": { + "type": "Channel", + "name": "nixpkgs-unstable", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre918100.0744ef1b047f/nixexprs.tar.xz", + "hash": "sha256-Ot0xSLsfRXy6IlMvnc8hSLHKNn/7R8yFDc7uI5Cjpr4=" + }, + "perftest": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "linux-rdma", + "repo": "perftest" + }, + "branch": "master", + "submodules": false, + "revision": "1c4dc79b81060f0707830c54bf5dae7102fdbbfa", + "url": "https://github.com/linux-rdma/perftest/archive/1c4dc79b81060f0707830c54bf5dae7102fdbbfa.tar.gz", + "hash": "sha256-XHWZGB5qo9FdJ1yVEiwaSMmRmT34V6hngAlZ1ptYkiw=" + }, + "rdma-core": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "githedgehog", + "repo": "rdma-core" + }, + "branch": "fix-lto-61.0", + "submodules": false, + "revision": "998375a38e27e66bc74ed7419a0b93d0066e8194", + "url": "https://github.com/githedgehog/rdma-core/archive/998375a38e27e66bc74ed7419a0b93d0066e8194.tar.gz", + "hash": "sha256-Qm5IhgRI5k+sDdBzyTIILg60jlmYroGWYyERSHKfuV4=" + }, + "rust-overlay": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "oxalica", + "repo": "rust-overlay" + }, + "branch": "master", + "submodules": false, + "revision": "03c6e38661c02a27ca006a284813afdc461e9f7e", + "url": "https://github.com/oxalica/rust-overlay/archive/03c6e38661c02a27ca006a284813afdc461e9f7e.tar.gz", + "hash": "sha256-yHKXXw2OWfIFsyTjduB4EyFwR0SYYF0hK8xI9z4NIn0=" + } + }, + "version": 7 +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..6c3cbe31a --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,27 @@ +[toolchain] +# NOTE: you can and should manually update this on new rust releases +channel = "1.92.0" + +components = [ + "rustc", + "cargo", + "rust-std", + "rust-docs", + "rustfmt", + "clippy", + "rust-analyzer", + "rust-src", + + ## disabled components ## + # "rust-mingw", # not relevant to us + # "llvm-tools", # we already have a full llvm in the npins, no need for another + # "miri", # not yet functional for us + # "rustc-codegen-cranelift-preview" # not relevant to us +] + +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl" +] diff --git a/scripts/rust.env b/scripts/rust.env index 823c85e94..9e9644e4e 100644 --- a/scripts/rust.env +++ b/scripts/rust.env @@ -1,24 +1,5 @@ RUSTC_BOOTSTRAP=1 -NEXTEST_EXPERIMENTAL_LIBTEST_JSON=1 -LINKER="-C linker=./compile-env/bin/clang -C link-arg=--ld-path=./compile-env/bin/ld.lld" -RELRO="-C relro-level=full" -CRT_STATIC="-C target-feature=+crt-static" -CRT_DYNAMIC="-C target-feature=-crt-static" -DEBUG="-C debuginfo=full -C split-debuginfo=off -C dwarf-version=5 -Z embed-source" -DEBUG_ASSERTIONS_ON="-C debug-assertions=on" -DEBUG_ASSERTIONS_OFF="-C debug-assertions=off" -OVERFLOW_CHECK_ON="-C overflow-checks=on" -OVERFLOW_CHECK_OFF="-C overflow-checks=off" -LTO="-C linker-plugin-lto -C lto=thin -C embed-bitcode=yes -C codegen-units=1" -COVERAGE="-C instrument-coverage" -OPTIMIZE_OFF="${DEBUG_ASSERTIONS_ON} ${OVERFLOW_CHECK_ON}" -OPTIMIZE_ON="-C opt-level=3 ${LTO} ${DEBUG_ASSERTIONS_OFF} ${OVERFLOW_CHECK_OFF}" -OPTIMIZE_FUZZ="-C opt-level=3 ${LTO} ${DEBUG_ASSERTIONS_ON} ${OVERFLOW_CHECK_ON}" -TARGET_CPU_DEBUG="-C target-cpu=generic" -TARGET_CPU_RELEASE="-C target-cpu=x86-64-v3" -TOKIO_UNSTABLE="--cfg tokio_unstable" -COMMON="${LINKER} ${RELRO} ${DEBUG}" -RUSTFLAGS_DEBUG="${COMMON} ${OPTIMIZE_OFF} ${TARGET_CPU_DEBUG} ${CRT_DYNAMIC} ${TOKIO_UNSTABLE}" -RUSTFLAGS_RELEASE="${COMMON} ${OPTIMIZE_ON} ${TARGET_CPU_RELEASE} ${CRT_DYNAMIC} ${TOKIO_UNSTABLE}" -RUSTFLAGS_FUZZ="${COMMON} ${OPTIMIZE_FUZZ} ${TARGET_CPU_RELEASE} ${CRT_DYNAMIC} ${TOKIO_UNSTABLE}" +RUSTFLAGS_DEBUG="" +RUSTFLAGS_RELEASE="" +RUSTFLAGS_FUZZ="" diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 112c4b8a4..000000000 --- a/shell.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - pkgs ? import { }, -}: -(pkgs.buildFHSEnv { - name = "dataplane-shell"; - targetPkgs = - pkgs: - (with pkgs; [ - # dev tools - bash - direnv - just - nil - nixd - wget - ]); -}).env diff --git a/sysfs/Cargo.toml b/sysfs/Cargo.toml index 5638e18ef..998e4987a 100644 --- a/sysfs/Cargo.toml +++ b/sysfs/Cargo.toml @@ -20,12 +20,11 @@ tracing-subscriber = { workspace = true, features = ["fmt"] } [dev-dependencies] # internal -n-vm = { workspace = true } +# n-vm = { workspace = true } # external [build-dependencies] # internal -dpdk-sysroot-helper = { workspace = true } # external diff --git a/sysfs/build.rs b/sysfs/build.rs index 52f5b0197..1c30f3c66 100644 --- a/sysfs/build.rs +++ b/sysfs/build.rs @@ -2,7 +2,7 @@ // Copyright Open Network Fabric Authors fn main() { - let sysroot = dpdk_sysroot_helper::get_sysroot(); - println!("cargo:rustc-link-search=all={sysroot}/lib"); - println!("cargo:rustc-link-arg=--sysroot={sysroot}"); + // let sysroot = dpdk_sysroot_helper::get_sysroot(); + // println!("cargo:rustc-link-search=all={sysroot}/lib"); + // println!("cargo:rustc-link-arg=--sysroot={sysroot}"); } diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 969760d81..6d2c9465c 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -12,3 +12,5 @@ nix = { workspace = true, default-features = false, features = ["sched", "fs"] } rtnetlink = { workspace = true, default-features = false, features = ["tokio_socket"] } tokio = { workspace = true, default-features = false, features = ["rt", "net", "time"] } tracing = { workspace = true, default-features = false, features = [] } + +proc-macro-error-attr2 = { version = "=2.0.0", default-features = true }