Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions doc/xdp.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,10 @@ sudo pacman -Syu --needed make m4 clang llvm zlib elfutils libcap-ng

### Building xdp-tools (including libxdp & libbpf)

It is recommended to use the latest xdp-tools repository to build libxdp and libbpf. We added a fix to address memory leak in libxdp, you can refer to [PR 376](https://github.com/xdp-project/xdp-tools/pull/376)
Build libxdp and libbpf from the xdp-tools repository using the versions pinned in [`Media-Transport-Library/versions.env`](../versions.env) to ensure consistency.

```bash
git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git
cd xdp-tools
./configure
make
sudo make install
cd lib/libbpf/src
make
sudo make install
./script/build_ebpf_xdp.sh
```

### Building MTL
Expand All @@ -92,8 +85,8 @@ Ensure the libbpf and libxdp dependencies are found:

```text
# output from 'meson setup build'
Run-time dependency libxdp found: YES 1.4.1
Run-time dependency libbpf found: YES 1.2.0
Run-time dependency libxdp found: YES 1.6.0
Run-time dependency libbpf found: YES 1.5.0
```

If not, and you have installed them, you may run this command then reconfigure the project so pkg-config can find them:
Expand Down
28 changes: 24 additions & 4 deletions script/build_ebpf_xdp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,44 @@
# Copyright 2025 Intel Corporation

set -e
VERSIONS_ENV_PATH="$(dirname "$(readlink -qe "${BASH_SOURCE[0]}")")/../versions.env"

if [ -f "$VERSIONS_ENV_PATH" ]; then
# shellcheck disable=SC1090
. "$VERSIONS_ENV_PATH"
else
echo -e "Error: versions.env file not found at $VERSIONS_ENV_PATH"
exit 1
fi

script_name=$(basename "${BASH_SOURCE[0]}")
script_path=$(readlink -qe "${BASH_SOURCE[0]}")
script_folder=${script_path/$script_name/}

archive_name="xdp-tools.tar.gz"
archive_name="archive.zip"
repo_dir="${script_folder}/xdp-tools"

(return 0 2>/dev/null) && sourced=1 || sourced=0

if [ "$sourced" -eq 0 ]; then
pushd "${script_folder}" >/dev/null || exit 1

if [ ! -d "${repo_dir}" ]; then
echo "Clone XDP source code"
git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git "${repo_dir}"
if [ -d "${repo_dir}" ]; then
echo "XDP \"$(realpath "$repo_dir")\" source directory already exists, please remove it first"
exit 1
fi

echo "Clone XDP source code"
wget -O "${archive_name}" "$XDP_REPO_URL"
mkdir -p "${repo_dir}"
unzip "${archive_name}" -d "${repo_dir}"
mv "${repo_dir}"/xdp-tools-*/* "${repo_dir}"

rm "${archive_name}"
wget -O "${archive_name}" "$EBPF_REPO_URL"
unzip "${archive_name}" -d "${repo_dir}"/lib/libbpf
mv "${repo_dir}"/lib/libbpf/libbpf*/* "${repo_dir}"/lib/libbpf

pushd "${repo_dir}" >/dev/null || exit 1
./configure
make
Expand Down
4 changes: 4 additions & 0 deletions versions.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ ONE_API_GPU_VER=1.22.3
LIBRIST_COMMIT_VER=9f09a3defd6e59839aae3e3b7b5411213fa04b8a
RUST_HOOK_CARGO_VER=0.5.5
FFMPEG_VERSION=7.0
XDP_TOOLS_VER=1.6.0
EBPF_VER=1.5.0

DPDK_REPO=https://github.com/dpdk/dpdk/archive/refs/tags/v${DPDK_VER}.tar.gz
ICE_REPO=https://downloadmirror.intel.com/${ICE_DMID}/ice-${ICE_VER}.tar.gz
ONE_API_REPO=https://github.com/oneapi-src/level-zero/archive/refs/tags/v${ONE_API_GPU_VER}.tar.gz
XDP_REPO_URL=https://github.com/xdp-project/xdp-tools/archive/refs/tags/v${XDP_TOOLS_VER}.zip
EBPF_REPO_URL=https://github.com/libbpf/libbpf/archive/refs/tags/v${EBPF_VER}.zip
Loading