DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
	andremue@linux.microsoft.com,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbox@nvidia.com>
Subject: [RFC 08/10] net/virtio: remove weak symbols
Date: Fri,  7 Feb 2025 09:32:48 +0100	[thread overview]
Message-ID: <20250207083252.3131588-9-david.marchand@redhat.com> (raw)
In-Reply-To: <20250207083252.3131588-1-david.marchand@redhat.com>

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

Signed-off-by: David Marchand <david.marchand@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 c708ea5258..56c763e96f 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,
@@ -43,11 +44,15 @@ if arch_subdir == 'x86'
             cflags += '-DVIRTIO_ICC_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


  parent reply	other threads:[~2025-02-07  8:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07  8:32 [RFC 00/10] Remove " David Marchand
2025-02-07  8:32 ` [RFC 01/10] bus/auxiliary: remove " David Marchand
2025-02-07  8:32 ` [RFC 02/10] common/qat: " David Marchand
2025-02-07  8:32 ` [RFC 03/10] drivers: remove weak symbols in Nitrox drivers David Marchand
2025-02-07  8:32 ` [RFC 04/10] net/enic: remove weak symbols David Marchand
2025-02-07  8:32 ` [RFC 05/10] net/hns3: " David Marchand
2025-02-07  8:32 ` [RFC 06/10] net/fm10k: " David Marchand
2025-02-07  8:51   ` Bruce Richardson
2025-02-07  8:32 ` [RFC 07/10] net/nfp: " David Marchand
2025-02-07  8:44   ` Chaoyong He
2025-02-07  8:32 ` David Marchand [this message]
2025-02-07  8:32 ` [RFC 09/10] app/compress-perf: " David Marchand
2025-02-07  8:32 ` [RFC 10/10] eal: deprecate " David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250207083252.3131588-9-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=andremue@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).