Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/scripts/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then

if [ "${SETUP_BUILD_AND_INSTALL_DPDK}" == "1" ]; then
echo "$STEP DPDK build and install"
bash "${root_folder}/script/build_dpdk.sh"
bash "${root_folder}/script/build_dpdk.sh" -f
STEP=$((STEP + 1))
fi

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ mtl_system_status_*
*.pcm
*.wav
script/ice-*
script/dpdk
script/dpdk-*
script/*.zip*
script/xdp-tools

#Generated documentation
Expand Down
8 changes: 7 additions & 1 deletion lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ toolchain = cc.get_id()
# allow experimental api
add_global_arguments('-DALLOW_EXPERIMENTAL_API', language : 'c')

# check dpdk version
versions_file = files('../versions.env')
versions_content = run_command('cat', versions_file, check: true).stdout()
dpdk_version_cmd = run_command('sh', '-c', 'grep "^DPDK_VER" ../versions.env | cut -d= -f2', check: true)
dpdk_version = dpdk_version_cmd.stdout().strip()

# add dependencies
libm_dep = cc.find_library('m', required : true)
libpthread_dep = cc.find_library('pthread', required : true)
libdl_dep = cc.find_library('dl', required : true)
if not is_windows
dpdk_dep = dependency('libdpdk', version: '>=25.03', required: true)
dpdk_dep = dependency('libdpdk', version: '>=' + dpdk_version, required: true)
libnuma_dep = cc.find_library('numa', required : true)
ws2_32_dep = [] # add this when the code uses hton/ntoh
endif
Expand Down
7 changes: 7 additions & 0 deletions lib/src/mt_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ mtl_handle mtl_init(struct mtl_init_params* p) {
err("%s, mt_dev_eal_init fail %d\n", __func__, ret);
return NULL;
}

const char* rte_ver = rte_version();
if (!strstr(rte_ver, "mtl")) {
err("%s, unpatched dpdk please use supported dpdk version: %s\n", __func__, rte_ver);
goto err_exit;
}

notice("%s, MTL version: %s, dpdk version: %s\n", __func__, mtl_version(),
rte_version());
#ifdef MTL_HAS_USDT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From bfd22ef915c550775275e52f851a1e98e99978b7 Mon Sep 17 00:00:00 2001
From: "Wesierski, Dawid" <[email protected]>
Date: Mon, 3 Nov 2025 10:27:50 -0500
Subject: [PATCH 6/6] config: add mtl version to version string

add verision string to tag the dpdk patched version
and allow mtl to recognize if driver is patched.
---
config/meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index f31fef216c..4781122ce4 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -78,10 +78,10 @@ if pver.get(2).contains('-rc')
dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1).to_int())
else
dpdk_conf.set('RTE_VER_MINOR', pver.get(2).to_int())
- dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
+ dpdk_conf.set_quoted('RTE_VER_SUFFIX', '_mtl_')
# for actual, non-rc releases, set the release value to 99 to ensure releases
# have higher version numbers than their respective release candidates
- dpdk_conf.set('RTE_VER_RELEASE', 99)
+ dpdk_conf.set('RTE_VER_RELEASE', 0)
endif

pmd_subdir_opt = get_option('drivers_install_subdir')
--
2.47.3

69 changes: 54 additions & 15 deletions script/build_dpdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,73 @@ script_folder=${script_path/$script_name/}
. "${script_folder}/common.sh"
cd "${script_folder}" || exit 1

set -x
show_help() {
cat <<EOF
Usage: $script_name [OPTIONS] [DPDK_VERSION]

if [ -n "$1" ]; then
DPDK_VER=$1
fi
dpdk_folder="dpdk_${DPDK_VER}"
Build and install DPDK with MTL patches.

OPTIONS:
-f Force rebuild (removes existing dpdk folder if present)
-h Show this help message
-v VERSION Specify DPDK version to build

EXAMPLES:
$script_name # Build default DPDK version
$script_name -v # Build specific DPDK version
$script_name -f -v 23.11 # Force rebuild of DPDK 23.11
EOF
}

FORCE=0
while getopts "fhv:" opt; do
case $opt in
f)
FORCE=1
;;
v)
DPDK_VER="$OPTARG"
;;
h)
show_help
exit 0
;;
*)
show_help
exit 1
;;
esac
done
shift $((OPTIND - 1))

dpdk_folder="dpdk-${DPDK_VER}"

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

if [ "$sourced" -eq 0 ]; then
echo "DPDK version: $DPDK_VER"

if [ $FORCE -eq 1 ] && [ -d "$dpdk_folder" ]; then
echo "Force rebuild enabled. Removing existing '$dpdk_folder' directory."
rm -rf "$dpdk_folder"
fi

if [ ! -d "$dpdk_folder" ]; then
# check out dpdk code
echo "Clone DPDK source code"
git clone https://github.com/DPDK/dpdk.git "$dpdk_folder"
fi
wget https://github.com/DPDK/dpdk/archive/refs/tags/v"${DPDK_VER}".zip
unzip v"${DPDK_VER}".zip

cd "$dpdk_folder" || exit 1
git checkout v"$DPDK_VER"
if git switch -c v"$DPDK_VER"_kahawai_build 2>/dev/null; then
git am ../../patches/dpdk/"$DPDK_VER"/*.patch
cd "$dpdk_folder" || exit 1
for patch_file in ../../patches/dpdk/"$DPDK_VER"/*.patch; do
patch -p1 -i "$patch_file"
done
else
echo "Branch v${DPDK_VER}_kahawai_build already exists."
echo "Skipping patch application assuming it has been applied before."
echo "DPDK source code already exists."
echo "To rebuild, please remove the '$dpdk_folder' directory and run this script again."
exit 0
fi

# build and install dpdk now
echo "Build and install DPDK now"
meson build
ninja -C build
cd build
Expand Down
Loading