DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com,
	Bruce Richardson <bruce.richardson@intel.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	John Daley <johndale@cisco.com>,
	Hyong Youb Kim <hyonkim@cisco.com>,
	Chaoyong He <chaoyong.he@corigine.com>,
	Vamsi Attunuru <vattunuru@marvell.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbox@nvidia.com>
Subject: [PATCH v2 3/4] drivers/net: build use common AVX handling
Date: Fri, 14 Mar 2025 17:44:37 +0000	[thread overview]
Message-ID: <20250314174439.112658-4-bruce.richardson@intel.com> (raw)
In-Reply-To: <20250314174439.112658-1-bruce.richardson@intel.com>

Remove from remaining net drivers the special-case code to handle AVX2
or AVX512 specific files. These can be built instead using
drivers/meson.build.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/bnxt/meson.build      | 10 +---------
 drivers/net/enic/meson.build      | 10 +---------
 drivers/net/nfp/meson.build       | 10 +---------
 drivers/net/octeon_ep/meson.build | 14 ++------------
 drivers/net/virtio/meson.build    |  9 +--------
 5 files changed, 6 insertions(+), 47 deletions(-)

diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build
index fd82d0c409..dcca7df916 100644
--- a/drivers/net/bnxt/meson.build
+++ b/drivers/net/bnxt/meson.build
@@ -58,15 +58,7 @@ subdir('hcapi/cfa_v3')
 
 if arch_subdir == 'x86'
     sources += files('bnxt_rxtx_vec_sse.c')
-    # build AVX2 code with instruction set explicitly enabled for runtime selection
-    bnxt_avx2_lib = static_library('bnxt_avx2_lib',
-            'bnxt_rxtx_vec_avx2.c',
-            dependencies: [static_rte_ethdev,
-                static_rte_bus_pci,
-                static_rte_kvargs, static_rte_hash],
-            include_directories: includes,
-            c_args: [cflags, cc_avx2_flags])
-     objs += bnxt_avx2_lib.extract_objects('bnxt_rxtx_vec_avx2.c')
+    sources_avx2 = files('bnxt_rxtx_vec_avx2.c')
 elif arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
     sources += files('bnxt_rxtx_vec_neon.c')
 endif
diff --git a/drivers/net/enic/meson.build b/drivers/net/enic/meson.build
index cfe5ec170a..2b3052fae8 100644
--- a/drivers/net/enic/meson.build
+++ b/drivers/net/enic/meson.build
@@ -29,17 +29,9 @@ sources = files(
 deps += ['hash']
 includes += include_directories('base')
 
-# Build the avx2 handler for 64-bit X86 targets, even though 'machine'
-# may not. This is to support users who build for the min supported machine
-# and need to run the binary on newer CPUs too.
 if dpdk_conf.has('RTE_ARCH_X86_64')
     cflags += '-DENIC_RXTX_VEC'
-    enic_avx2_lib = static_library('enic_avx2_lib',
-            'enic_rxtx_vec_avx2.c',
-            dependencies: [static_rte_ethdev, static_rte_bus_pci],
-            include_directories: includes,
-            c_args: [cflags, cc_avx2_flags])
-    objs += enic_avx2_lib.extract_objects('enic_rxtx_vec_avx2.c')
+    sources_avx2 = files('enic_rxtx_vec_avx2.c')
 endif
 
 annotate_locks = false
diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build
index 0a12b7dce7..a98b584042 100644
--- a/drivers/net/nfp/meson.build
+++ b/drivers/net/nfp/meson.build
@@ -52,19 +52,11 @@ cflags += no_wvla_cflag
 if arch_subdir == 'x86'
         includes += include_directories('../../common/nfp')
 
-        avx2_sources = files(
+        sources_avx2 = files(
                 'nfdk/nfp_nfdk_vec_avx2_dp.c',
                 'nfp_rxtx_vec_avx2.c',
         )
 
-        nfp_avx2_lib = static_library('nfp_avx2_lib',
-                avx2_sources,
-                dependencies: [static_rte_ethdev, static_rte_bus_pci],
-                include_directories: includes,
-                c_args: [cflags, cc_avx2_flags]
-        )
-
-        objs += nfp_avx2_lib.extract_all_objects(recursive: true)
 else
         sources += files(
                 'nfp_rxtx_vec_stub.c',
diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build
index 1b34db3edc..9bf4627894 100644
--- a/drivers/net/octeon_ep/meson.build
+++ b/drivers/net/octeon_ep/meson.build
@@ -15,18 +15,8 @@ sources = files(
 
 if arch_subdir == 'x86'
     sources += files('cnxk_ep_rx_sse.c')
-    if cc.get_define('__AVX2__', args: machine_args) != ''
-        cflags += ['-DCC_AVX2_SUPPORT']
-        sources += files('cnxk_ep_rx_avx.c')
-    elif cc.has_multi_arguments(cc_avx2_flags)
-        cflags += ['-DCC_AVX2_SUPPORT']
-        otx_ep_avx2_lib = static_library('otx_ep_avx2_lib',
-                        'cnxk_ep_rx_avx.c',
-                        dependencies: [static_rte_ethdev, static_rte_pci, static_rte_bus_pci],
-                        include_directories: includes,
-                        c_args: [cflags, cc_avx2_flags])
-        objs += otx_ep_avx2_lib.extract_objects('cnxk_ep_rx_avx.c')
-    endif
+    cflags += ['-DCC_AVX2_SUPPORT']
+    sources_avx2 = files('cnxk_ep_rx_avx.c')
 endif
 
 if arch_subdir == 'arm'
diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build
index c1c4a85bea..01bfb3c47d 100644
--- a/drivers/net/virtio/meson.build
+++ b/drivers/net/virtio/meson.build
@@ -27,15 +27,8 @@ 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,
-                    static_rte_kvargs, static_rte_bus_pci],
-                include_directories: includes,
-                c_args: cflags + cc_avx512_flags)
-        objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c')
+        sources_avx512 = files('virtio_rxtx_packed.c')
         if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
             cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA'
         elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0'))
-- 
2.43.0


  parent reply	other threads:[~2025-03-14 17:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson
2025-03-14 17:23 ` [PATCH 1/3] build: add generalized AVX handling for drivers Bruce Richardson
2025-03-14 17:23 ` [PATCH 2/3] net/intel: use common AVX build code Bruce Richardson
2025-03-14 17:23 ` [PATCH 3/3] drivers/net: build use common AVX handling Bruce Richardson
2025-03-14 17:31   ` David Marchand
2025-03-14 17:37     ` Bruce Richardson
2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson
2025-03-14 17:44   ` [PATCH v2 1/4] build: add generalized AVX handling for drivers Bruce Richardson
2025-03-14 17:44   ` [PATCH v2 2/4] net/intel: use common AVX build code Bruce Richardson
2025-03-14 17:44   ` Bruce Richardson [this message]
2025-03-14 17:44   ` [PATCH v2 4/4] drivers/net: remove AVX2 build-time define Bruce Richardson

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=20250314174439.112658-4-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=chaoyong.he@corigine.com \
    --cc=chenbox@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hyonkim@cisco.com \
    --cc=johndale@cisco.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=vattunuru@marvell.com \
    /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).