hash: support NEON for Toeplitz algo
authorAshwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
Thu, 27 Apr 2017 12:33:49 +0000 (05:33 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 3 Jul 2017 12:17:37 +0000 (14:17 +0200)
Verified the changes with thash_autotest unit test case

Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
lib/librte_hash/rte_thash.h

index a4886a8..60d58c6 100644 (file)
@@ -56,7 +56,7 @@ extern "C" {
 #include <rte_ip.h>
 #include <rte_common.h>
 
-#ifdef __SSE3__
+#if defined(__SSE3__) || defined(RTE_MACHINE_CPUFLAG_NEON)
 #include <rte_vect.h>
 #endif
 
@@ -176,6 +176,11 @@ rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ
        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)
+       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);
+       vst1q_u8((uint8_t *)targ->v6.dst_addr, vrev32q_u8(ipv6));
 #else
        int i;
        for (i = 0; i < 4; i++) {