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>,
	Jasvinder Singh <jasvinder.singh@intel.com>
Subject: [PATCH v4 10/11] net: use common AVX512 build code
Date: Wed, 19 Mar 2025 17:29:40 +0000	[thread overview]
Message-ID: <20250319172942.2992053-11-bruce.richardson@intel.com> (raw)
In-Reply-To: <20250319172942.2992053-1-bruce.richardson@intel.com>

Use the common support for AVX512 code present in lib/meson.build,
rather than hard-coding it. The only complication is an extra check for
the "-mvpclmulqdq" command-line flag before adding the AVX512 sources.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/net/meson.build   | 12 ++++--------
 lib/net/rte_net_crc.c |  8 ++++----
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/lib/net/meson.build b/lib/net/meson.build
index cd49b4d758..7a6c419f40 100644
--- a/lib/net/meson.build
+++ b/lib/net/meson.build
@@ -44,14 +44,10 @@ use_function_versioning = true
 if dpdk_conf.has('RTE_ARCH_X86_64')
     sources += files('net_crc_sse.c')
     cflags += ['-mpclmul', '-maes']
-    if cc.has_argument('-mvpclmulqdq') and cc_has_avx512
-        cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT']
-        net_crc_avx512_lib = static_library(
-                'net_crc_avx512_lib',
-                'net_crc_avx512.c',
-                dependencies: static_rte_eal,
-                c_args: [cflags, cc_avx512_flags, '-mvpclmulqdq'])
-        objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c')
+    # only build AVX-512 support if we also have PCLMULQDQ support
+    if cc.has_argument('-mvpclmulqdq')
+        sources_avx512 += files('net_crc_avx512.c')
+        cflags_avx512 += ['-mvpclmulqdq']
     endif
 
 elif (dpdk_conf.has('RTE_ARCH_ARM64') and
diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c
index c9773d6300..24ec267fc8 100644
--- a/lib/net/rte_net_crc.c
+++ b/lib/net/rte_net_crc.c
@@ -60,7 +60,7 @@ static const rte_net_crc_handler handlers_scalar[] = {
 	[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_handler,
 	[RTE_NET_CRC32_ETH] = rte_crc32_eth_handler,
 };
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
 static const rte_net_crc_handler handlers_avx512[] = {
 	[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_avx512_handler,
 	[RTE_NET_CRC32_ETH] = rte_crc32_eth_avx512_handler,
@@ -185,7 +185,7 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len)
 static const rte_net_crc_handler *
 avx512_vpclmulqdq_get_handlers(void)
 {
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
 	if (AVX512_VPCLMULQDQ_CPU_SUPPORTED &&
 			max_simd_bitwidth >= RTE_VECT_SIMD_512)
 		return handlers_avx512;
@@ -197,7 +197,7 @@ avx512_vpclmulqdq_get_handlers(void)
 static void
 avx512_vpclmulqdq_init(void)
 {
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
 	if (AVX512_VPCLMULQDQ_CPU_SUPPORTED)
 		rte_net_crc_avx512_init();
 #endif
@@ -305,7 +305,7 @@ handlers_init(enum rte_net_crc_alg alg)
 
 	switch (alg) {
 	case RTE_NET_CRC_AVX512:
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
 		if (AVX512_VPCLMULQDQ_CPU_SUPPORTED) {
 			handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] =
 				rte_crc16_ccitt_avx512_handler;
-- 
2.43.0


  parent reply	other threads:[~2025-03-19 17:31 UTC|newest]

Thread overview: 48+ 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   ` [PATCH v2 3/4] drivers/net: build use common AVX handling Bruce Richardson
2025-03-14 17:44   ` [PATCH v2 4/4] drivers/net: remove AVX2 build-time define Bruce Richardson
2025-03-17  9:47     ` David Marchand
2025-03-17  9:50   ` [PATCH v2 0/4] remove driver-specific logic for AVX builds David Marchand
2025-03-18 11:51     ` Bruce Richardson
2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson
2025-03-18 17:34   ` [PATCH v3 01/11] build: add generalized AVX handling for drivers Bruce Richardson
2025-03-18 17:34   ` [PATCH v3 02/11] net/intel: use common AVX build code Bruce Richardson
2025-03-19 10:11     ` David Marchand
2025-03-19 11:17       ` Bruce Richardson
2025-03-18 17:34   ` [PATCH v3 03/11] drivers/net: build use common AVX handling Bruce Richardson
2025-03-18 17:34   ` [PATCH v3 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson
2025-03-18 17:42     ` Ajit Khaparde
2025-03-18 17:34   ` [PATCH v3 05/11] event/dlb2: build using common AVX handling Bruce Richardson
2025-03-18 17:34   ` [PATCH v3 06/11] build: add generalized AVX handling for libs Bruce Richardson
2025-03-18 17:35   ` [PATCH v3 07/11] acl: use common AVX build handling Bruce Richardson
2025-03-19 10:16     ` David Marchand
2025-03-19 10:26       ` Bruce Richardson
2025-03-19 10:40         ` David Marchand
2025-03-19 10:59           ` Bruce Richardson
2025-03-18 17:35   ` [PATCH v3 08/11] fib: " Bruce Richardson
2025-03-18 17:35   ` [PATCH v3 09/11] net: simplify build-time logic for x86 Bruce Richardson
2025-03-19 10:24     ` David Marchand
2025-03-18 17:35   ` [PATCH v3 10/11] net: use common AVX512 build code Bruce Richardson
2025-03-18 17:35   ` [PATCH v3 11/11] member: use common AVX512 build support Bruce Richardson
2025-03-19 10:27   ` [PATCH v3 00/11] remove component-specific logic for AVX builds David Marchand
2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 01/11] drivers: add generalized AVX build handling Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 02/11] net/intel: use common AVX build code Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 03/11] drivers/net: build use common AVX handling Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 05/11] event/dlb2: build using common AVX handling Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 06/11] lib: add generalized AVX build handling Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 07/11] acl: use common " Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 08/11] fib: " Bruce Richardson
2025-03-19 17:29   ` [PATCH v4 09/11] net: simplify build-time logic for x86 Bruce Richardson
2025-03-19 17:29   ` Bruce Richardson [this message]
2025-03-19 17:29   ` [PATCH v4 11/11] member: use common AVX512 build support Bruce Richardson
2025-03-19 18:08   ` [PATCH v4 00/11] remove component-specific logic for AVX builds 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=20250319172942.2992053-11-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.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).