Skip to contentSkip to conversation

add versioned symbols for recently stabilized APIs

PATCH Superseded Dariusz Sosnowski 4 participants 39 messages Jun 23 – Jul 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover add versioned symbols for recently stabilized APIs

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957
but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Introduce versioning macros for global variable symbols.
- Patch 5 - Version the function and variable symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c

Issue is still not fully fixed for stabilized global variables:
rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask. Patch 4 and 5 address the bug for these global variables, by providing a single storage for both EXPERIMENTAL and DPDK_26 variable symbol versions.
This is achieved through symbol aliasing.
But this solution is limited only to executables compiled with clang.

clang and gcc have a different default behavior regarding relocations of global variables exposed by shared libraries.

With clang, R_X86_64_GLOB_DAT relocations are generated for executables:

   $ readelf -sW build-26.07/lib/librte_ethdev.so | grep rte_flow_dynf_metadata_offs
       113: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
       116: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
       970: 00000000000ea4c0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_impl
      1212: 00000000000ea4c0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_v26
      1325: 00000000000ea4c0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_exp
      1415: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
      1705: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
    $ readelf -rW build-26.07/drivers/librte_net_mlx5.so | grep rte_flow_dynf_metadata_offs
    0000000003ed5f18  0000001600000006 R_X86_64_GLOB_DAT      0000000000000000 rte_flow_dynf_metadata_offs@DPDK_26 + 0
    $ readelf -rW build-25.11/app/dpdk-testpmd | grep rte_flow_dynf_metadata_offs
--> 000000000028ef70  0000011300000006 R_X86_64_GLOB_DAT      0000000000000000 rte_flow_dynf_metadata_offs@EXPERIMENTAL + 0

With gcc, R_X86_64_COPY relocations are generated:

    $ readelf -sW build-26.07/lib/librte_ethdev.so | grep rte_flow_dynf_metadata_offs
       113: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
       116: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
      1471: 00000000000e74e0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_impl
      2134: 00000000000e74e0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_v26
      2247: 00000000000e74e0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_exp
      2337: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
      2627: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
    $ readelf -rW build-26.07/drivers/librte_net_mlx5.so | grep rte_flow_dynf_metadata_offs
    00000000046dbef0  0000001600000006 R_X86_64_GLOB_DAT      0000000000000000 rte_flow_dynf_metadata_offs@DPDK_26 + 0
    $ readelf -rW build-25.11/app/dpdk-testpmd | grep rte_flow_dynf_metadata_offs
--> 000000000029b540  000001d200000005 R_X86_64_COPY          000000000029b540 rte_flow_dynf_metadata_offs@EXPERIMENTAL + 0

With copy relocations (testpmd linked through gcc) the following happens:

- When variable symbol (with EXPERIMENTAL version) gets resolved inside executable, global variable gets copied from read-only data to executable's BSS section. Executable will access this variable through BSS.
- When variable symbol (with DPDK_26 version) gets resolved inside a library, global variable is accessed indirectly through GOT.
It is stored inside BSS section of the shared library.

So executable and libraries refer to different storage, eventually leading to inconsistent runtime behavior. Problems only appears when executable and library require different versions of global variable symbol.
If testpmd from 26.07 is used with libraries from 26.07, GOT entry for these variables will point to copied variable.

Without copy relocations (testpmd linked through clang) both executable and libraries access the global variable indirectly through GOT. Runtime behavior is consistent, regardless of the mix of variable symbol versions.

The only other solution I could find was to use dlsym() inside libraries
to dynamically resolve the location rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, but this solution sounds like an overkill.
Essentially this would require moving to getter/setter functions for these variables inside the library.

I would appreciate any feedback or suggestions if anybody had encountered a similar issue before.

Dariusz Sosnowski (5):
eal: fix macro for versioned experimental symbol
drivers: support function versioning net/mlx5: fix stabilized function versions
eal: support aliases for versioned variable symbols
ethdev: fix promoted flow metadata symbols

 buildtools/gen-version-map.py        | 11 ++++++++++
 drivers/meson.build                  |  8 +++++++
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++-----
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++-----
 lib/eal/common/eal_export.h          | 24 +++++++++++++++++++-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 33 ++++++++++++++++++----------
 8 files changed, 96 insertions(+), 24 deletions(-)

--
2.47.3

#1 lore raw

PATCH 1/5 eal: fix macro for versioned experimental symbol

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Fixes e30e194c4d06 ("eal: rework function versioning macros")
---
 lib/eal/common/eal_export.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eal/common/eal_export.h +1 -1
index 888fd9f9ed..7971bf8d7a 100644
@@ -72,7 +72,7 @@ __rte_used type name ## _v ## ver args; \
 type name ## _v ## ver args
 
 #define RTE_VERSION_EXPERIMENTAL_SYMBOL(type, name, args) VERSIONING_WARN \
-__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
+__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL"); \
 __rte_used type name ## _exp args; \
 type name ## _exp args
 
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH 1/5] eal: fix macro for versioned experimental symbol

Quoted 15 lines · On Tue, 23 Jun 2026 13:37:47 +0200 Dariusz Sosnowski <[email protected]>…

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Quoted 4 lines
Fixes e30e194c4d06 ("eal: rework function versioning macros")

Signed-

I didn't see this because clang doesn't have symver support. Which version of clang is this?

#3 lore raw

Re: [PATCH 1/5] eal: fix macro for versioned experimental symbol

Quoted 18 lines · Stephen Hemminger
Quoted 15 lines · On Tue, 23 Jun 2026 13:37:47 +0200 Dariusz Sosnowski <[email protected]>…

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Quoted 7 lines
Quoted 4 lines
Fixes e30e194c4d06 ("eal: rework function versioning macros")

Signed-

I didn't see this because clang doesn't have symver support. Which version of clang is this?

clang 19 available on Debian 13:

  $ clang --version
  Debian clang version 19.1.7 (3+b1)
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/lib/llvm-19/bin
#4 lore raw

Re: [PATCH 1/5] eal: fix macro for versioned experimental symbol

Quoted 27 lines · On Tue, 23 Jun 2026 17:26:22 +0200 Dariusz Sosnowski <[email protected]>…
Quoted 18 lines · Stephen Hemminger
Quoted 15 lines · On Tue, 23 Jun 2026 13:37:47 +0200 Dariusz Sosnowski <[email protected]>…

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Quoted 7 lines
Quoted 4 lines
Fixes e30e194c4d06 ("eal: rework function versioning macros")

Signed-

I didn't see this because clang doesn't have symver support. Which version of clang is this?

Quoted 7 lines

clang 19 available on Debian 13:

  $ clang --version
  Debian clang version 19.1.7 (3+b1)
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/lib/llvm-19/bin

Ok, that was the asm block not the symver attribute.

#5 lore raw

PATCH 2/5 drivers: support function versioning

In reply to Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/meson.build +8 -0
index 4d95604ecd..a63d93372a 100644
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by Windows.'.format(name))
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         dpdk_headers += headers

--
2.47.3

#6 lore raw

PATCH 3/5 net/mlx5: fix stabilized function versions

In reply to Dariusz Sosnowski

Offending patch stabilized the following function symbols:

- rte_pmd_mlx5_driver_event_cb_register
- rte_pmd_mlx5_driver_event_cb_unregister
- rte_pmd_mlx5_enable_steering
- rte_pmd_mlx5_disable_steering

These function symbols were introduced in 25.11.
Any application using these functions, linked against 25.11 version, would fail when used with 26.07 libraries, because only DPDK_26 versions of these symbols were exported.

This patch fixes that by adding proper function symbol versioning to these symbols.

Fixes e8cab133645f ("net/mlx5: promote some private API to stable")
---
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 3 files changed, 30 insertions(+), 12 deletions(-)
drivers/net/mlx5/meson.build +2 -0
index 82a7dfe782..0fa6322779 100644
@@ -2,6 +2,8 @@
 # Copyright 2018 6WIND S.A.
 # Copyright 2018 Mellanox Technologies, Ltd
 
+use_function_versioning = true
+
 if not (is_linux or is_windows)
     build = false
     reason = 'only supported on Linux and Windows'
