[dpdk-dev] [PATCH v1 12/12] arm: Disable usage of SSE optimized code in librte_acl
Jan Viktorin
viktorin at rehivetech.com
Sat Oct 3 10:58:18 CEST 2015
From: Vlastimil Kosar <kosar at rehivetech.com>
The SSE optimized code is disabled for architectures other
than i686 and x86_64.
ACL works now on ARM.
FIXME: should be reworked to avoid if/endif mess
Signed-off-by: Vlastimil Kosar <kosar at rehivetech.com>
Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
---
config/defconfig_arm-armv7-a-linuxapp-gcc | 3 ---
lib/librte_acl/acl.h | 2 ++
lib/librte_acl/rte_acl.c | 8 +++++++-
lib/librte_acl/rte_acl_osdep.h | 2 ++
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/config/defconfig_arm-armv7-a-linuxapp-gcc b/config/defconfig_arm-armv7-a-linuxapp-gcc
index c434429..e091200 100644
--- a/config/defconfig_arm-armv7-a-linuxapp-gcc
+++ b/config/defconfig_arm-armv7-a-linuxapp-gcc
@@ -54,9 +54,6 @@ CONFIG_RTE_EAL_IGB_UIO=n
# missing rte_vect.h for ARM
CONFIG_XMM_SIZE=16
-# fails to compile on ARM
-CONFIG_RTE_LIBRTE_ACL=n
-
# cannot use those on ARM
CONFIG_RTE_KNI_KMOD=n
CONFIG_RTE_LIBRTE_EM_PMD=n
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index eb4930c..cb4e6a8 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -222,9 +222,11 @@ int
rte_acl_classify_scalar(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);
+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
int
rte_acl_classify_sse(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);
+#endif
int
rte_acl_classify_avx2(const struct rte_acl_ctx *ctx, const uint8_t **data,
diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c
index a54d531..f173b31 100644
--- a/lib/librte_acl/rte_acl.c
+++ b/lib/librte_acl/rte_acl.c
@@ -60,8 +60,13 @@ rte_acl_classify_avx2(__rte_unused const struct rte_acl_ctx *ctx,
static const rte_acl_classify_t classify_fns[] = {
[RTE_ACL_CLASSIFY_DEFAULT] = rte_acl_classify_scalar,
[RTE_ACL_CLASSIFY_SCALAR] = rte_acl_classify_scalar,
+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
[RTE_ACL_CLASSIFY_SSE] = rte_acl_classify_sse,
[RTE_ACL_CLASSIFY_AVX2] = rte_acl_classify_avx2,
+#else
+ [RTE_ACL_CLASSIFY_SSE] = rte_acl_classify_scalar,
+ [RTE_ACL_CLASSIFY_AVX2] = rte_acl_classify_scalar,
+#endif
};
/* by default, use always available scalar code path. */
@@ -95,6 +100,7 @@ rte_acl_init(void)
{
enum rte_acl_classify_alg alg = RTE_ACL_CLASSIFY_DEFAULT;
+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
#ifdef CC_AVX2_SUPPORT
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))
alg = RTE_ACL_CLASSIFY_AVX2;
@@ -103,7 +109,7 @@ rte_acl_init(void)
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1))
#endif
alg = RTE_ACL_CLASSIFY_SSE;
-
+#endif
rte_acl_set_default_classify(alg);
}
diff --git a/lib/librte_acl/rte_acl_osdep.h b/lib/librte_acl/rte_acl_osdep.h
index 41f7e3d..05cf9a8 100644
--- a/lib/librte_acl/rte_acl_osdep.h
+++ b/lib/librte_acl/rte_acl_osdep.h
@@ -59,7 +59,9 @@
#define DIM(x) RTE_DIM(x)
#include <rte_common.h>
+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
#include <rte_vect.h>
+#endif
#include <rte_memory.h>
#include <rte_log.h>
#include <rte_memcpy.h>
--
2.5.2
More information about the dev
mailing list