Rather than use weak symbols, expose stubs symbols when needed.

Signed-off-by: David Marchand <david.march...@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com>
---
 drivers/net/virtio/meson.build          | 5 +++++
 drivers/net/virtio/virtio_rxtx.c        | 6 ++++--
 drivers/net/virtio/virtio_rxtx_simple.c | 4 +++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build
index 4302595424..c1c4a85bea 100644
--- a/drivers/net/virtio/meson.build
+++ b/drivers/net/virtio/meson.build
@@ -28,6 +28,7 @@ cflags += no_wvla_cflag
 if arch_subdir == 'x86'
     if cc_has_avx512
         cflags += ['-DCC_AVX512_SUPPORT']
+        cflags += ['-DVIRTIO_RXTX_PACKED_VEC']
         virtio_avx512_lib = static_library('virtio_avx512_lib',
                 'virtio_rxtx_packed.c',
                 dependencies: [static_rte_ethdev,
@@ -41,11 +42,15 @@ if arch_subdir == 'x86'
             cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA'
         endif
     endif
+    cflags += ['-DVIRTIO_RXTX_VEC']
     sources += files('virtio_rxtx_simple_sse.c')
 elif arch_subdir == 'ppc'
+    cflags += ['-DVIRTIO_RXTX_VEC']
     sources += files('virtio_rxtx_simple_altivec.c')
 elif arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
+    cflags += ['-DVIRTIO_RXTX_PACKED_VEC']
     sources += files('virtio_rxtx_packed.c')
+    cflags += ['-DVIRTIO_RXTX_VEC']
     sources += files('virtio_rxtx_simple_neon.c')
 endif
 
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index b67f063b31..2a0d1b6101 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -2045,7 +2045,8 @@ virtio_xmit_pkts_inorder(void *tx_queue,
        return nb_tx;
 }
 
-__rte_weak uint16_t
+#ifndef VIRTIO_RXTX_PACKED_VEC
+uint16_t
 virtio_recv_pkts_packed_vec(void *rx_queue __rte_unused,
                            struct rte_mbuf **rx_pkts __rte_unused,
                            uint16_t nb_pkts __rte_unused)
@@ -2053,10 +2054,11 @@ virtio_recv_pkts_packed_vec(void *rx_queue __rte_unused,
        return 0;
 }
 
-__rte_weak uint16_t
+uint16_t
 virtio_xmit_pkts_packed_vec(void *tx_queue __rte_unused,
                            struct rte_mbuf **tx_pkts __rte_unused,
                            uint16_t nb_pkts __rte_unused)
 {
        return 0;
 }
+#endif /* DVIRTIO_RXTX_PACKED_VEC */
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c 
b/drivers/net/virtio/virtio_rxtx_simple.c
index 439e00a7e1..aa96c9c488 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -43,8 +43,9 @@ virtio_rxq_vec_setup(struct virtnet_rx *rxq)
        return 0;
 }
 
+#ifndef VIRTIO_RXTX_VEC
 /* Stub for linkage when arch specific implementation is not available */
-__rte_weak uint16_t
+uint16_t
 virtio_recv_pkts_vec(void *rx_queue __rte_unused,
                     struct rte_mbuf **rx_pkts __rte_unused,
                     uint16_t nb_pkts __rte_unused)
@@ -52,3 +53,4 @@ virtio_recv_pkts_vec(void *rx_queue __rte_unused,
        rte_panic("Wrong weak function linked by linker\n");
        return 0;
 }
+#endif /* VIRTIO_RXTX_VEC */
-- 
2.48.1

Reply via email to