drivers/net/mlx5/mlx5_driver_event.c +16 -6
index 89e49331c8..d0e22d6151 100644
@@ -236,9 +236,8 @@ notify_existing_devices(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
 		notify_existing_queues(port_id, cb, opaque);
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_register)
-int
-rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_register,
+		   (rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
 {
 	struct registered_cb *r;
 
@@ -264,9 +263,14 @@ rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, v
 	return 0;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_unregister)
-int
-rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_register,
+				(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
+{
+	return rte_pmd_mlx5_driver_event_cb_register(cb, opaque);
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_unregister,
+		   (rte_pmd_mlx5_driver_event_callback_t cb))
 {
 	struct registered_cb *r;
 	bool found = false;
@@ -289,6 +293,12 @@ rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_unregister,
+				(rte_pmd_mlx5_driver_event_callback_t cb))
+{
+	return rte_pmd_mlx5_driver_event_cb_unregister(cb);
+}
+
 RTE_FINI(rte_pmd_mlx5_driver_event_cb_cleanup) {
 	struct registered_cb *r;
 
drivers/net/mlx5/mlx5_flow.c +12 -6
index a95dd9dc94..4b984df892 100644
@@ -12506,9 +12506,7 @@ flow_disable_steering_run_on_related(struct rte_eth_dev *dev,
 	}
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_disable_steering)
-void
-rte_pmd_mlx5_disable_steering(void)
+RTE_DEFAULT_SYMBOL(26, void, rte_pmd_mlx5_disable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12532,9 +12530,12 @@ rte_pmd_mlx5_disable_steering(void)
 	mlx5_steering_disabled = true;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_enable_steering)
-int
-rte_pmd_mlx5_enable_steering(void)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(void, rte_pmd_mlx5_disable_steering, (void))
+{
+	rte_pmd_mlx5_disable_steering();
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_enable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12551,6 +12552,11 @@ rte_pmd_mlx5_enable_steering(void)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_enable_steering, (void))
+{
+	return rte_pmd_mlx5_enable_steering();
+}
+
 bool
 mlx5_vport_rx_metadata_passing_enabled(const struct mlx5_dev_ctx_shared *sh)
 {
Signature · 1 line
2.47.3
#7 lore raw

PATCH 4/5 eal: support aliases for versioned variable symbols

In reply to Dariusz Sosnowski

Existing symbol versioning macros are not suitable for versioning exported global variables.

Specifically, if existing macros are used for versioning global variable symbol promoted from experimental to stable, result would be multiple variables with separate storage defined. If an application was linked against older DPDK and had copy relocations, this would yield an inconsistent behavior:

- Application would use experimental symbol version, with storage set up in BSS section in application.
- Library would use latest symbol version, with storage set up in BSS section of shared object.

This patch adds versioning macros which utilize symbol aliasing. Specifically, a new variable (with version suffix) is defined as an alias to private (static) variable inside the library. Variable symbol versions are attached to these alias variables.

Following macros are added:

- RTE_VERSION_EXPERIMENTAL_SYMBOL_ALIAS
- RTE_DEFAULT_SYMBOL_ALIAS

---
 buildtools/gen-version-map.py | 11 +++++++++++
 lib/eal/common/eal_export.h   | 22 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)
buildtools/gen-version-map.py +11 -0
index 57e08a8c0f..aa88e69179 100755
@@ -14,8 +14,12 @@
 export_int_sym_regexp = re.compile(r"^RTE_EXPORT_INTERNAL_SYMBOL\(([^)]+)\)")
 export_sym_regexp = re.compile(r"^RTE_EXPORT_SYMBOL\(([^)]+)\)")
 ver_sym_regexp = re.compile(r"^RTE_VERSION_SYMBOL\(([^,]+), [^,]+, ([^,]+),")
+
 ver_exp_sym_regexp = re.compile(r"^RTE_VERSION_EXPERIMENTAL_SYMBOL\([^,]+, ([^,]+),")
+ver_exp_sym_alias_regexp = re.compile(r"^RTE_VERSION_EXPERIMENTAL_SYMBOL_ALIAS\([^,]+, ([^,]+),")
+
 default_sym_regexp = re.compile(r"^RTE_DEFAULT_SYMBOL\(([^,]+), [^,]+, ([^,]+),")
+default_sym_alias_regexp = re.compile(r"^RTE_DEFAULT_SYMBOL_ALIAS\(([^,]+), [^,]+, ([^,]+),")
 
 parser = argparse.ArgumentParser(
     description=__doc__,
@@ -73,10 +77,17 @@
         elif ver_exp_sym_regexp.match(ln):
             node = "EXPERIMENTAL"
             symbol = ver_exp_sym_regexp.match(ln).group(1)
+        elif ver_exp_sym_alias_regexp.match(ln):
+            node = "EXPERIMENTAL"
+            symbol = ver_exp_sym_alias_regexp.match(ln).group(1)
         elif default_sym_regexp.match(ln):
             abi = default_sym_regexp.match(ln).group(1)
             node = f"DPDK_{abi}"
             symbol = default_sym_regexp.match(ln).group(2)
+        elif default_sym_alias_regexp.match(ln):
+            abi = default_sym_alias_regexp.match(ln).group(1)
+            node = f"DPDK_{abi}"
+            symbol = default_sym_alias_regexp.match(ln).group(2)
 
         if not symbol:
             continue
lib/eal/common/eal_export.h +22 -0
index 7971bf8d7a..5b458f81c6 100644
@@ -63,6 +63,14 @@ __attribute__((__symver__(RTE_STR(name) "@@DPDK_" RTE_STR(ver)))) \
 type name ## _v ## ver args; \
 type name ## _v ## ver args
 
+#define RTE_VERSION_EXPERIMENTAL_SYMBOL_ALIAS(type, name, orig) VERSIONING_WARN \
+extern type name ## _exp __attribute((alias(RTE_STR(orig)), \
+				      __symver__(RTE_STR(name) "@EXPERIMENTAL")))
+
+#define RTE_DEFAULT_SYMBOL_ALIAS(ver, type, name, orig) VERSIONING_WARN \
+extern type name ## _v ## ver __attribute((alias(RTE_STR(orig)), \
+					   __symver__(RTE_STR(name) "@@DPDK_" RTE_STR(ver))))
+
 #else /* !__has_attribute(symver) */
 
 /* Use asm tag to create symbol table entry */
