DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, david.marchand@redhat.com,
	viktorin@rehivetech.com, ruifeng.wang@arm.com,
	jerinj@marvell.com, drc@linux.vnet.ibm.com,
	bruce.richardson@intel.com, konstantin.ananyev@intel.com,
	Radu Nicolau <radu.nicolau@intel.com>,
	Sean Morrissey <sean.morrissey@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/4] arm: change cpuflag macros to compiler macros
Date: Thu, 24 Sep 2020 08:18:30 +0000	[thread overview]
Message-ID: <20200924081832.21581-3-radu.nicolau@intel.com> (raw)
In-Reply-To: <20200924081832.21581-1-radu.nicolau@intel.com>

Replace use of RTE_MACHINE_CPUFLAG macros with regular compiler
macros, which are more complete than those provided by DPDK, and as such
it allows new instruction sets to be leveraged without having to do
extra work to set them up in DPDK.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 app/test-pmd/macswap.c                     |  2 +-
 config/arm/meson.build                     |  6 ------
 drivers/net/ixgbe/ixgbe_ethdev.c           |  2 +-
 examples/l3fwd/l3fwd.h                     |  2 +-
 examples/l3fwd/l3fwd_em.c                  | 12 ++++++------
 examples/l3fwd/l3fwd_em_hlm.h              |  2 +-
 examples/l3fwd/l3fwd_em_sequential.h       |  2 +-
 examples/l3fwd/l3fwd_lpm.c                 |  6 +++---
 lib/librte_eal/arm/include/rte_memcpy_32.h |  2 +-
 lib/librte_hash/rte_cuckoo_hash.c          |  2 +-
 lib/librte_hash/rte_hash_crc.h             |  2 +-
 lib/librte_hash/rte_thash.h                |  4 ++--
 lib/librte_member/rte_member.h             |  2 +-
 lib/librte_net/rte_net_crc.c               |  2 +-
 lib/librte_node/ip4_lookup.c               |  2 +-
 lib/librte_sched/rte_sched.c               |  2 +-
 lib/librte_table/rte_lru_arm64.h           |  2 +-
 lib/librte_table/rte_table_hash_func.h     |  2 +-
 18 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index 74e2dd838..310bca06a 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -39,7 +39,7 @@
 #include "testpmd.h"
 #if defined(RTE_ARCH_X86)
 #include "macswap_sse.h"
-#elif defined(RTE_MACHINE_CPUFLAG_NEON)
+#elif defined(__ARM_NEON)
 #include "macswap_neon.h"
 #else
 #include "macswap.h"
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 8728051d5..42c0c34a5 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -208,20 +208,14 @@ message(machine_args)
 
 if (cc.get_define('__ARM_NEON', args: machine_args) != '' or
     cc.get_define('__aarch64__', args: machine_args) != '')
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_NEON', 1)
 	compile_time_cpuflags += ['RTE_CPUFLAG_NEON']
 endif
 
 if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != ''
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_CRC32', 1)
 	compile_time_cpuflags += ['RTE_CPUFLAG_CRC32']
 endif
 
 if cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != ''
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1)
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_PMULL', 1)
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_SHA1', 1)
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_SHA2', 1)
 	compile_time_cpuflags += ['RTE_CPUFLAG_AES', 'RTE_CPUFLAG_PMULL',
 	'RTE_CPUFLAG_SHA1', 'RTE_CPUFLAG_SHA2']
 endif
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0f065bbc0..c74467e06 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3960,7 +3960,7 @@ ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	    dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc)
 		return ptypes;
 
-#if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_NEON)
+#if defined(RTE_ARCH_X86) || defined(__ARM_NEON)
 	if (dev->rx_pkt_burst == ixgbe_recv_pkts_vec ||
 	    dev->rx_pkt_burst == ixgbe_recv_scattered_pkts_vec)
 		return ptypes;
diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
index 67055431f..2cf06099e 100644
--- a/examples/l3fwd/l3fwd.h
+++ b/examples/l3fwd/l3fwd.h
@@ -12,7 +12,7 @@
 
 #define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
 
-#if !defined(NO_HASH_MULTI_LOOKUP) && defined(RTE_MACHINE_CPUFLAG_NEON)
+#if !defined(NO_HASH_MULTI_LOOKUP) && defined(__ARM_NEON)
 #define NO_HASH_MULTI_LOOKUP 1
 #endif
 
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index df0c8dd16..3b35fa3e5 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -28,7 +28,7 @@
 #include "l3fwd.h"
 #include "l3fwd_event.h"
 
