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")

Reported-by: Yu Jiang <[email protected]>
Signed-off-by: Dariusz Sosnowski <[email protected]>
---
 lib/ethdev/meson.build |  2 ++
 lib/ethdev/rte_flow.c  | 33 ++++++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
index 8ba6c708a2..63fd866af9 100644
--- a/lib/ethdev/meson.build
+++ b/lib/ethdev/meson.build
@@ -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',
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index ec0fe08355..a8c01ffe8a 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -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)
 {
-- 
2.47.3

Reply via email to