@@ -81,6 +89,14 @@ __asm__(".symver " RTE_STR(name) "_v" RTE_STR(ver) ", " RTE_STR(name) "@@DPDK_"
 __rte_used type name ## _v ## ver args; \
 type name ## _v ## ver args
 
+#define RTE_DEFAULT_SYMBOL_ALIAS(ver, type, name, orig) VERSIONING_WARN \
+extern type name ## _v ## ver __attribute__((alias(RTE_STR(orig)))); \
+__asm__(".symver " RTE_STR(name) "_v" RTE_STR(ver) ", " RTE_STR(name) "@@DPDK_" RTE_STR(ver));
+
+#define RTE_VERSION_EXPERIMENTAL_SYMBOL_ALIAS(type, name, orig) VERSIONING_WARN \
+extern type name ## _exp __attribute__((alias(RTE_STR(orig)))); \
+__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL");
+
 #endif /* __has_attribute(symver) */
 
 #else /* !RTE_BUILD_SHARED_LIB */
@@ -97,6 +113,12 @@ type name ## _exp args
 #define RTE_DEFAULT_SYMBOL(ver, type, name, args) VERSIONING_WARN \
 type name args
 
+#define RTE_VERSION_EXPERIMENTAL_SYMBOL_ALIAS(type, name, orig) VERSIONING_WARN \
+extern type name ## _exp __attribute__((alias(RTE_STR(orig))));
+
+#define RTE_DEFAULT_SYMBOL_ALIAS(ver, type, name, orig) VERSIONING_WARN \
+extern type name __attribute__((alias(RTE_STR(orig))));
+
 #endif /* RTE_BUILD_SHARED_LIB */
 
 #endif /* EAL_EXPORT_H */
Signature · 1 line
2.47.3
#8 lore raw

PATCH 5/5 ethdev: fix promoted flow metadata symbols

In reply to Dariusz Sosnowski

Offending patch stabilized the following symbols:

- 1 function symbol:
- rte_flow_dynf_metadata_register
- 2 global variable symbols:
- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask

Any application using these flow metadata symbols, which was linked dynamically against 25.11 version of ethdev library and using current version of ethdev library would fail on symbol resolution, because EXPERIMENTAL versions were not exported.
Specifically, on application start up
variable symbol lookup error happens:

/tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
symbol lookup error: /tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
undefined symbol: rte_flow_dynf_metadata_offs, version EXPERIMENTAL

This error occurss because symbol lookup for global variables happens on application startup.

This patch addresses that by adding versioned aliases for the following variable symbols:

- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask

Versioned function symbols are also added
for rte_flow_dynf_metadata_register().

Bugzilla ID: 1957

Fixes 4ee2f5c1cedf ("ethdev: promote flow metadata API to stable")
---
 lib/ethdev/meson.build |  2 ++
 lib/ethdev/rte_flow.c  | 33 ++++++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 11 deletions(-)
lib/ethdev/meson.build +2 -0
index 8ba6c708a2..63fd866af9 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+use_function_versioning = true
+
 sources = files(
         'ethdev_driver.c',
         'ethdev_private.c',
lib/ethdev/rte_flow.c +22 -11
index ec0fe08355..a8c01ffe8a 100644
@@ -23,12 +23,20 @@
 #define FLOW_LOG RTE_ETHDEV_LOG_LINE
 
 /* Mbuf dynamic field name for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_offs)
-int32_t rte_flow_dynf_metadata_offs = -1;
+static int32_t rte_flow_dynf_metadata_offs_impl = -1;
+
+RTE_DEFAULT_SYMBOL_ALIAS(26, int32_t, rte_flow_dynf_metadata_offs,
+			 rte_flow_dynf_metadata_offs_impl);
+RTE_VERSION_EXPERIMENTAL_SYMBOL_ALIAS(int32_t, rte_flow_dynf_metadata_offs,
+				      rte_flow_dynf_metadata_offs_impl);
 
 /* Mbuf dynamic field flag bit number for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_mask)
-uint64_t rte_flow_dynf_metadata_mask;
+static uint64_t rte_flow_dynf_metadata_mask_impl = 0;
+
+RTE_DEFAULT_SYMBOL_ALIAS(26, uint64_t, rte_flow_dynf_metadata_mask,
+			 rte_flow_dynf_metadata_mask_impl);
+RTE_VERSION_EXPERIMENTAL_SYMBOL_ALIAS(uint64_t, rte_flow_dynf_metadata_mask,
+				      rte_flow_dynf_metadata_mask_impl);
 
 /**
  * Flow elements description tables.
@@ -281,9 +289,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(JUMP_TO_TABLE_INDEX, sizeof(struct rte_flow_action_jump_to_table_index)),
 };
 
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_register)
-int
-rte_flow_dynf_metadata_register(void)
+RTE_DEFAULT_SYMBOL(26, int, rte_flow_dynf_metadata_register, (void))
 {
 	int offset;
 	int flag;
@@ -303,19 +309,24 @@ rte_flow_dynf_metadata_register(void)
 	flag = rte_mbuf_dynflag_register(&desc_flag);
 	if (flag < 0)
 		goto error;
-	rte_flow_dynf_metadata_offs = offset;
-	rte_flow_dynf_metadata_mask = RTE_BIT64(flag);
+	rte_flow_dynf_metadata_offs_impl = offset;
+	rte_flow_dynf_metadata_mask_impl = RTE_BIT64(flag);
 
 	rte_flow_trace_dynf_metadata_register(offset, RTE_BIT64(flag));
 
 	return 0;
 
 error:
-	rte_flow_dynf_metadata_offs = -1;
-	rte_flow_dynf_metadata_mask = UINT64_C(0);
+	rte_flow_dynf_metadata_offs_impl = -1;
+	rte_flow_dynf_metadata_mask_impl = UINT64_C(0);
 	return -rte_errno;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
+{
+	return rte_flow_dynf_metadata_register();
+}
+
 static inline void
 fts_enter(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.47.3
#9 lore raw
In reply to Dariusz Sosnowski
Quoted 101 lines · On Tue, 23 Jun 2026 13:37:46 +0200 Dariusz Sosnowski <[email protected]>…

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957
but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Introduce versioning macros for global variable symbols.
- Patch 5 - Version the function and variable symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c

Issue is still not fully fixed for stabilized global variables:
rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask. Patch 4 and 5 address the bug for these global variables, by providing a single storage for both EXPERIMENTAL and DPDK_26 variable symbol versions.
This is achieved through symbol aliasing.
But this solution is limited only to executables compiled with clang.

clang and gcc have a different default behavior regarding relocations of global variables exposed by shared libraries.

With clang, R_X86_64_GLOB_DAT relocations are generated for executables:

   $ readelf -sW build-26.07/lib/librte_ethdev.so | grep rte_flow_dynf_metadata_offs
       113: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
       116: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
       970: 00000000000ea4c0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_impl
      1212: 00000000000ea4c0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_v26
      1325: 00000000000ea4c0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_exp
      1415: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
      1705: 00000000000ea4c0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
    $ readelf -rW build-26.07/drivers/librte_net_mlx5.so | grep rte_flow_dynf_metadata_offs
    0000000003ed5f18  0000001600000006 R_X86_64_GLOB_DAT      0000000000000000 rte_flow_dynf_metadata_offs@DPDK_26 + 0
    $ readelf -rW build-25.11/app/dpdk-testpmd | grep rte_flow_dynf_metadata_offs
--> 000000000028ef70  0000011300000006 R_X86_64_GLOB_DAT      0000000000000000 rte_flow_dynf_metadata_offs@EXPERIMENTAL + 0  

With gcc, R_X86_64_COPY relocations are generated:

    $ readelf -sW build-26.07/lib/librte_ethdev.so | grep rte_flow_dynf_metadata_offs
       113: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
       116: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
      1471: 00000000000e74e0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_impl
      2134: 00000000000e74e0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_v26
      2247: 00000000000e74e0     4 OBJECT  LOCAL  DEFAULT   24 rte_flow_dynf_metadata_offs_exp
      2337: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@@DPDK_26
      2627: 00000000000e74e0     4 OBJECT  GLOBAL DEFAULT   24 rte_flow_dynf_metadata_offs@EXPERIMENTAL
    $ readelf -rW build-26.07/drivers/librte_net_mlx5.so | grep rte_flow_dynf_metadata_offs
    00000000046dbef0  0000001600000006 R_X86_64_GLOB_DAT      0000000000000000 rte_flow_dynf_metadata_offs@DPDK_26 + 0
    $ readelf -rW build-25.11/app/dpdk-testpmd | grep rte_flow_dynf_metadata_offs
--> 000000000029b540  000001d200000005 R_X86_64_COPY          000000000029b540 rte_flow_dynf_metadata_offs@EXPERIMENTAL + 0  

With copy relocations (testpmd linked through gcc) the following happens:

- When variable symbol (with EXPERIMENTAL version) gets resolved inside executable, global variable gets copied from read-only data to executable's BSS section. Executable will access this variable through BSS.
- When variable symbol (with DPDK_26 version) gets resolved inside a library, global variable is accessed indirectly through GOT.
It is stored inside BSS section of the shared library.

So executable and libraries refer to different storage, eventually leading to inconsistent runtime behavior. Problems only appears when executable and library require different versions of global variable symbol.
If testpmd from 26.07 is used with libraries from 26.07, GOT entry for these variables will point to copied variable.

Without copy relocations (testpmd linked through clang) both executable and libraries access the global variable indirectly through GOT. Runtime behavior is consistent, regardless of the mix of variable symbol versions.

The only other solution I could find was to use dlsym() inside libraries
to dynamically resolve the location rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, but this solution sounds like an overkill.
Essentially this would require moving to getter/setter functions for these variables inside the library.

I would appreciate any feedback or suggestions if anybody had encountered a similar issue before.

Dariusz Sosnowski (5):
eal: fix macro for versioned experimental symbol
drivers: support function versioning net/mlx5: fix stabilized function versions
eal: support aliases for versioned variable symbols
ethdev: fix promoted flow metadata symbols

 buildtools/gen-version-map.py        | 11 ++++++++++
 drivers/meson.build                  |  8 +++++++
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++-----
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++-----
 lib/eal/common/eal_export.h          | 24 +++++++++++++++++++-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 33 ++++++++++++++++++----------
 8 files changed, 96 insertions(+), 24 deletions(-)
Quoted 3 lines

--
2.47.3

The bugfix is good, but not sure the rest is needed right now.
It is getting late to add more stuff for 26.07 and in 26.11 function versioning will not be needed.

#10 lore raw
In reply to Dariusz Sosnowski

Hello Dariusz,

Quoted 2 lines · Dariusz Sosnowski

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957

It is expected that experimental symbols may disappear overnight, and this bug could also be closed as NOTABUG.

On the other hand, we do state in the doc that compatibility could be provided when stabilising an experimental API, so ok.. let's try.

Quoted 3 lines

but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.

Ouch... /me hides.

Quoted 9 lines

- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Introduce versioning macros for global variable symbols.
- Patch 5 - Version the function and variable symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c

Issue is still not fully fixed for stabilized global variables:
rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

Well, symbol versioning is not something for variables. Exposing global variables was a mistake from the start... Those were exported for "performance" reasons as those are accessed via inline helpers (but I am not sure there were benchmarks showing the benefits).

I am for forbidding exports of global variables from now, unless some really good performance benchmark is provided (@techboard for info).

Now, in practice for your issue, rather than reintroducing symbol aliases (technical solution that I dropped when refactoring the macros), I think we can do with some middle ground approach:
- leaving the inline helpers as "stable" (not __rte_experimental),
- restoring the EXPERIMENTAL version on the global variables, this will restore the location of those symbols from the previous ABI pov, and the checks won't catch this discrepancy anyway,
- during 26.11, drop the EXPERIMENTAL version on those variables,

In other words, stopping at your patch 3 of the series, then adding:

$ git diff
lib/ethdev/rte_flow.c +2 -2
index ec0fe08355..8bd21ccd31 100644
@@ -23,11 +23,11 @@
 #define FLOW_LOG RTE_ETHDEV_LOG_LINE
 
 /* Mbuf dynamic field name for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_offs)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_offs, 19.11)
 int32_t rte_flow_dynf_metadata_offs = -1;
 
 /* Mbuf dynamic field flag bit number for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_mask)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_mask, 19.11)
 uint64_t rte_flow_dynf_metadata_mask;
 
 /**
Quoted 9 lines

Patch 4 and 5 address the bug for these global variables, by providing a single storage for both EXPERIMENTAL and DPDK_26 variable symbol versions.
This is achieved through symbol aliasing.
But this solution is limited only to executables compiled with clang.

clang and gcc have a different default behavior regarding relocations of global variables exposed by shared libraries.

Yeah... not even thinking about adding MSVC in the list...

Signature · 1 line
David Marchand
#11 lore raw
Quoted 26 lines · David Marchand

Hello Dariusz,

Quoted 2 lines · Dariusz Sosnowski

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957

It is expected that experimental symbols may disappear overnight, and this bug could also be closed as NOTABUG.

On the other hand, we do state in the doc that compatibility could be provided when stabilising an experimental API, so ok.. let's try.

Quoted 3 lines

but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.

Ouch... /me hides.

Quoted 7 lines

- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Introduce versioning macros for global variable symbols.
- Patch 5 - Version the function and variable symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c

Quoted 5 lines
Quoted 2 lines

Issue is still not fully fixed for stabilized global variables:
rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

Well, symbol versioning is not something for variables. Exposing global variables was a mistake from the start...

After fighting with this issue for some time,
I am coming to the similar conclusion :)

Quoted 6 lines

Those were exported for "performance" reasons as those are accessed via inline helpers (but I am not sure there were benchmarks showing the benefits).

I am for forbidding exports of global variables from now, unless some really good performance benchmark is provided (@techboard for info).

Sounds like a good proposal IMO.
Especially since, from a quick glance, almost all existing variables expose values not expected to change frequently at runtime. For example, like here, mbuf dynamic field offset.
These could be retrieved once and stored somewhere locally (Rx/Tx queue context for example).

Quoted 23 lines

Now, in practice for your issue, rather than reintroducing symbol aliases (technical solution that I dropped when refactoring the macros), I think we can do with some middle ground approach:
- leaving the inline helpers as "stable" (not __rte_experimental),
- restoring the EXPERIMENTAL version on the global variables, this will restore the location of those symbols from the previous ABI pov, and the checks won't catch this discrepancy anyway,
- during 26.11, drop the EXPERIMENTAL version on those variables,

In other words, stopping at your patch 3 of the series, then adding:

$ git diff
lib/ethdev/rte_flow.c +0 -0
index ec0fe08355..8bd21ccd31 100644
@@ -23,11 +23,11 @@
 #define FLOW_LOG RTE_ETHDEV_LOG_LINE
 
 /* Mbuf dynamic field name for metadata. */

lib/ethdev/rte_flow.c line 33

Quoted 10 lines
lib/ethdev/rte_flow.c +2 -2
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_offs)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_offs, 19.11)
 int32_t rte_flow_dynf_metadata_offs = -1;
 
 /* Mbuf dynamic field flag bit number for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_mask)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_mask, 19.11)
 uint64_t rte_flow_dynf_metadata_mask;
 
 /**

Thank you for the suggestion.
That looks good to me.
I'll prepare a v2.

Quoted 17 lines
Quoted 10 lines

Patch 4 and 5 address the bug for these global variables, by providing a single storage for both EXPERIMENTAL and DPDK_26 variable symbol versions.
This is achieved through symbol aliasing.
But this solution is limited only to executables compiled with clang.

clang and gcc have a different default behavior regarding relocations of global variables exposed by shared libraries.

Yeah... not even thinking about adding MSVC in the list...

Signature · 1 line
David Marchand
#12 lore raw

v2 cover add versioned symbols for recently stabilized APIs

In reply to Dariusz Sosnowski

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957
but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Version the rte_flow_dynf_metadata_register() function stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c
Restore EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

v2:
- Drop patches introducing versioning macros for symbol aliases and their usage (patch 4 and 5 from v1)
- EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, as discussed under v1.
- Change commit title prefix in patch (2) from "drivers" to "build".

v1: https://inbox.dpdk.org/dev/[email protected]/

Dariusz Sosnowski (4):
eal: fix macro for versioned experimental symbol
build: support function versioning for drivers net/mlx5: fix stabilized function versions
ethdev: fix promoted flow metadata symbols

 drivers/meson.build                  |  8 ++++++++
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 lib/eal/common/eal_export.h          |  2 +-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 13 ++++++++-----
 7 files changed, 49 insertions(+), 18 deletions(-)

--
2.47.3

#13 lore raw

PATCH v2 1/4 eal: fix macro for versioned experimental symbol

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Fixes e30e194c4d06 ("eal: rework function versioning macros")
---
 lib/eal/common/eal_export.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eal/common/eal_export.h +1 -1
index 888fd9f9ed..7971bf8d7a 100644
@@ -72,7 +72,7 @@ __rte_used type name ## _v ## ver args; \
 type name ## _v ## ver args
 
 #define RTE_VERSION_EXPERIMENTAL_SYMBOL(type, name, args) VERSIONING_WARN \
-__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
+__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL"); \
 __rte_used type name ## _exp args; \
 type name ## _exp args
 
Signature · 1 line
2.47.3
Reviewed-by on v2 1/4
#14 lore raw

Re: [PATCH v2 1/4] eal: fix macro for versioned experimental symbol

Quoted 16 lines · Dariusz Sosnowski

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Quoted 4 lines
Fixes e30e194c4d06 ("eal: rework function versioning macros")

Thank you.

Signature · 1 line
David Marchand
#15 lore raw

PATCH v2 2/4 build: support function versioning for drivers

In reply to Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/meson.build +8 -0
index 4d95604ecd..a63d93372a 100644
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by Windows.'.format(name))
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         dpdk_headers += headers
Signature · 1 line
2.47.3
#16 lore raw

Re: [PATCH v2 2/4] build: support function versioning for drivers

Quoted 26 lines · Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/meson.build +1 -0
index 4d95604ecd..a63d93372a 100644
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 

drivers/meson.build foreach subpath:subdirs · line 286

Quoted 10 lines
drivers/meson.build +7 -0
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by Windows.'.format(name))
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         dpdk_headers += headers

Don't we need to build with RTE_BUILD_SHARED_LIB for the shared library objects?

Signature · 1 line
David Marchand
#17 lore raw

RE: [PATCH v2 2/4] build: support function versioning for drivers

Quoted 51 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, June 25, 2026 9:39 AM
To: Dariusz Sosnowski <[email protected]>; Bruce Richardson <[email protected]>
Cc: [email protected]; Yu Jiang <[email protected]>
Subject: Re: [PATCH v2 2/4] build: support function versioning for drivers

External email: Use caution opening links or attachments

Quoted 23 lines · Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/meson.build index renamed from drivers/meson.build +0 -0

4d95604ecd..a63d93372a 100644

drivers/meson.build +1 -0
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []

drivers/meson.build foreach subpath:subdirs · line 278

Quoted 5 lines
drivers/meson.build +2 -0
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by

Windows.'.format(name))

Quoted 7 lines
drivers/meson.build +5 -0
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
Quoted 4 lines

drivers/meson.build foreach subpath:subdirs · line 286

Quoted 1 line
drivers/meson.build +0 -0
         dpdk_headers += headers

Don't we need to build with RTE_BUILD_SHARED_LIB for the shared library objects?

Correct, it is needed. I'll update in v3.

Best regards,
Dariusz Sosnowski

#18 lore raw

PATCH v2 3/4 net/mlx5: fix stabilized function versions

In reply to Dariusz Sosnowski

Offending patch stabilized the following function symbols:

- rte_pmd_mlx5_driver_event_cb_register
- rte_pmd_mlx5_driver_event_cb_unregister
- rte_pmd_mlx5_enable_steering
- rte_pmd_mlx5_disable_steering

These function symbols were introduced in 25.11.
Any application using these functions, linked against 25.11 version, would fail when used with 26.07 libraries, because only DPDK_26 versions of these symbols were exported.

This patch fixes that by adding proper function symbol versioning to these symbols.

Fixes e8cab133645f ("net/mlx5: promote some private API to stable")
---
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 3 files changed, 30 insertions(+), 12 deletions(-)
drivers/net/mlx5/meson.build +2 -0
index 82a7dfe782..0fa6322779 100644
@@ -2,6 +2,8 @@
 # Copyright 2018 6WIND S.A.
 # Copyright 2018 Mellanox Technologies, Ltd
 
+use_function_versioning = true
+
 if not (is_linux or is_windows)
     build = false
     reason = 'only supported on Linux and Windows'
drivers/net/mlx5/mlx5_driver_event.c +16 -6
index 89e49331c8..d0e22d6151 100644
@@ -236,9 +236,8 @@ notify_existing_devices(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
 		notify_existing_queues(port_id, cb, opaque);
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_register)
-int
-rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_register,
+		   (rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
 {
 	struct registered_cb *r;
 
@@ -264,9 +263,14 @@ rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, v
 	return 0;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_unregister)
-int
-rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_register,
+				(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
+{
+	return rte_pmd_mlx5_driver_event_cb_register(cb, opaque);
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_unregister,
+		   (rte_pmd_mlx5_driver_event_callback_t cb))
 {
 	struct registered_cb *r;
 	bool found = false;
@@ -289,6 +293,12 @@ rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_unregister,
+				(rte_pmd_mlx5_driver_event_callback_t cb))
+{
+	return rte_pmd_mlx5_driver_event_cb_unregister(cb);
+}
+
 RTE_FINI(rte_pmd_mlx5_driver_event_cb_cleanup) {
 	struct registered_cb *r;
 
drivers/net/mlx5/mlx5_flow.c +12 -6
index a95dd9dc94..4b984df892 100644
@@ -12506,9 +12506,7 @@ flow_disable_steering_run_on_related(struct rte_eth_dev *dev,
 	}
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_disable_steering)
-void
-rte_pmd_mlx5_disable_steering(void)
+RTE_DEFAULT_SYMBOL(26, void, rte_pmd_mlx5_disable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12532,9 +12530,12 @@ rte_pmd_mlx5_disable_steering(void)
 	mlx5_steering_disabled = true;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_enable_steering)
-int
-rte_pmd_mlx5_enable_steering(void)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(void, rte_pmd_mlx5_disable_steering, (void))
+{
+	rte_pmd_mlx5_disable_steering();
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_enable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12551,6 +12552,11 @@ rte_pmd_mlx5_enable_steering(void)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_enable_steering, (void))
+{
+	return rte_pmd_mlx5_enable_steering();
+}
+
 bool
 mlx5_vport_rx_metadata_passing_enabled(const struct mlx5_dev_ctx_shared *sh)
 {
Signature · 1 line
2.47.3
Acked-by on v2 3/4
#19 lore raw

Re: [PATCH v2 3/4] net/mlx5: fix stabilized function versions

Quoted 13 lines · Dariusz Sosnowski

Offending patch stabilized the following function symbols:

- rte_pmd_mlx5_driver_event_cb_register
- rte_pmd_mlx5_driver_event_cb_unregister
- rte_pmd_mlx5_enable_steering
- rte_pmd_mlx5_disable_steering

These function symbols were introduced in 25.11.
Any application using these functions, linked against 25.11 version, would fail when used with 26.07 libraries, because only DPDK_26 versions of these symbols were exported.

Quoted 6 lines

This patch fixes that by adding proper function symbol versioning to these symbols.

Fixes e8cab133645f ("net/mlx5: promote some private API to stable")
Signature · 1 line
David Marchand
#20 lore raw

PATCH v2 4/4 ethdev: fix promoted flow metadata symbols

In reply to Dariusz Sosnowski

Offending commit stabilized the following symbols
related to flow metadata:

- 1 function symbol:
- rte_flow_dynf_metadata_register
- 2 variable symbols:
- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask

Any application using experimental flow metadata symbols, which was linked dynamically against 25.11 version of ethdev library and using current version of ethdev library would fail to start on symbol lookup error:

/tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
symbol lookup error: /tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
undefined symbol: rte_flow_dynf_metadata_offs, version EXPERIMENTAL

This patch addresses that issue by restoring EXPERIMENTAL version on the global variables to keep ABI compatibility [1]. Related inline helpers and variable declarations are kept as stable (i.e., no __rte_experimental marker).
EXPERIMENTAL version will be removed from these global variables in 26.11 release cycle on next ABI version bump.

Standard function symbol versioning is also applied on rte_flow_dynf_metadata_register() function.

[1]: https://inbox.dpdk.org/dev/m7s3jl2566kibbapr2mfa2ic2opuc6b4ok2g67j3il5dgduzih@cz5wcdstb75n/

Bugzilla ID: 1957

Fixes 4ee2f5c1cedf ("ethdev: promote flow metadata API to stable")
---
 lib/ethdev/meson.build |  2 ++
 lib/ethdev/rte_flow.c  | 13 ++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
lib/ethdev/meson.build +2 -0
index 8ba6c708a2..63fd866af9 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+use_function_versioning = true
+
 sources = files(
         'ethdev_driver.c',
         'ethdev_private.c',
lib/ethdev/rte_flow.c +8 -5
index ec0fe08355..24eb5a95b0 100644
@@ -23,11 +23,11 @@
 #define FLOW_LOG RTE_ETHDEV_LOG_LINE
 
 /* Mbuf dynamic field name for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_offs)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_offs, 19.11)
 int32_t rte_flow_dynf_metadata_offs = -1;
 
 /* Mbuf dynamic field flag bit number for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_mask)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_mask, 19.11)
 uint64_t rte_flow_dynf_metadata_mask;
 
 /**
@@ -281,9 +281,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(JUMP_TO_TABLE_INDEX, sizeof(struct rte_flow_action_jump_to_table_index)),
 };
 
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_register)
-int
-rte_flow_dynf_metadata_register(void)
+RTE_DEFAULT_SYMBOL(26, int, rte_flow_dynf_metadata_register, (void))
 {
 	int offset;
 	int flag;
@@ -316,6 +314,11 @@ rte_flow_dynf_metadata_register(void)
 	return -rte_errno;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
+{
+	return rte_flow_dynf_metadata_register();
+}
+
 static inline void
 fts_enter(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.47.3
Acked-by on v2 4/4
#21 lore raw

Re: [PATCH v2 4/4] ethdev: fix promoted flow metadata symbols

Quoted 29 lines · Dariusz Sosnowski

Offending commit stabilized the following symbols
related to flow metadata:

- 1 function symbol:
- rte_flow_dynf_metadata_register
- 2 variable symbols:
- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask

Any application using experimental flow metadata symbols, which was linked dynamically against 25.11 version of ethdev library and using current version of ethdev library would fail to start on symbol lookup error:

/tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
symbol lookup error: /tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
undefined symbol: rte_flow_dynf_metadata_offs, version EXPERIMENTAL

This patch addresses that issue by restoring EXPERIMENTAL version on the global variables to keep ABI compatibility [1]. Related inline helpers and variable declarations are kept as stable (i.e., no __rte_experimental marker).
EXPERIMENTAL version will be removed from these global variables in 26.11 release cycle on next ABI version bump.

Standard function symbol versioning is also applied on rte_flow_dynf_metadata_register() function.

Quoted 7 lines

[1]: https://inbox.dpdk.org/dev/m7s3jl2566kibbapr2mfa2ic2opuc6b4ok2g67j3il5dgduzih@cz5wcdstb75n/

Bugzilla ID: 1957

Fixes 4ee2f5c1cedf ("ethdev: promote flow metadata API to stable")

Once this series is merged, could you send a patch against 26.11 dropping this compat and marking the variables as stable? I'll mark it as deferred in patchwork, this is just to have a reminder to clean this up.

Signature · 1 line
David Marchand
#22 lore raw

RE: [PATCH v2 4/4] ethdev: fix promoted flow metadata symbols

Quoted 57 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, June 25, 2026 9:45 AM
To: Dariusz Sosnowski <[email protected]>
Cc: Bruce Richardson <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; [email protected]; Yu Jiang <[email protected]>
Subject: Re: [PATCH v2 4/4] ethdev: fix promoted flow metadata symbols

External email: Use caution opening links or attachments

Quoted 34 lines · Dariusz Sosnowski

Offending commit stabilized the following symbols related to flow metadata:

- 1 function symbol:
- rte_flow_dynf_metadata_register
- 2 variable symbols:
- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask

Any application using experimental flow metadata symbols, which was linked dynamically against 25.11 version of ethdev library and using current version of ethdev library would fail to start on symbol lookup error:

/tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
symbol lookup error: /tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
undefined symbol: rte_flow_dynf_metadata_offs, version
EXPERIMENTAL

This patch addresses that issue by restoring EXPERIMENTAL version on the global variables to keep ABI compatibility [1]. Related inline helpers and variable declarations are kept as stable (i.e., no __rte_experimental marker).
EXPERIMENTAL version will be removed from these global variables in 26.11 release cycle on next ABI version bump.

Standard function symbol versioning is also applied on rte_flow_dynf_metadata_register() function.

[1]:
https://inbox.dpdk.org/dev/m7s3jl2566kibbapr2mfa2ic2opuc6b4ok2g67j3il5
dgduzih@cz5wcdstb75n/

Quoted 5 lines

Bugzilla ID: 1957

Fixes 4ee2f5c1cedf ("ethdev: promote flow metadata API to stable")
Quoted 6 lines

Once this series is merged, could you send a patch against 26.11 dropping this compat and marking the variables as stable?
I'll mark it as deferred in patchwork, this is just to have a reminder to clean this up.

Of course, I'll send it once merged.

Best regards,
Dariusz Sosnowski

Tested-by on the v2 series
#23 lore raw
In reply to Dariusz Sosnowski
Quoted 53 lines

-----Original Message-----
From: Dariusz Sosnowski <[email protected]>
Sent: Wednesday, June 24, 2026 9:14 PM
To: David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Thomas Monjalon <[email protected]>; Andrew Rybchenko <[email protected]>; Viacheslav Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Jiang, YuX <[email protected]>
Subject: [PATCH v2 0/4] add versioned symbols for recently stabilized APIs

Main goal of this patchset is to address
https://bugs.dpdk.org/show_bug.cgi?id=1957
but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in

https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a502
7
- Patch 4 - Version the rte_flow_dynf_metadata_register() function stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c
Restore EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

v2:
- Drop patches introducing versioning macros for symbol aliases and their usage (patch 4 and 5 from v1)
- EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, as discussed under v1.
- Change commit title prefix in patch (2) from "drivers" to "build".

v1: https://inbox.dpdk.org/dev/20260623113752.1100072-1-
[email protected]/

Dariusz Sosnowski (4):
eal: fix macro for versioned experimental symbol
build: support function versioning for drivers net/mlx5: fix stabilized function versions
ethdev: fix promoted flow metadata symbols

 drivers/meson.build                  |  8 ++++++++
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 lib/eal/common/eal_export.h          |  2 +-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 13 ++++++++-----
 7 files changed, 49 insertions(+), 18 deletions(-)
Quoted 2 lines

--
2.47.3

BRs
Yu Jiang

#24 lore raw

v3 cover add versioned symbols for recently stabilized APIs

In reply to Dariusz Sosnowski

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957
but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Version the rte_flow_dynf_metadata_register() function stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c
Restore EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

v3:
- Added rebuilding of drivers with -DRTE_BUILD_SHARED_LIB whenever function versioning is enabled.

v2:
- https://inbox.dpdk.org/dev/[email protected]/
- Drop patches introducing versioning macros for symbol aliases and their usage (patch 4 and 5 from v1)
- EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, as discussed under v1.
- Change commit title prefix in patch (2) from "drivers" to "build".

v1: https://inbox.dpdk.org/dev/[email protected]/

Dariusz Sosnowski (4):
eal: fix macro for versioned experimental symbol
build: support function versioning for drivers net/mlx5: fix stabilized function versions
ethdev: fix promoted flow metadata symbols

 drivers/meson.build                  | 21 ++++++++++++++++++++-
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 lib/eal/common/eal_export.h          |  2 +-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 13 ++++++++-----
 7 files changed, 61 insertions(+), 19 deletions(-)

--
2.47.3

#25 lore raw

PATCH v3 1/4 eal: fix macro for versioned experimental symbol

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Fixes e30e194c4d06 ("eal: rework function versioning macros")
---
 lib/eal/common/eal_export.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eal/common/eal_export.h +1 -1
index 888fd9f9ed..7971bf8d7a 100644
@@ -72,7 +72,7 @@ __rte_used type name ## _v ## ver args; \
 type name ## _v ## ver args
 
 #define RTE_VERSION_EXPERIMENTAL_SYMBOL(type, name, args) VERSIONING_WARN \
-__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
+__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL"); \
 __rte_used type name ## _exp args; \
 type name ## _exp args
 
Signature · 1 line
2.47.3
#26 lore raw

PATCH v3 2/4 build: support function versioning for drivers

In reply to Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/meson.build +20 -1
index 4d95604ecd..8f3ab490ee 100644
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by Windows.'.format(name))
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         dpdk_headers += headers
@@ -363,7 +371,18 @@ foreach subpath:subdirs
                     depends: [version_map])
         endif
 
-        shared_lib = shared_library(lib_name, sources_pmd_info,
+        if not use_function_versioning or is_windows
+            # Use pre-built objects and pmdinfo sources to build shared library.
+            shared_sources = sources_pmd_info
+        else
+            # For compat we need to rebuild with RTE_BUILD_SHARED_LIB defined.
+            # Use original sources and pmdinfo sources.
+            cflags += '-DRTE_BUILD_SHARED_LIB'
+            shared_sources = sources + sources_pmd_info
+            objs = []
+        endif
+
+        shared_lib = shared_library(lib_name, shared_sources,
                 objects: objs,
                 include_directories: includes,
                 dependencies: shared_deps,
Signature · 1 line
2.47.3
#27 lore raw

Re: [PATCH v3 2/4] build: support function versioning for drivers

Quoted 46 lines · Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/meson.build +13 -1
index 4d95604ecd..8f3ab490ee 100644
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by Windows.'.format(name))
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         dpdk_headers += headers
@@ -363,7 +371,18 @@ foreach subpath:subdirs
                     depends: [version_map])
         endif
 
-        shared_lib = shared_library(lib_name, sources_pmd_info,
+        if not use_function_versioning or is_windows
+            # Use pre-built objects and pmdinfo sources to build shared library.
+            shared_sources = sources_pmd_info
+        else
+            # For compat we need to rebuild with RTE_BUILD_SHARED_LIB defined.

drivers/meson.build foreach subpath:subdirs · line 388

Quoted 10 lines
drivers/meson.build +7 -0
+            # Use original sources and pmdinfo sources.
+            cflags += '-DRTE_BUILD_SHARED_LIB'
+            shared_sources = sources + sources_pmd_info
+            objs = []
+        endif
+
+        shared_lib = shared_library(lib_name, shared_sources,
                 objects: objs,
                 include_directories: includes,
                 dependencies: shared_deps,

Older meson version don't like this form:

drivers/meson.build:381:12: ERROR: Invalid use of addition: can only concatenate list (not "CustomTargetHolder") to list

It seems to work with something like:

drivers/meson.build +0 -0
index 8f3ab490ee..79c215a7c8 100644
@@ -373,12 +373,12 @@ foreach subpath:subdirs
 
         if not use_function_versioning or is_windows
             # Use pre-built objects and pmdinfo sources to build

shared library.
- shared_sources = sources_pmd_info
+ shared_sources = [sources_pmd_info]
else
# For compat we need to rebuild with RTE_BUILD_SHARED_LIB defined. # Use original sources and pmdinfo sources.
cflags += '-DRTE_BUILD_SHARED_LIB'
- shared_sources = sources + sources_pmd_info
+ shared_sources = sources + [sources_pmd_info]

             objs = []
         endif
Signature · 1 line
David Marchand
#28 lore raw

RE: [PATCH v3 2/4] build: support function versioning for drivers

Quoted 89 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, June 25, 2026 4:46 PM
To: Dariusz Sosnowski <[email protected]>
Cc: Bruce Richardson <[email protected]>; [email protected]; Yu Jiang <[email protected]>
Subject: Re: [PATCH v3 2/4] build: support function versioning for drivers

External email: Use caution opening links or attachments

Quoted 23 lines · Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/meson.build index renamed from drivers/meson.build +0 -0

4d95604ecd..8f3ab490ee 100644

drivers/meson.build +1 -0
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []

drivers/meson.build foreach subpath:subdirs · line 278

Quoted 5 lines
drivers/meson.build +2 -0
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by

Windows.'.format(name))

Quoted 9 lines
drivers/meson.build +5 -0
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         dpdk_headers += headers

drivers/meson.build foreach subpath:subdirs · line 378

Quoted 9 lines
drivers/meson.build +5 -1
@@ -363,7 +371,18 @@ foreach subpath:subdirs
                     depends: [version_map])
         endif
 
-        shared_lib = shared_library(lib_name, sources_pmd_info,
+        if not use_function_versioning or is_windows
+            # Use pre-built objects and pmdinfo sources to build shared library.
+            shared_sources = sources_pmd_info
+        else
+            # For compat we need to rebuild with RTE_BUILD_SHARED_LIB

defined.

drivers/meson.build foreach subpath:subdirs · line 388

Quoted 10 lines
drivers/meson.build +7 -0
+            # Use original sources and pmdinfo sources.
+            cflags += '-DRTE_BUILD_SHARED_LIB'
+            shared_sources = sources + sources_pmd_info
+            objs = []
+        endif
+
+        shared_lib = shared_library(lib_name, shared_sources,
                 objects: objs,
                 include_directories: includes,
                 dependencies: shared_deps,

Older meson version don't like this form:

drivers/meson.build:381:12: ERROR: Invalid use of addition: can only concatenate list (not "CustomTargetHolder") to list

It seems to work with something like:

drivers/meson.build index renamed from drivers/meson.build +0 -0

8f3ab490ee..79c215a7c8 100644

drivers/meson.build +0 -0
@@ -373,12 +373,12 @@ foreach subpath:subdirs
 
         if not use_function_versioning or is_windows
             # Use pre-built objects and pmdinfo sources to build shared library.

drivers/meson.build foreach subpath:subdirs · line 383

Quoted 10 lines
drivers/meson.build +2 -2
-            shared_sources = sources_pmd_info
+            shared_sources = [sources_pmd_info]
         else
             # For compat we need to rebuild with RTE_BUILD_SHARED_LIB defined.
             # Use original sources and pmdinfo sources.
             cflags += '-DRTE_BUILD_SHARED_LIB'
-            shared_sources = sources + sources_pmd_info
+            shared_sources = sources + [sources_pmd_info]
             objs = []
         endif

Thank you for review.
Fixed in v4.

#29 lore raw

PATCH v3 3/4 net/mlx5: fix stabilized function versions

In reply to Dariusz Sosnowski

Offending patch stabilized the following function symbols:

- rte_pmd_mlx5_driver_event_cb_register
- rte_pmd_mlx5_driver_event_cb_unregister
- rte_pmd_mlx5_enable_steering
- rte_pmd_mlx5_disable_steering

These function symbols were introduced in 25.11.
Any application using these functions, linked against 25.11 version, would fail when used with 26.07 libraries, because only DPDK_26 versions of these symbols were exported.

This patch fixes that by adding proper function symbol versioning to these symbols.

Fixes e8cab133645f ("net/mlx5: promote some private API to stable")
---
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 3 files changed, 30 insertions(+), 12 deletions(-)
drivers/net/mlx5/meson.build +2 -0
index 82a7dfe782..0fa6322779 100644
@@ -2,6 +2,8 @@
 # Copyright 2018 6WIND S.A.
 # Copyright 2018 Mellanox Technologies, Ltd
 
+use_function_versioning = true
+
 if not (is_linux or is_windows)
     build = false
     reason = 'only supported on Linux and Windows'
drivers/net/mlx5/mlx5_driver_event.c +16 -6
index 89e49331c8..d0e22d6151 100644
@@ -236,9 +236,8 @@ notify_existing_devices(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
 		notify_existing_queues(port_id, cb, opaque);
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_register)
-int
-rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_register,
+		   (rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
 {
 	struct registered_cb *r;
 
@@ -264,9 +263,14 @@ rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, v
 	return 0;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_unregister)
-int
-rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_register,
+				(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
+{
+	return rte_pmd_mlx5_driver_event_cb_register(cb, opaque);
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_unregister,
+		   (rte_pmd_mlx5_driver_event_callback_t cb))
 {
 	struct registered_cb *r;
 	bool found = false;
@@ -289,6 +293,12 @@ rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_unregister,
+				(rte_pmd_mlx5_driver_event_callback_t cb))
+{
+	return rte_pmd_mlx5_driver_event_cb_unregister(cb);
+}
+
 RTE_FINI(rte_pmd_mlx5_driver_event_cb_cleanup) {
 	struct registered_cb *r;
 
drivers/net/mlx5/mlx5_flow.c +12 -6
index a95dd9dc94..4b984df892 100644
@@ -12506,9 +12506,7 @@ flow_disable_steering_run_on_related(struct rte_eth_dev *dev,
 	}
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_disable_steering)
-void
-rte_pmd_mlx5_disable_steering(void)
+RTE_DEFAULT_SYMBOL(26, void, rte_pmd_mlx5_disable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12532,9 +12530,12 @@ rte_pmd_mlx5_disable_steering(void)
 	mlx5_steering_disabled = true;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_enable_steering)
-int
-rte_pmd_mlx5_enable_steering(void)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(void, rte_pmd_mlx5_disable_steering, (void))
+{
+	rte_pmd_mlx5_disable_steering();
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_enable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12551,6 +12552,11 @@ rte_pmd_mlx5_enable_steering(void)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_enable_steering, (void))
+{
+	return rte_pmd_mlx5_enable_steering();
+}
+
 bool
 mlx5_vport_rx_metadata_passing_enabled(const struct mlx5_dev_ctx_shared *sh)
 {
Signature · 1 line
2.47.3
#30 lore raw

PATCH v3 4/4 ethdev: fix promoted flow metadata symbols

In reply to Dariusz Sosnowski

Offending commit stabilized the following symbols
related to flow metadata:

- 1 function symbol:
- rte_flow_dynf_metadata_register
- 2 variable symbols:
- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask

Any application using experimental flow metadata symbols, which was linked dynamically against 25.11 version of ethdev library and using current version of ethdev library would fail to start on symbol lookup error:

/tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
symbol lookup error: /tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
undefined symbol: rte_flow_dynf_metadata_offs, version EXPERIMENTAL

This patch addresses that issue by restoring EXPERIMENTAL version on the global variables to keep ABI compatibility [1]. Related inline helpers and variable declarations are kept as stable (i.e., no __rte_experimental marker).
EXPERIMENTAL version will be removed from these global variables in 26.11 release cycle on next ABI version bump.

Standard function symbol versioning is also applied on rte_flow_dynf_metadata_register() function.

[1]: https://inbox.dpdk.org/dev/m7s3jl2566kibbapr2mfa2ic2opuc6b4ok2g67j3il5dgduzih@cz5wcdstb75n/

Bugzilla ID: 1957

Fixes 4ee2f5c1cedf ("ethdev: promote flow metadata API to stable")
---
 lib/ethdev/meson.build |  2 ++
 lib/ethdev/rte_flow.c  | 13 ++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
lib/ethdev/meson.build +2 -0
index 8ba6c708a2..63fd866af9 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+use_function_versioning = true
+
 sources = files(
         'ethdev_driver.c',
         'ethdev_private.c',
lib/ethdev/rte_flow.c +8 -5
index ec0fe08355..24eb5a95b0 100644
@@ -23,11 +23,11 @@
 #define FLOW_LOG RTE_ETHDEV_LOG_LINE
 
 /* Mbuf dynamic field name for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_offs)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_offs, 19.11)
 int32_t rte_flow_dynf_metadata_offs = -1;
 
 /* Mbuf dynamic field flag bit number for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_mask)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_mask, 19.11)
 uint64_t rte_flow_dynf_metadata_mask;
 
 /**
@@ -281,9 +281,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(JUMP_TO_TABLE_INDEX, sizeof(struct rte_flow_action_jump_to_table_index)),
 };
 
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_register)
-int
-rte_flow_dynf_metadata_register(void)
+RTE_DEFAULT_SYMBOL(26, int, rte_flow_dynf_metadata_register, (void))
 {
 	int offset;
 	int flag;
@@ -316,6 +314,11 @@ rte_flow_dynf_metadata_register(void)
 	return -rte_errno;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
+{
+	return rte_flow_dynf_metadata_register();
+}
+
 static inline void
 fts_enter(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.47.3
#31 lore raw

v4 cover add versioned symbols for recently stabilized APIs

In reply to Dariusz Sosnowski

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957
but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Version the rte_flow_dynf_metadata_register() function stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c
Restore EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

v4:
- Fixed build with older meson versions.

v3:
- https://inbox.dpdk.org/dev/[email protected]/
- Added rebuilding of drivers with -DRTE_BUILD_SHARED_LIB whenever function versioning is enabled.

v2:
- https://inbox.dpdk.org/dev/[email protected]/
- Drop patches introducing versioning macros for symbol aliases and their usage (patch 4 and 5 from v1)
- EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, as discussed under v1.
- Change commit title prefix in patch (2) from "drivers" to "build".

v1: https://inbox.dpdk.org/dev/[email protected]/

Dariusz Sosnowski (4):
eal: fix macro for versioned experimental symbol
build: support function versioning for drivers net/mlx5: fix stabilized function versions
ethdev: fix promoted flow metadata symbols

 drivers/meson.build                  | 21 ++++++++++++++++++++-
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 lib/eal/common/eal_export.h          |  2 +-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 13 ++++++++-----
 7 files changed, 61 insertions(+), 19 deletions(-)

--
2.47.3

#32 lore raw

PATCH v4 1/4 eal: fix macro for versioned experimental symbol

Add a missing semicolon after __asm__ block in RTE_VERSION_EXPERIMENTAL_SYMBOL macro.
It's lack triggers the following compilation error with clang:

    ../lib/ethdev/rte_flow.c:320:1: error: expected ';' after top-level asm block
      320 | RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
          | ^
    ../lib/eal/common/eal_export.h:75:74: note: expanded from macro 'RTE_VERSION_EXPERIMENTAL_SYMBOL'
       75 | __asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
          |                                                                          ^
    ../lib/eal/include/rte_common.h:237:20: note: expanded from macro '\
    __rte_used'
      237 | #define __rte_used __attribute__((used))
          |                    ^
Fixes e30e194c4d06 ("eal: rework function versioning macros")
---
 lib/eal/common/eal_export.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eal/common/eal_export.h +1 -1
index 888fd9f9ed..7971bf8d7a 100644
@@ -72,7 +72,7 @@ __rte_used type name ## _v ## ver args; \
 type name ## _v ## ver args
 
 #define RTE_VERSION_EXPERIMENTAL_SYMBOL(type, name, args) VERSIONING_WARN \
-__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL") \
+__asm__(".symver " RTE_STR(name) "_exp, " RTE_STR(name) "@EXPERIMENTAL"); \
 __rte_used type name ## _exp args; \
 type name ## _exp args
 
Signature · 1 line
2.47.3
#33 lore raw

PATCH v4 2/4 build: support function versioning for drivers

In reply to Dariusz Sosnowski

Add support for enabling function versioning (through use_function_versioning meson variable) for drivers, similar to libraries.

---
 drivers/meson.build | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/meson.build +20 -1
index 4d95604ecd..79c215a7c8 100644
@@ -171,6 +171,7 @@ foreach subpath:subdirs
         pkgconfig_extra_libs = []
         testpmd_sources = []
         require_iova_in_mbuf = true
+        use_function_versioning = false
         # for handling base code files which may need extra cflags
         base_sources = []
         base_cflags = []
@@ -273,6 +274,13 @@ foreach subpath:subdirs
         endif
         dpdk_conf.set(lib_name.to_upper(), 1)
 
+        if developer_mode and is_windows and use_function_versioning
+            message('@0@: Function versioning is not supported by Windows.'.format(name))
+        endif
+        if use_function_versioning
+            cflags += '-DRTE_USE_FUNCTION_VERSIONING'
+        endif
+
         dpdk_extra_ldflags += pkgconfig_extra_libs
 
         dpdk_headers += headers
@@ -363,7 +371,18 @@ foreach subpath:subdirs
                     depends: [version_map])
         endif
 
-        shared_lib = shared_library(lib_name, sources_pmd_info,
+        if not use_function_versioning or is_windows
+            # Use pre-built objects and pmdinfo sources to build shared library.
+            shared_sources = [sources_pmd_info]
+        else
+            # For compat we need to rebuild with RTE_BUILD_SHARED_LIB defined.
+            # Use original sources and pmdinfo sources.
+            cflags += '-DRTE_BUILD_SHARED_LIB'
+            shared_sources = sources + [sources_pmd_info]
+            objs = []
+        endif
+
+        shared_lib = shared_library(lib_name, shared_sources,
                 objects: objs,
                 include_directories: includes,
                 dependencies: shared_deps,
Signature · 1 line
2.47.3
#34 lore raw

PATCH v4 3/4 net/mlx5: fix stabilized function versions

In reply to Dariusz Sosnowski

Offending patch stabilized the following function symbols:

- rte_pmd_mlx5_driver_event_cb_register
- rte_pmd_mlx5_driver_event_cb_unregister
- rte_pmd_mlx5_enable_steering
- rte_pmd_mlx5_disable_steering

These function symbols were introduced in 25.11.
Any application using these functions, linked against 25.11 version, would fail when used with 26.07 libraries, because only DPDK_26 versions of these symbols were exported.

This patch fixes that by adding proper function symbol versioning to these symbols.

Fixes e8cab133645f ("net/mlx5: promote some private API to stable")
---
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 3 files changed, 30 insertions(+), 12 deletions(-)
drivers/net/mlx5/meson.build +2 -0
index 82a7dfe782..0fa6322779 100644
@@ -2,6 +2,8 @@
 # Copyright 2018 6WIND S.A.
 # Copyright 2018 Mellanox Technologies, Ltd
 
+use_function_versioning = true
+
 if not (is_linux or is_windows)
     build = false
     reason = 'only supported on Linux and Windows'
drivers/net/mlx5/mlx5_driver_event.c +16 -6
index 89e49331c8..d0e22d6151 100644
@@ -236,9 +236,8 @@ notify_existing_devices(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
 		notify_existing_queues(port_id, cb, opaque);
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_register)
-int
-rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_register,
+		   (rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
 {
 	struct registered_cb *r;
 
@@ -264,9 +263,14 @@ rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, v
 	return 0;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_unregister)
-int
-rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_register,
+				(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque))
+{
+	return rte_pmd_mlx5_driver_event_cb_register(cb, opaque);
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_driver_event_cb_unregister,
+		   (rte_pmd_mlx5_driver_event_callback_t cb))
 {
 	struct registered_cb *r;
 	bool found = false;
@@ -289,6 +293,12 @@ rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_driver_event_cb_unregister,
+				(rte_pmd_mlx5_driver_event_callback_t cb))
+{
+	return rte_pmd_mlx5_driver_event_cb_unregister(cb);
+}
+
 RTE_FINI(rte_pmd_mlx5_driver_event_cb_cleanup) {
 	struct registered_cb *r;
 
drivers/net/mlx5/mlx5_flow.c +12 -6
index a95dd9dc94..4b984df892 100644
@@ -12506,9 +12506,7 @@ flow_disable_steering_run_on_related(struct rte_eth_dev *dev,
 	}
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_disable_steering)
-void
-rte_pmd_mlx5_disable_steering(void)
+RTE_DEFAULT_SYMBOL(26, void, rte_pmd_mlx5_disable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12532,9 +12530,12 @@ rte_pmd_mlx5_disable_steering(void)
 	mlx5_steering_disabled = true;
 }
 
-RTE_EXPORT_SYMBOL(rte_pmd_mlx5_enable_steering)
-int
-rte_pmd_mlx5_enable_steering(void)
+RTE_VERSION_EXPERIMENTAL_SYMBOL(void, rte_pmd_mlx5_disable_steering, (void))
+{
+	rte_pmd_mlx5_disable_steering();
+}
+
+RTE_DEFAULT_SYMBOL(26, int, rte_pmd_mlx5_enable_steering, (void))
 {
 	uint16_t port_id;
 
@@ -12551,6 +12552,11 @@ rte_pmd_mlx5_enable_steering(void)
 	return 0;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_pmd_mlx5_enable_steering, (void))
+{
+	return rte_pmd_mlx5_enable_steering();
+}
+
 bool
 mlx5_vport_rx_metadata_passing_enabled(const struct mlx5_dev_ctx_shared *sh)
 {
Signature · 1 line
2.47.3
#35 lore raw

PATCH v4 4/4 ethdev: fix promoted flow metadata symbols

In reply to Dariusz Sosnowski

Offending commit stabilized the following symbols
related to flow metadata:

- 1 function symbol:
- rte_flow_dynf_metadata_register
- 2 variable symbols:
- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask

Any application using experimental flow metadata symbols, which was linked dynamically against 25.11 version of ethdev library and using current version of ethdev library would fail to start on symbol lookup error:

/tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
symbol lookup error: /tmp/dpdk-25.11/usr/local/bin/dpdk-testpmd:
undefined symbol: rte_flow_dynf_metadata_offs, version EXPERIMENTAL

This patch addresses that issue by restoring EXPERIMENTAL version on the global variables to keep ABI compatibility [1]. Related inline helpers and variable declarations are kept as stable (i.e., no __rte_experimental marker).
EXPERIMENTAL version will be removed from these global variables in 26.11 release cycle on next ABI version bump.

Standard function symbol versioning is also applied on rte_flow_dynf_metadata_register() function.

[1]: https://inbox.dpdk.org/dev/m7s3jl2566kibbapr2mfa2ic2opuc6b4ok2g67j3il5dgduzih@cz5wcdstb75n/

Bugzilla ID: 1957

Fixes 4ee2f5c1cedf ("ethdev: promote flow metadata API to stable")
---
 lib/ethdev/meson.build |  2 ++
 lib/ethdev/rte_flow.c  | 13 ++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
lib/ethdev/meson.build +2 -0
index 8ba6c708a2..63fd866af9 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+use_function_versioning = true
+
 sources = files(
         'ethdev_driver.c',
         'ethdev_private.c',
lib/ethdev/rte_flow.c +8 -5
index ec0fe08355..24eb5a95b0 100644
@@ -23,11 +23,11 @@
 #define FLOW_LOG RTE_ETHDEV_LOG_LINE
 
 /* Mbuf dynamic field name for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_offs)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_offs, 19.11)
 int32_t rte_flow_dynf_metadata_offs = -1;
 
 /* Mbuf dynamic field flag bit number for metadata. */
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_mask)
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_mask, 19.11)
 uint64_t rte_flow_dynf_metadata_mask;
 
 /**
@@ -281,9 +281,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(JUMP_TO_TABLE_INDEX, sizeof(struct rte_flow_action_jump_to_table_index)),
 };
 
-RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_register)
-int
-rte_flow_dynf_metadata_register(void)
+RTE_DEFAULT_SYMBOL(26, int, rte_flow_dynf_metadata_register, (void))
 {
 	int offset;
 	int flag;
@@ -316,6 +314,11 @@ rte_flow_dynf_metadata_register(void)
 	return -rte_errno;
 }
 
+RTE_VERSION_EXPERIMENTAL_SYMBOL(int, rte_flow_dynf_metadata_register, (void))
+{
+	return rte_flow_dynf_metadata_register();
+}
+
 static inline void
 fts_enter(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.47.3
#36 lore raw
In reply to Dariusz Sosnowski

Hello Dariusz,

Quoted 38 lines · Dariusz Sosnowski

Main goal of this patchset is to address https://bugs.dpdk.org/show_bug.cgi?id=1957
but it also handles other recently stabilized symbols and has some minor fixes:

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in
https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43b68a5027
- Patch 4 - Version the rte_flow_dynf_metadata_register() function stabilized in
https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f4004ba5c
Restore EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

v4:
- Fixed build with older meson versions.

v3:
- https://inbox.dpdk.org/dev/[email protected]/
- Added rebuilding of drivers with -DRTE_BUILD_SHARED_LIB whenever function versioning is enabled.

v2:
- https://inbox.dpdk.org/dev/[email protected]/
- Drop patches introducing versioning macros for symbol aliases and their usage (patch 4 and 5 from v1)
- EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, as discussed under v1.
- Change commit title prefix in patch (2) from "drivers" to "build".

v1: https://inbox.dpdk.org/dev/[email protected]/

Dariusz Sosnowski (4):
eal: fix macro for versioned experimental symbol
build: support function versioning for drivers net/mlx5: fix stabilized function versions
ethdev: fix promoted flow metadata symbols

Quoted 8 lines
 drivers/meson.build                  | 21 ++++++++++++++++++++-
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 lib/eal/common/eal_export.h          |  2 +-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 13 ++++++++-----
 7 files changed, 61 insertions(+), 19 deletions(-)

LGTM.
Series applied, thanks Dariusz.

Please send the patch to drop this compat in 26.11.

Signature · 1 line
David Marchand
#37 lore raw
Quoted 78 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Sunday, June 28, 2026 3:57 PM
To: Dariusz Sosnowski <[email protected]>
Cc: Bruce Richardson <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Andrew Rybchenko <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; [email protected]; Yu Jiang <[email protected]>
Subject: Re: [PATCH v4 0/4] add versioned symbols for recently stabilized APIs

External email: Use caution opening links or attachments

Hello Dariusz,

Quoted 2 lines · Dariusz Sosnowski

Main goal of this patchset is to address

https://bugs.dpdk.org/show_bug.cgi?id=1957

Quoted 1 line

but it also handles other recently stabilized symbols and has some minor

fixes:

Quoted 5 lines

- Patch 1 - Fix RTE_VERSION_EXPERIMENTAL_SYMBOL macro on clang.
- Patch 2 - Allow function versioning inside drivers.
- Patch 3 - Version the function symbols stabilized in

https://git.dpdk.org/dpdk/commit/?id=e8cab133645f5466ef75e511629add43
b68a5027

Quoted 1 line

- Patch 4 - Version the rte_flow_dynf_metadata_register() function stabilized

in

Quoted 1 line

https://git.dpdk.org/dpdk/commit/?id=4ee2f5c1cedf9ee7f39afa667f71b07f40
04ba5c

Quoted 8 lines

Restore EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask.

v4:
- Fixed build with older meson versions.

v3:
- https://inbox.dpdk.org/dev/20260625133311.1299705-1-

[email protected]/

Quoted 5 lines

- Added rebuilding of drivers with -DRTE_BUILD_SHARED_LIB whenever function versioning is enabled.

v2:
- https://inbox.dpdk.org/dev/20260624131337.1127323-1-

[email protected]/

Quoted 8 lines

- Drop patches introducing versioning macros for symbol aliases and their usage (patch 4 and 5 from v1)
- EXPERIMENTAL version on global variable symbols rte_flow_dynf_metadata_offs and rte_flow_dynf_metadata_mask, as discussed under v1.
- Change commit title prefix in patch (2) from "drivers" to "build".

v1: https://inbox.dpdk.org/dev/20260623113752.1100072-1-

[email protected]/

Quoted 7 lines

Dariusz Sosnowski (4):
eal: fix macro for versioned experimental symbol
build: support function versioning for drivers net/mlx5: fix stabilized function versions
ethdev: fix promoted flow metadata symbols

Quoted 8 lines
 drivers/meson.build                  | 21 ++++++++++++++++++++-
 drivers/net/mlx5/meson.build         |  2 ++
 drivers/net/mlx5/mlx5_driver_event.c | 22 ++++++++++++++++------
 drivers/net/mlx5/mlx5_flow.c         | 18 ++++++++++++------
 lib/eal/common/eal_export.h          |  2 +-
 lib/ethdev/meson.build               |  2 ++
 lib/ethdev/rte_flow.c                | 13 ++++++++-----
 7 files changed, 61 insertions(+), 19 deletions(-)
Quoted 4 lines

LGTM.
Series applied, thanks Dariusz.

Please send the patch to drop this compat in 26.11.

Patches for dropping these compatibility aliases are on the mailing list:

- https://patches.dpdk.org/project/dpdk/patch/[email protected]/
- https://patches.dpdk.org/project/dpdk/patch/[email protected]/

Best regards,
Dariusz Sosnowski

#38 lore raw
Quoted 9 lines · Dariusz Sosnowski
Quoted 4 lines

LGTM.
Series applied, thanks Dariusz.

Please send the patch to drop this compat in 26.11.

Patches for dropping these compatibility aliases are on the mailing list:

- https://patches.dpdk.org/project/dpdk/patch/[email protected]/
- https://patches.dpdk.org/project/dpdk/patch/[email protected]/

Thank you.
Those lgtm, I delegated them to me, and marked as deferred.

I'll take them with rc0.

Signature · 1 line
David Marchand