-#if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_CRC32)
+#if defined(RTE_ARCH_X86) || defined(__ARM_FEATURE_CRC32)
 #define EM_HASH_CRC 1
 #endif
 
@@ -223,7 +223,7 @@ em_mask_key(void *key, xmm_t mask)
 
 	return _mm_and_si128(data, mask);
 }
-#elif defined(RTE_MACHINE_CPUFLAG_NEON)
+#elif defined(__ARM_NEON)
 static inline xmm_t
 em_mask_key(void *key, xmm_t mask)
 {
@@ -303,7 +303,7 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct)
 	return (ret < 0) ? portid : ipv6_l3fwd_out_if[ret];
 }
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON
+#if defined RTE_ARCH_X86 || defined __ARM_NEON
 #if defined(NO_HASH_MULTI_LOOKUP)
 #include "l3fwd_em_sequential.h"
 #else
@@ -685,7 +685,7 @@ em_main_loop(__rte_unused void *dummy)
 			if (nb_rx == 0)
 				continue;
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON
+#if defined RTE_ARCH_X86 || defined __ARM_NEON
 			l3fwd_em_send_packets(nb_rx, pkts_burst,
 							portid, qconf);
 #else
@@ -723,7 +723,7 @@ em_event_loop_single(struct l3fwd_event_resources *evt_rsrc,
 
 		struct rte_mbuf *mbuf = ev.mbuf;
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON
+#if defined RTE_ARCH_X86 || defined __ARM_NEON
 		mbuf->port = em_get_dst_port(lconf, mbuf, mbuf->port);
 		process_packet(mbuf, &mbuf->port);
 #else
@@ -784,7 +784,7 @@ em_event_loop_burst(struct l3fwd_event_resources *evt_rsrc,
 			continue;
 		}
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON
+#if defined RTE_ARCH_X86 || defined __ARM_NEON
 		l3fwd_em_process_events(nb_deq, (struct rte_event **)&events,
 					lconf);
 #else
diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h
index 79812716c..278707c18 100644
--- a/examples/l3fwd/l3fwd_em_hlm.h
+++ b/examples/l3fwd/l3fwd_em_hlm.h
@@ -9,7 +9,7 @@
 #if defined RTE_ARCH_X86
 #include "l3fwd_sse.h"
 #include "l3fwd_em_hlm_sse.h"
-#elif defined RTE_MACHINE_CPUFLAG_NEON
+#elif defined __ARM_NEON
 #include "l3fwd_neon.h"
 #include "l3fwd_em_hlm_neon.h"
 #endif
diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h
index b231b9994..6170052cf 100644
--- a/examples/l3fwd/l3fwd_em_sequential.h
+++ b/examples/l3fwd/l3fwd_em_sequential.h
@@ -16,7 +16,7 @@
 
 #if defined RTE_ARCH_X86
 #include "l3fwd_sse.h"
-#elif defined RTE_MACHINE_CPUFLAG_NEON
+#elif defined __ARM_NEON
 #include "l3fwd_neon.h"
 #endif
 
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 91eb74272..3dcf1fef1 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -163,7 +163,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
 
 #if defined(RTE_ARCH_X86)
 #include "l3fwd_lpm_sse.h"
-#elif defined RTE_MACHINE_CPUFLAG_NEON
+#elif defined __ARM_NEON
 #include "l3fwd_lpm_neon.h"
 #elif defined(RTE_ARCH_PPC_64)
 #include "l3fwd_lpm_altivec.h"
@@ -240,7 +240,7 @@ lpm_main_loop(__rte_unused void *dummy)
 			if (nb_rx == 0)
 				continue;
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \
+#if defined RTE_ARCH_X86 || defined __ARM_NEON \
 			 || defined RTE_ARCH_PPC_64
 			l3fwd_lpm_send_packets(nb_rx, pkts_burst,
 						portid, qconf);
@@ -259,7 +259,7 @@ lpm_process_event_pkt(const struct lcore_conf *lconf, struct rte_mbuf *mbuf)
 {
 	mbuf->port = lpm_get_dst_port(lconf, mbuf, mbuf->port);
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \
+#if defined RTE_ARCH_X86 || defined __ARM_NEON \
 	|| defined RTE_ARCH_PPC_64
 	process_packet(mbuf, &mbuf->port);
 #else
diff --git a/lib/librte_eal/arm/include/rte_memcpy_32.h b/lib/librte_eal/arm/include/rte_memcpy_32.h
index eb02c3b41..fb3245b59 100644
--- a/lib/librte_eal/arm/include/rte_memcpy_32.h
+++ b/lib/librte_eal/arm/include/rte_memcpy_32.h
@@ -16,7 +16,7 @@ extern "C" {
 
 #ifdef RTE_ARCH_ARM_NEON_MEMCPY
 
-#ifndef RTE_MACHINE_CPUFLAG_NEON
+#ifndef __ARM_NEON
 #error "Cannot optimize memcpy by NEON as the CPU seems to not support this"
 #endif
 
diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 7c7ab84af..aad0c965b 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -1704,7 +1704,7 @@ compare_signatures(uint32_t *prim_hash_matches, uint32_t *sec_hash_matches,
 					(__m128i const *)sec_bkt->sig_current),
 				_mm_set1_epi16(sig)));
 		break;
-#elif defined(RTE_MACHINE_CPUFLAG_NEON)
+#elif defined(__ARM_NEON)
 	case RTE_HASH_COMPARE_NEON: {
 		uint16x8_t vmat, vsig, x;
 		int16x8_t shift = {-15, -13, -11, -9, -7, -5, -3, -1};
diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index cf28031b3..3e131aa6b 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -424,7 +424,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 
 static uint8_t crc32_alg = CRC32_SW;
 
-#if defined(RTE_ARCH_ARM64) && defined(RTE_MACHINE_CPUFLAG_CRC32)
+#if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
 #include "rte_crc_arm64.h"
 #else
 
diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h
index 51b512946..061efa2ae 100644
--- a/lib/librte_hash/rte_thash.h
+++ b/lib/librte_hash/rte_thash.h
@@ -28,7 +28,7 @@ extern "C" {
 #include <rte_ip.h>
 #include <rte_common.h>
 
-#if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_NEON)
+#if defined(RTE_ARCH_X86) || defined(__ARM_NEON)
 #include <rte_vect.h>
 #endif
 
@@ -149,7 +149,7 @@ rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig,
 	ipv6 = _mm_loadu_si128((const __m128i *)orig->dst_addr);
 	*(__m128i *)targ->v6.dst_addr =
 			_mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
-#elif defined(RTE_MACHINE_CPUFLAG_NEON)
+#elif defined(__ARM_NEON)
 	uint8x16_t ipv6 = vld1q_u8((uint8_t const *)orig->src_addr);
 	vst1q_u8((uint8_t *)targ->v6.src_addr, vrev32q_u8(ipv6));
 	ipv6 = vld1q_u8((uint8_t const *)orig->dst_addr);
diff --git a/lib/librte_member/rte_member.h b/lib/librte_member/rte_member.h
index ab2b23217..c0689e233 100644
--- a/lib/librte_member/rte_member.h
+++ b/lib/librte_member/rte_member.h
@@ -68,7 +68,7 @@ typedef uint16_t member_set_t;
 #define RTE_MEMBER_NAMESIZE 32
 
 /** @internal Hash function used by membership library. */
-#if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_CRC32)
+#if defined(RTE_ARCH_X86) || defined(__ARM_FEATURE_CRC32)
 #include <rte_hash_crc.h>
 #define MEMBER_HASH_FUNC       rte_hash_crc
 #else
diff --git a/lib/librte_net/rte_net_crc.c b/lib/librte_net/rte_net_crc.c
index 56a0ed129..4f5b9e828 100644
--- a/lib/librte_net/rte_net_crc.c
+++ b/lib/librte_net/rte_net_crc.c
@@ -12,7 +12,7 @@
 
 #if defined(RTE_ARCH_X86_64) && defined(__PCLMUL__)
 #define X86_64_SSE42_PCLMULQDQ     1
-#elif defined(RTE_ARCH_ARM64) && defined(RTE_MACHINE_CPUFLAG_PMULL)
+#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRYPTO)
 #define ARM64_NEON_PMULL           1
 #endif
 
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 8e6379457..293c77f39 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -30,7 +30,7 @@ struct ip4_lookup_node_main {
 
 static struct ip4_lookup_node_main ip4_lookup_nm;
 
-#if defined(RTE_MACHINE_CPUFLAG_NEON)
+#if defined(__ARM_NEON)
 #include "ip4_lookup_neon.h"
 #elif defined(RTE_ARCH_X86)
 #include "ip4_lookup_sse.h"
diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 0fa074166..75be8b6bd 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -29,7 +29,7 @@
 
 #ifdef RTE_ARCH_X86
 #define SCHED_VECTOR_SSE4
-#elif defined(RTE_MACHINE_CPUFLAG_NEON)
+#elif defined(__ARM_NEON)
 #define SCHED_VECTOR_NEON
 #endif
 
diff --git a/lib/librte_table/rte_lru_arm64.h b/lib/librte_table/rte_lru_arm64.h
index b45e9d03c..add889a57 100644
--- a/lib/librte_table/rte_lru_arm64.h
+++ b/lib/librte_table/rte_lru_arm64.h
@@ -13,7 +13,7 @@ extern "C" {
 #include <rte_vect.h>
 
 #ifndef RTE_TABLE_HASH_LRU_STRATEGY
-#ifdef RTE_MACHINE_CPUFLAG_NEON
+#ifdef __ARM_NEON
 #define RTE_TABLE_HASH_LRU_STRATEGY                        3
 #else /* if no NEON, use simple scalar version */
 #define RTE_TABLE_HASH_LRU_STRATEGY                        1
diff --git a/lib/librte_table/rte_table_hash_func.h b/lib/librte_table/rte_table_hash_func.h
index 350c79564..c4c35cc06 100644
--- a/lib/librte_table/rte_table_hash_func.h
+++ b/lib/librte_table/rte_table_hash_func.h
@@ -41,7 +41,7 @@ rte_crc32_u64(uint64_t crc, uint64_t v)
 	return _mm_crc32_u64(crc, v);
 }
 
-#elif defined(RTE_ARCH_ARM64) && defined(RTE_MACHINE_CPUFLAG_CRC32)
+#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
 #include "rte_table_hash_func_arm64.h"
 #else
 
-- 
2.17.1


  parent reply	other threads:[~2020-09-24  8:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 10:43 [dpdk-dev] [PATCH v1 0/4] Remove RTE_MACHINE_CPUFLAG_ macros Radu Nicolau
2020-09-02 10:43 ` [dpdk-dev] [PATCH v1 1/4] x86: change cpuflag macros to compiler macros Radu Nicolau
2020-09-02 11:20   ` Bruce Richardson
2020-09-23 10:44   ` [dpdk-dev] [PATCH v2 0/4] Remove RTE_MACHINE_CPUFLAG_ macros Radu Nicolau
2020-09-23 10:44     ` [dpdk-dev] [PATCH v2 1/4] x86: change cpuflag macros to compiler macros Radu Nicolau
2020-09-23 15:11       ` David Marchand
2020-09-23 10:44     ` [dpdk-dev] [PATCH v2 2/4] arm: " Radu Nicolau
2020-09-23 15:11       ` David Marchand
2020-09-23 10:44     ` [dpdk-dev] [PATCH v2 3/4] ppc: " Radu Nicolau
2020-09-23 10:44     ` [dpdk-dev] [PATCH v2 4/4] doc: remove reference to RTE_MACHINE_CPUFLAG Radu Nicolau
2020-09-24  8:18   ` [dpdk-dev] [PATCH v3 0/4] Remove RTE_MACHINE_CPUFLAG_ macros Radu Nicolau
2020-09-24  8:18     ` [dpdk-dev] [PATCH v3 1/4] x86: change cpuflag macros to compiler macros Radu Nicolau
2020-09-24  8:18     ` Radu Nicolau [this message]
2020-09-24  8:18     ` [dpdk-dev] [PATCH v3 3/4] ppc: " Radu Nicolau
2020-10-05 19:43       ` David Christensen
2020-09-24  8:18     ` [dpdk-dev] [PATCH v3 4/4] doc: remove reference to RTE_MACHINE_CPUFLAG Radu Nicolau
2020-09-25  9:18     ` [dpdk-dev] [PATCH v3 0/4] Remove RTE_MACHINE_CPUFLAG_ macros David Marchand
2020-09-02 10:43 ` [dpdk-dev] [PATCH v1 2/4] arm: change cpuflag macros to compiler macros Radu Nicolau
2020-09-02 10:43 ` [dpdk-dev] [PATCH v1 3/4] ppc: " Radu Nicolau
2020-09-02 10:43 ` [dpdk-dev] [PATCH v1 4/4] doc: remove reference to RTE_MACHINE_CPUFLAG Radu Nicolau
2020-09-02 11:21   ` Bruce Richardson
2020-09-02 16:57 ` [dpdk-dev] [PATCH v1 0/4] Remove RTE_MACHINE_CPUFLAG_ macros David Christensen
2020-09-03  9:48   ` Nicolau, Radu
2020-09-15 14:28 ` 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=20200924081832.21581-3-radu.nicolau@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.com \
    --cc=jerinj@marvell.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=ruifeng.wang@arm.com \
    --cc=sean.morrissey@intel.com \
    --cc=thomas@monjalon.net \
    --cc=viktorin@rehivetech.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).