Skip to content

Commit 89fa969

Browse files
Add: DPDK patch validation check
Implement DPDK version verification to ensure MTL compatibility. This prevents runtime crashes by validating that users are running properly patched DPDK versions. Known limitation: Mixed environments (e.g., patched DPDK in Docker with unpatched system drivers) can still cause crashes, as driver-level patches cannot be detected.
1 parent 488ef84 commit 89fa969

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

lib/meson.build

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ toolchain = cc.get_id()
77
# allow experimental api
88
add_global_arguments('-DALLOW_EXPERIMENTAL_API', language : 'c')
99

10+
# check dpdk version
11+
versions_file = files('../versions.env')
12+
versions_content = run_command('cat', versions_file, check: true).stdout()
13+
dpdk_version_cmd = run_command('sh', '-c', 'grep "^DPDK_VER" ../versions.env | cut -d= -f2', check: true)
14+
dpdk_version = dpdk_version_cmd.stdout().strip()
15+
1016
# add dependencies
1117
libm_dep = cc.find_library('m', required : true)
1218
libpthread_dep = cc.find_library('pthread', required : true)
1319
libdl_dep = cc.find_library('dl', required : true)
1420
if not is_windows
15-
dpdk_dep = dependency('libdpdk', version: '>=25.03', required: true)
21+
dpdk_dep = dependency('libdpdk', version: '>=' + dpdk_version, required: true)
1622
libnuma_dep = cc.find_library('numa', required : true)
1723
ws2_32_dep = [] # add this when the code uses hton/ntoh
1824
endif

lib/src/mt_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,13 @@ mtl_handle mtl_init(struct mtl_init_params* p) {
414414
err("%s, mt_dev_eal_init fail %d\n", __func__, ret);
415415
return NULL;
416416
}
417+
418+
const char* rte_ver = rte_version();
419+
if (!strstr(rte_ver, "mtl")) {
420+
err("%s, unpatched dpdk please use supported dpdk version: %s\n", __func__, rte_ver);
421+
goto err_exit;
422+
}
423+
417424
notice("%s, MTL version: %s, dpdk version: %s\n", __func__, mtl_version(),
418425
rte_version());
419426
#ifdef MTL_HAS_USDT
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From bfd22ef915c550775275e52f851a1e98e99978b7 Mon Sep 17 00:00:00 2001
2+
From: "Wesierski, Dawid" <dawid.wesierski@intel.com>
3+
Date: Mon, 3 Nov 2025 10:27:50 -0500
4+
Subject: [PATCH 6/6] config: add mtl version to version string
5+
6+
add verision string to tag the dpdk patched version
7+
and allow mtl to recognize if driver is patched.
8+
---
9+
config/meson.build | 4 ++--
10+
1 file changed, 2 insertions(+), 2 deletions(-)
11+
12+
diff --git a/config/meson.build b/config/meson.build
13+
index f31fef216c..4781122ce4 100644
14+
--- a/config/meson.build
15+
+++ b/config/meson.build
16+
@@ -78,10 +78,10 @@ if pver.get(2).contains('-rc')
17+
dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1).to_int())
18+
else
19+
dpdk_conf.set('RTE_VER_MINOR', pver.get(2).to_int())
20+
- dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
21+
+ dpdk_conf.set_quoted('RTE_VER_SUFFIX', '_mtl_')
22+
# for actual, non-rc releases, set the release value to 99 to ensure releases
23+
# have higher version numbers than their respective release candidates
24+
- dpdk_conf.set('RTE_VER_RELEASE', 99)
25+
+ dpdk_conf.set('RTE_VER_RELEASE', 0)
26+
endif
27+
28+
pmd_subdir_opt = get_option('drivers_install_subdir')
29+
--
30+
2.47.3
31+

0 commit comments

Comments
 (0)