On Thu, Mar 13, 2025 at 6:31 PM Bruce Richardson <bruce.richard...@intel.com> wrote: > > On Tue, Mar 11, 2025 at 10:56:04AM +0100, David Marchand wrote: > > Annotate symbols with newly introduced export macros. > > > > For code not compiled by lib/meson.build or drivers/meson.build (like AVX > > separate libraries, or sources in /base/ drivers), the exported symbols > > are added in some file listed in the sources so they get caught by > > lib/meson.build or drivers/meson.build. > > > > Signed-off-by: David Marchand <david.march...@redhat.com> > > --- > > Just checking: for the AVX2 and similar instruction-set-specific functions, > we don't get errors if those are not present in the actual link phase, e.g. > when building on non-x86 platforms? We don't need to put an #ifdef around > the exports?
We are not there yet, but it is likely MSVC linker will complain, indeed. #ifdef around the exports won't work, we would need a precompiler pass (and exclude rte_exports.h inclusion). Another option would be to provide stubs for those symbols when the additional AVX512 (for example) libraries are not compiled. But I think the simpler is to let a driver/library provide a set of sources to parse for exports... maybe via an extra variable? WDYT? Something like: diff --git a/drivers/meson.build b/drivers/meson.build index 2b0fcd4ef0..6828067fd1 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -269,7 +268,7 @@ foreach subpath:subdirs endif version_map = custom_target(lib_name + '_map', command: [gen_version_map, link_mode, abi_version_file, '@OUTPUT@', '@INPUT@'], - input: sources, + input: sources + exported_symbol_sources, output: '_'.join(class, name, 'exports.map')) lk_deps = [version_map] diff --git a/drivers/net/intel/idpf/idpf_common_rxtx.c b/drivers/net/intel/idpf/idpf_common_rxtx.c index 5764bd0e9b..b468e1cd57 100644 --- a/drivers/net/intel/idpf/idpf_common_rxtx.c +++ b/drivers/net/intel/idpf/idpf_common_rxtx.c @@ -1647,12 +1647,3 @@ idpf_qc_splitq_rx_vec_setup(struct idpf_rx_queue *rxq) rxq->bufq2->ops = &def_rx_ops_vec; return idpf_rxq_vec_setup_default(rxq->bufq2); } - -/* Export all AVX* symbols */ -RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_recv_pkts_avx2) -RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_xmit_pkts_avx2) -RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_recv_pkts_avx512) -RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_splitq_recv_pkts_avx512) -RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_xmit_pkts_avx512) -RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_splitq_xmit_pkts_avx512) -RTE_EXPORT_INTERNAL_SYMBOL(idpf_qc_tx_vec_avx512_setup) diff --git a/drivers/net/intel/idpf/idpf_common_rxtx_avx2.c b/drivers/net/intel/idpf/idpf_common_rxtx_avx2.c index 43a95466ae..3ff70955c8 100644 --- a/drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +++ b/drivers/net/intel/idpf/idpf_common_rxtx_avx2.c @@ -473,6 +473,7 @@ _idpf_singleq_recv_raw_pkts_vec_avx2(struct idpf_rx_queue *rxq, struct rte_mbuf * Notice: * - nb_pkts < IDPF_DESCS_PER_LOOP, just return no packet */ +RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_recv_pkts_avx2) uint16_t idpf_dp_singleq_recv_pkts_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { @@ -682,6 +683,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts return nb_pkts; } +RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_xmit_pkts_avx2) uint16_t idpf_dp_singleq_xmit_pkts_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) diff --git a/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c b/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c index b630d1fcd9..e8bf8149e1 100644 --- a/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +++ b/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c @@ -530,6 +530,7 @@ _idpf_singleq_recv_raw_pkts_avx512(struct idpf_rx_queue *rxq, * Notice: * - nb_pkts < IDPF_DESCS_PER_LOOP, just return no packet */ +RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_recv_pkts_avx512) uint16_t idpf_dp_singleq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) @@ -987,6 +988,7 @@ _idpf_splitq_recv_raw_pkts_avx512(struct idpf_rx_queue *rxq, } /* only bufq2 can receive pkts */ +RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_splitq_recv_pkts_avx512) uint16_t idpf_dp_splitq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) @@ -1281,6 +1283,7 @@ idpf_singleq_xmit_pkts_vec_avx512_cmn(void *tx_queue, struct rte_mbuf **tx_pkts, return nb_tx; } +RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_xmit_pkts_avx512) uint16_t idpf_dp_singleq_xmit_pkts_avx512(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) @@ -1584,6 +1587,7 @@ idpf_splitq_xmit_pkts_vec_avx512_cmn(void *tx_queue, struct rte_mbuf **tx_pkts, return nb_tx; } +RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_splitq_xmit_pkts_avx512) uint16_t idpf_dp_splitq_xmit_pkts_avx512(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) @@ -1619,6 +1623,7 @@ static const struct idpf_txq_ops avx512_tx_vec_ops = { .release_mbufs = idpf_tx_release_mbufs_avx512, }; +RTE_EXPORT_INTERNAL_SYMBOL(idpf_qc_tx_vec_avx512_setup) int __rte_cold idpf_qc_tx_vec_avx512_setup(struct idpf_tx_queue *txq) { diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build index 4b272d02b1..47f6f8736e 100644 --- a/drivers/net/intel/idpf/meson.build +++ b/drivers/net/intel/idpf/meson.build @@ -25,6 +25,7 @@ if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1 include_directories: includes, c_args: [cflags, cc_avx2_flags]) objs += idpf_avx2_lib.extract_objects('idpf_common_rxtx_avx2.c') + exported_symbol_sources += files('idpf_common_rxtx_avx2.c') if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] @@ -41,6 +42,7 @@ if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1 include_directories: includes, c_args: avx512_args) objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c') + exported_symbol_sources += files('idpf_common_rxtx_avx512.c') endif endif -- David Marchand