[v3,2/3] examples/ip_pipeline: modify application to use librte_table headers

Message ID 20180907100626.8165-2-kevin.laatz@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Cristian Dumitrescu
Headers
Series [v3,1/3] lib/librte_table: add hash_func header files |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Kevin Laatz Sept. 7, 2018, 10:06 a.m. UTC
  This commit modifies the IP Pipeline application to use the new header
files in librte_table.

As we are now using the new header files, we can remove the old ones from
the application directory.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 examples/ip_pipeline/action.c          |  34 ++--
 examples/ip_pipeline/hash_func.h       | 357 ---------------------------------
 examples/ip_pipeline/hash_func_arm64.h | 232 ---------------------
 examples/ip_pipeline/pipeline.c        |  19 +-
 4 files changed, 26 insertions(+), 616 deletions(-)
 delete mode 100644 examples/ip_pipeline/hash_func.h
 delete mode 100644 examples/ip_pipeline/hash_func_arm64.h
  

Comments

Gavin Hu Sept. 7, 2018, 10:20 a.m. UTC | #1
> -----Original Message-----
> From: Kevin Laatz <kevin.laatz@intel.com>
> Sent: Friday, September 7, 2018 6:06 PM
> To: dev@dpdk.org
> Cc: cristian.dumitrescu@intel.com; Jianbo Liu <Jianbo.Liu@arm.com>; Gavin
> Hu (Arm Technology China) <Gavin.Hu@arm.com>;
> jerin.jacob@caviumnetworks.com; Kevin Laatz <kevin.laatz@intel.com>
> Subject: [PATCH v3 2/3] examples/ip_pipeline: modify application to use
> librte_table headers
>
> This commit modifies the IP Pipeline application to use the new header files
> in librte_table.
>
> As we are now using the new header files, we can remove the old ones from
> the application directory.
>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Gavin Hu <gavin.hu@arm.com>
> ---
>  examples/ip_pipeline/action.c          |  34 ++--
>  examples/ip_pipeline/hash_func.h       | 357 ---------------------------------
>  examples/ip_pipeline/hash_func_arm64.h | 232 ---------------------
>  examples/ip_pipeline/pipeline.c        |  19 +-
>  4 files changed, 26 insertions(+), 616 deletions(-)  delete mode 100644
> examples/ip_pipeline/hash_func.h  delete mode 100644
> examples/ip_pipeline/hash_func_arm64.h
>
> diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
> index a29c2b3..20497c3 100644
> --- a/examples/ip_pipeline/action.c
> +++ b/examples/ip_pipeline/action.c
> @@ -7,9 +7,9 @@
>  #include <string.h>
>
>  #include <rte_string_fns.h>
> +#include <rte_table_hash_func.h>
>
>  #include "action.h"
> -#include "hash_func.h"
>
>  /**
>   * Input port
> @@ -57,35 +57,35 @@ port_in_action_profile_create(const char *name,
>  (params->lb.f_hash == NULL)) {
>  switch (params->lb.key_size) {
>  case  8:
> -params->lb.f_hash = hash_default_key8;
> +params->lb.f_hash = rte_table_hash_crc_key8;
>  break;
>
>  case 16:
> -params->lb.f_hash = hash_default_key16;
> +params->lb.f_hash = rte_table_hash_crc_key16;
>  break;
>
>  case 24:
> -params->lb.f_hash = hash_default_key24;
> +params->lb.f_hash = rte_table_hash_crc_key24;
>  break;
>
>  case 32:
> -params->lb.f_hash = hash_default_key32;
> +params->lb.f_hash = rte_table_hash_crc_key32;
>  break;
>
>  case 40:
> -params->lb.f_hash = hash_default_key40;
> +params->lb.f_hash = rte_table_hash_crc_key40;
>  break;
>
>  case 48:
> -params->lb.f_hash = hash_default_key48;
> +params->lb.f_hash = rte_table_hash_crc_key48;
>  break;
>
>  case 56:
> -params->lb.f_hash = hash_default_key56;
> +params->lb.f_hash = rte_table_hash_crc_key56;
>  break;
>
>  case 64:
> -params->lb.f_hash = hash_default_key64;
> +params->lb.f_hash = rte_table_hash_crc_key64;
>  break;
>
>  default:
> @@ -192,35 +192,35 @@ table_action_profile_create(const char *name,
>  (params->lb.f_hash == NULL)) {
>  switch (params->lb.key_size) {
>  case 8:
> -params->lb.f_hash = hash_default_key8;
> +params->lb.f_hash = rte_table_hash_crc_key8;
>  break;
>
>  case 16:
> -params->lb.f_hash = hash_default_key16;
> +params->lb.f_hash = rte_table_hash_crc_key16;
>  break;
>
>  case 24:
> -params->lb.f_hash = hash_default_key24;
> +params->lb.f_hash = rte_table_hash_crc_key24;
>  break;
>
>  case 32:
> -params->lb.f_hash = hash_default_key32;
> +params->lb.f_hash = rte_table_hash_crc_key32;
>  break;
>
>  case 40:
> -params->lb.f_hash = hash_default_key40;
> +params->lb.f_hash = rte_table_hash_crc_key40;
>  break;
>
>  case 48:
> -params->lb.f_hash = hash_default_key48;
> +params->lb.f_hash = rte_table_hash_crc_key48;
>  break;
>
>  case 56:
> -params->lb.f_hash = hash_default_key56;
> +params->lb.f_hash = rte_table_hash_crc_key56;
>  break;
>
>  case 64:
> -params->lb.f_hash = hash_default_key64;
> +params->lb.f_hash = rte_table_hash_crc_key64;
>  break;
>
>  default:
> diff --git a/examples/ip_pipeline/hash_func.h
> b/examples/ip_pipeline/hash_func.h
> deleted file mode 100644
> index f1b9d94..0000000
> --- a/examples/ip_pipeline/hash_func.h
> +++ /dev/null
> @@ -1,357 +0,0 @@
> -/* SPDX-License-Identifier: BSD-3-Clause
> - * Copyright(c) 2010-2018 Intel Corporation
> - */
> -
> -#ifndef __INCLUDE_HASH_FUNC_H__
> -#define __INCLUDE_HASH_FUNC_H__
> -
> -static inline uint64_t
> -hash_xor_key8(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0;
> -
> -xor0 = seed ^ (k[0] & m[0]);
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -static inline uint64_t
> -hash_xor_key16(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0;
> -
> -xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -static inline uint64_t
> -hash_xor_key24(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0;
> -
> -xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
> -
> -xor0 ^= k[2] & m[2];
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -static inline uint64_t
> -hash_xor_key32(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0, xor1;
> -
> -xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
> -xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
> -
> -xor0 ^= xor1;
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -static inline uint64_t
> -hash_xor_key40(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0, xor1;
> -
> -xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
> -xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
> -
> -xor0 ^= xor1;
> -
> -xor0 ^= k[4] & m[4];
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -static inline uint64_t
> -hash_xor_key48(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0, xor1, xor2;
> -
> -xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
> -xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
> -xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
> -
> -xor0 ^= xor1;
> -
> -xor0 ^= xor2;
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -static inline uint64_t
> -hash_xor_key56(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0, xor1, xor2;
> -
> -xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
> -xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
> -xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
> -
> -xor0 ^= xor1;
> -xor2 ^= k[6] & m[6];
> -
> -xor0 ^= xor2;
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -static inline uint64_t
> -hash_xor_key64(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t xor0, xor1, xor2, xor3;
> -
> -xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
> -xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
> -xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
> -xor3 = (k[6] & m[6]) ^ (k[7] & m[7]);
> -
> -xor0 ^= xor1;
> -xor2 ^= xor3;
> -
> -xor0 ^= xor2;
> -
> -return (xor0 >> 32) ^ xor0;
> -}
> -
> -#if defined(RTE_ARCH_X86_64)
> -
> -#include <x86intrin.h>
> -
> -static inline uint64_t
> -hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t crc0;
> -
> -crc0 = _mm_crc32_u64(seed, k[0] & m[0]);
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t k0, crc0, crc1;
> -
> -k0 = k[0] & m[0];
> -
> -crc0 = _mm_crc32_u64(k0, seed);
> -crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t k0, k2, crc0, crc1;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -
> -crc0 = _mm_crc32_u64(k0, seed);
> -crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
> -
> -crc0 = _mm_crc32_u64(crc0, k2);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t k0, k2, crc0, crc1, crc2, crc3;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -
> -crc0 = _mm_crc32_u64(k0, seed);
> -crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
> -
> -crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
> -crc3 = k2 >> 32;
> -
> -crc0 = _mm_crc32_u64(crc0, crc1);
> -crc1 = _mm_crc32_u64(crc2, crc3);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t k0, k2, crc0, crc1, crc2, crc3;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -
> -crc0 = _mm_crc32_u64(k0, seed);
> -crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
> -
> -crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
> -crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
> -
> -crc0 = _mm_crc32_u64(crc0, crc1);
> -crc1 = _mm_crc32_u64(crc2, crc3);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t k0, k2, k5, crc0, crc1, crc2, crc3;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -k5 = k[5] & m[5];
> -
> -crc0 = _mm_crc32_u64(k0, seed);
> -crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
> -
> -crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
> -crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
> -
> -crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
> -crc1 = _mm_crc32_u64(crc3, k5);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -k5 = k[5] & m[5];
> -
> -crc0 = _mm_crc32_u64(k0, seed);
> -crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
> -
> -crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
> -crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
> -
> -crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
> -crc5 = k5 >> 32;
> -
> -crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
> -crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -k5 = k[5] & m[5];
> -
> -crc0 = _mm_crc32_u64(k0, seed);
> -crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
> -
> -crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
> -crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
> -
> -crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
> -crc5 = _mm_crc32_u64(k5 >> 32, k[7] & m[7]);
> -
> -crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
> -crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -#define hash_default_key8hash_crc_key8
> -#define hash_default_key16hash_crc_key16
> -#define hash_default_key24hash_crc_key24
> -#define hash_default_key32hash_crc_key32
> -#define hash_default_key40hash_crc_key40
> -#define hash_default_key48hash_crc_key48
> -#define hash_default_key56hash_crc_key56
> -#define hash_default_key64hash_crc_key64
> -
> -#elif defined(RTE_ARCH_ARM64)
> -#include "hash_func_arm64.h"
> -#else
> -
> -#define hash_default_key8hash_xor_key8
> -#define hash_default_key16hash_xor_key16
> -#define hash_default_key24hash_xor_key24
> -#define hash_default_key32hash_xor_key32
> -#define hash_default_key40hash_xor_key40
> -#define hash_default_key48hash_xor_key48
> -#define hash_default_key56hash_xor_key56
> -#define hash_default_key64hash_xor_key64
> -
> -#endif
> -
> -#endif
> diff --git a/examples/ip_pipeline/hash_func_arm64.h
> b/examples/ip_pipeline/hash_func_arm64.h
> deleted file mode 100644
> index 50df816..0000000
> --- a/examples/ip_pipeline/hash_func_arm64.h
> +++ /dev/null
> @@ -1,232 +0,0 @@
> -/* SPDX-License-Identifier: BSD-3-Clause
> - * Copyright(c) 2017-2018 Linaro Limited.
> - */
> -#ifndef __HASH_FUNC_ARM64_H__
> -#define __HASH_FUNC_ARM64_H__
> -
> -#define _CRC32CX(crc, val)\
> -__asm__("crc32cx %w[c], %w[c], %x[v]":[c] "+r" (crc):[v] "r" (val))
> -
> -static inline uint64_t
> -hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key;
> -uint64_t *m = mask;
> -uint32_t crc0;
> -
> -crc0 = seed;
> -_CRC32CX(crc0, k[0] & m[0]);
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key, k0;
> -uint64_t *m = mask;
> -uint32_t crc0, crc1;
> -
> -k0 = k[0] & m[0];
> -
> -crc0 = k0;
> -_CRC32CX(crc0, seed);
> -crc1 = k0 >> 32;
> -_CRC32CX(crc1, k[1] & m[1]);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key, k0, k2;
> -uint64_t *m = mask;
> -uint32_t crc0, crc1;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -
> -crc0 = k0;
> -_CRC32CX(crc0, seed);
> -crc1 = k0 >> 32;
> -_CRC32CX(crc1, k[1] & m[1]);
> -
> -_CRC32CX(crc0, k2);
> -
> -crc0 ^= crc1;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key, k0, k2;
> -uint64_t *m = mask;
> -uint32_t crc0, crc1, crc2, crc3;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -
> -crc0 = k0;
> -_CRC32CX(crc0, seed);
> -crc1 = k0 >> 32;
> -_CRC32CX(crc1, k[1] & m[1]);
> -
> -crc2 = k2;
> -_CRC32CX(crc2, k[3] & m[3]);
> -crc3 = k2 >> 32;
> -
> -_CRC32CX(crc0, crc1);
> -_CRC32CX(crc2, crc3);
> -
> -crc0 ^= crc2;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key, k0, k2;
> -uint64_t *m = mask;
> -uint32_t crc0, crc1, crc2, crc3;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -
> -crc0 = k0;
> -_CRC32CX(crc0, seed);
> -crc1 = k0 >> 32;
> -_CRC32CX(crc1, k[1] & m[1]);
> -
> -crc2 = k2;
> -_CRC32CX(crc2, k[3] & m[3]);
> -crc3 = k2 >> 32;
> -_CRC32CX(crc3, k[4] & m[4]);
> -
> -_CRC32CX(crc0, crc1);
> -_CRC32CX(crc2, crc3);
> -
> -crc0 ^= crc2;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key, k0, k2, k5;
> -uint64_t *m = mask;
> -uint32_t crc0, crc1, crc2, crc3;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -k5 = k[5] & m[5];
> -
> -crc0 = k0;
> -_CRC32CX(crc0, seed);
> -crc1 = k0 >> 32;
> -_CRC32CX(crc1, k[1] & m[1]);
> -
> -crc2 = k2;
> -_CRC32CX(crc2, k[3] & m[3]);
> -crc3 = k2 >> 32;
> -_CRC32CX(crc3, k[4] & m[4]);
> -
> -_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
> -_CRC32CX(crc3, k5);
> -
> -crc0 ^= crc3;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key, k0, k2, k5;
> -uint64_t *m = mask;
> -uint32_t crc0, crc1, crc2, crc3, crc4, crc5;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -k5 = k[5] & m[5];
> -
> -crc0 = k0;
> -_CRC32CX(crc0, seed);
> -crc1 = k0 >> 32;
> -_CRC32CX(crc1, k[1] & m[1]);
> -
> -crc2 = k2;
> -_CRC32CX(crc2, k[3] & m[3]);
> -crc3 = k2 >> 32;
> -_CRC32CX(crc3, k[4] & m[4]);
> -
> -crc4 = k5;
> - _CRC32CX(crc4, k[6] & m[6]);
> -crc5 = k5 >> 32;
> -
> -_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
> -_CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5);
> -
> -crc0 ^= crc3;
> -
> -return crc0;
> -}
> -
> -static inline uint64_t
> -hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size,
> -uint64_t seed)
> -{
> -uint64_t *k = key, k0, k2, k5;
> -uint64_t *m = mask;
> -uint32_t crc0, crc1, crc2, crc3, crc4, crc5;
> -
> -k0 = k[0] & m[0];
> -k2 = k[2] & m[2];
> -k5 = k[5] & m[5];
> -
> -crc0 = k0;
> -_CRC32CX(crc0, seed);
> -crc1 = k0 >> 32;
> -_CRC32CX(crc1, k[1] & m[1]);
> -
> -crc2 = k2;
> -_CRC32CX(crc2, k[3] & m[3]);
> -crc3 = k2 >> 32;
> -_CRC32CX(crc3, k[4] & m[4]);
> -
> -crc4 = k5;
> - _CRC32CX(crc4, k[6] & m[6]);
> -crc5 = k5 >> 32;
> -_CRC32CX(crc5, k[7] & m[7]);
> -
> -_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
> -_CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5);
> -
> -crc0 ^= crc3;
> -
> -return crc0;
> -}
> -
> -#define hash_default_key8hash_crc_key8
> -#define hash_default_key16hash_crc_key16
> -#define hash_default_key24hash_crc_key24
> -#define hash_default_key32hash_crc_key32
> -#define hash_default_key40hash_crc_key40
> -#define hash_default_key48hash_crc_key48
> -#define hash_default_key56hash_crc_key56
> -#define hash_default_key64hash_crc_key64
> -
> -#endif
> diff --git a/examples/ip_pipeline/pipeline.c
> b/examples/ip_pipeline/pipeline.c index 43fe867..b2fd215 100644
> --- a/examples/ip_pipeline/pipeline.c
> +++ b/examples/ip_pipeline/pipeline.c
> @@ -22,6 +22,7 @@
>  #include <rte_table_acl.h>
>  #include <rte_table_array.h>
>  #include <rte_table_hash.h>
> +#include <rte_table_hash_func.h>
>  #include <rte_table_lpm.h>
>  #include <rte_table_lpm_ipv6.h>
>  #include <rte_table_stub.h>
> @@ -36,8 +37,6 @@
>  #include "tmgr.h"
>  #include "swq.h"
>
> -#include "hash_func.h"
> -
>  #ifndef PIPELINE_MSGQ_SIZE
>  #define PIPELINE_MSGQ_SIZE                                 64
>  #endif
> @@ -818,28 +817,28 @@ pipeline_table_create(const char *pipeline_name,
>
>  switch (params->match.hash.key_size) {
>  case  8:
> -f_hash = hash_default_key8;
> +f_hash = rte_table_hash_crc_key8;
>  break;
>  case 16:
> -f_hash = hash_default_key16;
> +f_hash = rte_table_hash_crc_key16;
>  break;
>  case 24:
> -f_hash = hash_default_key24;
> +f_hash = rte_table_hash_crc_key24;
>  break;
>  case 32:
> -f_hash = hash_default_key32;
> +f_hash = rte_table_hash_crc_key32;
>  break;
>  case 40:
> -f_hash = hash_default_key40;
> +f_hash = rte_table_hash_crc_key40;
>  break;
>  case 48:
> -f_hash = hash_default_key48;
> +f_hash = rte_table_hash_crc_key48;
>  break;
>  case 56:
> -f_hash = hash_default_key56;
> +f_hash = rte_table_hash_crc_key56;
>  break;
>  case 64:
> -f_hash = hash_default_key64;
> +f_hash = rte_table_hash_crc_key64;
>  break;
>  default:
>  return -1;
> --
> 2.9.5

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
  

Patch

diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
index a29c2b3..20497c3 100644
--- a/examples/ip_pipeline/action.c
+++ b/examples/ip_pipeline/action.c
@@ -7,9 +7,9 @@ 
 #include <string.h>
 
 #include <rte_string_fns.h>
+#include <rte_table_hash_func.h>
 
 #include "action.h"
-#include "hash_func.h"
 
 /**
  * Input port
@@ -57,35 +57,35 @@  port_in_action_profile_create(const char *name,
 		(params->lb.f_hash == NULL)) {
 		switch (params->lb.key_size) {
 		case  8:
-			params->lb.f_hash = hash_default_key8;
+			params->lb.f_hash = rte_table_hash_crc_key8;
 			break;
 
 		case 16:
-			params->lb.f_hash = hash_default_key16;
+			params->lb.f_hash = rte_table_hash_crc_key16;
 			break;
 
 		case 24:
-			params->lb.f_hash = hash_default_key24;
+			params->lb.f_hash = rte_table_hash_crc_key24;
 			break;
 
 		case 32:
-			params->lb.f_hash = hash_default_key32;
+			params->lb.f_hash = rte_table_hash_crc_key32;
 			break;
 
 		case 40:
-			params->lb.f_hash = hash_default_key40;
+			params->lb.f_hash = rte_table_hash_crc_key40;
 			break;
 
 		case 48:
-			params->lb.f_hash = hash_default_key48;
+			params->lb.f_hash = rte_table_hash_crc_key48;
 			break;
 
 		case 56:
-			params->lb.f_hash = hash_default_key56;
+			params->lb.f_hash = rte_table_hash_crc_key56;
 			break;
 
 		case 64:
-			params->lb.f_hash = hash_default_key64;
+			params->lb.f_hash = rte_table_hash_crc_key64;
 			break;
 
 		default:
@@ -192,35 +192,35 @@  table_action_profile_create(const char *name,
 		(params->lb.f_hash == NULL)) {
 		switch (params->lb.key_size) {
 		case 8:
-			params->lb.f_hash = hash_default_key8;
+			params->lb.f_hash = rte_table_hash_crc_key8;
 			break;
 
 		case 16:
-			params->lb.f_hash = hash_default_key16;
+			params->lb.f_hash = rte_table_hash_crc_key16;
 			break;
 
 		case 24:
-			params->lb.f_hash = hash_default_key24;
+			params->lb.f_hash = rte_table_hash_crc_key24;
 			break;
 
 		case 32:
-			params->lb.f_hash = hash_default_key32;
+			params->lb.f_hash = rte_table_hash_crc_key32;
 			break;
 
 		case 40:
-			params->lb.f_hash = hash_default_key40;
+			params->lb.f_hash = rte_table_hash_crc_key40;
 			break;
 
 		case 48:
-			params->lb.f_hash = hash_default_key48;
+			params->lb.f_hash = rte_table_hash_crc_key48;
 			break;
 
 		case 56:
-			params->lb.f_hash = hash_default_key56;
+			params->lb.f_hash = rte_table_hash_crc_key56;
 			break;
 
 		case 64:
-			params->lb.f_hash = hash_default_key64;
+			params->lb.f_hash = rte_table_hash_crc_key64;
 			break;
 
 		default:
diff --git a/examples/ip_pipeline/hash_func.h b/examples/ip_pipeline/hash_func.h
deleted file mode 100644
index f1b9d94..0000000
--- a/examples/ip_pipeline/hash_func.h
+++ /dev/null
@@ -1,357 +0,0 @@ 
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2018 Intel Corporation
- */
-
-#ifndef __INCLUDE_HASH_FUNC_H__
-#define __INCLUDE_HASH_FUNC_H__
-
-static inline uint64_t
-hash_xor_key8(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0;
-
-	xor0 = seed ^ (k[0] & m[0]);
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-static inline uint64_t
-hash_xor_key16(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0;
-
-	xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-static inline uint64_t
-hash_xor_key24(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0;
-
-	xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
-
-	xor0 ^= k[2] & m[2];
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-static inline uint64_t
-hash_xor_key32(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0, xor1;
-
-	xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
-	xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
-
-	xor0 ^= xor1;
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-static inline uint64_t
-hash_xor_key40(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0, xor1;
-
-	xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
-	xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
-
-	xor0 ^= xor1;
-
-	xor0 ^= k[4] & m[4];
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-static inline uint64_t
-hash_xor_key48(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0, xor1, xor2;
-
-	xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
-	xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
-	xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
-
-	xor0 ^= xor1;
-
-	xor0 ^= xor2;
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-static inline uint64_t
-hash_xor_key56(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0, xor1, xor2;
-
-	xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
-	xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
-	xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
-
-	xor0 ^= xor1;
-	xor2 ^= k[6] & m[6];
-
-	xor0 ^= xor2;
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-static inline uint64_t
-hash_xor_key64(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t xor0, xor1, xor2, xor3;
-
-	xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
-	xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
-	xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
-	xor3 = (k[6] & m[6]) ^ (k[7] & m[7]);
-
-	xor0 ^= xor1;
-	xor2 ^= xor3;
-
-	xor0 ^= xor2;
-
-	return (xor0 >> 32) ^ xor0;
-}
-
-#if defined(RTE_ARCH_X86_64)
-
-#include <x86intrin.h>
-
-static inline uint64_t
-hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t crc0;
-
-	crc0 = _mm_crc32_u64(seed, k[0] & m[0]);
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t k0, crc0, crc1;
-
-	k0 = k[0] & m[0];
-
-	crc0 = _mm_crc32_u64(k0, seed);
-	crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t k0, k2, crc0, crc1;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-
-	crc0 = _mm_crc32_u64(k0, seed);
-	crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
-
-	crc0 = _mm_crc32_u64(crc0, k2);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t k0, k2, crc0, crc1, crc2, crc3;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-
-	crc0 = _mm_crc32_u64(k0, seed);
-	crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
-
-	crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
-	crc3 = k2 >> 32;
-
-	crc0 = _mm_crc32_u64(crc0, crc1);
-	crc1 = _mm_crc32_u64(crc2, crc3);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t k0, k2, crc0, crc1, crc2, crc3;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-
-	crc0 = _mm_crc32_u64(k0, seed);
-	crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
-
-	crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
-	crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
-
-	crc0 = _mm_crc32_u64(crc0, crc1);
-	crc1 = _mm_crc32_u64(crc2, crc3);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t k0, k2, k5, crc0, crc1, crc2, crc3;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-	k5 = k[5] & m[5];
-
-	crc0 = _mm_crc32_u64(k0, seed);
-	crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
-
-	crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
-	crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
-
-	crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
-	crc1 = _mm_crc32_u64(crc3, k5);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-	k5 = k[5] & m[5];
-
-	crc0 = _mm_crc32_u64(k0, seed);
-	crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
-
-	crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
-	crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
-
-	crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
-	crc5 = k5 >> 32;
-
-	crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
-	crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-	k5 = k[5] & m[5];
-
-	crc0 = _mm_crc32_u64(k0, seed);
-	crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
-
-	crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
-	crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
-
-	crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
-	crc5 = _mm_crc32_u64(k5 >> 32, k[7] & m[7]);
-
-	crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
-	crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-#define hash_default_key8			hash_crc_key8
-#define hash_default_key16			hash_crc_key16
-#define hash_default_key24			hash_crc_key24
-#define hash_default_key32			hash_crc_key32
-#define hash_default_key40			hash_crc_key40
-#define hash_default_key48			hash_crc_key48
-#define hash_default_key56			hash_crc_key56
-#define hash_default_key64			hash_crc_key64
-
-#elif defined(RTE_ARCH_ARM64)
-#include "hash_func_arm64.h"
-#else
-
-#define hash_default_key8			hash_xor_key8
-#define hash_default_key16			hash_xor_key16
-#define hash_default_key24			hash_xor_key24
-#define hash_default_key32			hash_xor_key32
-#define hash_default_key40			hash_xor_key40
-#define hash_default_key48			hash_xor_key48
-#define hash_default_key56			hash_xor_key56
-#define hash_default_key64			hash_xor_key64
-
-#endif
-
-#endif
diff --git a/examples/ip_pipeline/hash_func_arm64.h b/examples/ip_pipeline/hash_func_arm64.h
deleted file mode 100644
index 50df816..0000000
--- a/examples/ip_pipeline/hash_func_arm64.h
+++ /dev/null
@@ -1,232 +0,0 @@ 
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017-2018 Linaro Limited.
- */
-#ifndef __HASH_FUNC_ARM64_H__
-#define __HASH_FUNC_ARM64_H__
-
-#define _CRC32CX(crc, val)	\
-	__asm__("crc32cx %w[c], %w[c], %x[v]":[c] "+r" (crc):[v] "r" (val))
-
-static inline uint64_t
-hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key;
-	uint64_t *m = mask;
-	uint32_t crc0;
-
-	crc0 = seed;
-	_CRC32CX(crc0, k[0] & m[0]);
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key, k0;
-	uint64_t *m = mask;
-	uint32_t crc0, crc1;
-
-	k0 = k[0] & m[0];
-
-	crc0 = k0;
-	_CRC32CX(crc0, seed);
-	crc1 = k0 >> 32;
-	_CRC32CX(crc1, k[1] & m[1]);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key, k0, k2;
-	uint64_t *m = mask;
-	uint32_t crc0, crc1;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-
-	crc0 = k0;
-	_CRC32CX(crc0, seed);
-	crc1 = k0 >> 32;
-	_CRC32CX(crc1, k[1] & m[1]);
-
-	_CRC32CX(crc0, k2);
-
-	crc0 ^= crc1;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key, k0, k2;
-	uint64_t *m = mask;
-	uint32_t crc0, crc1, crc2, crc3;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-
-	crc0 = k0;
-	_CRC32CX(crc0, seed);
-	crc1 = k0 >> 32;
-	_CRC32CX(crc1, k[1] & m[1]);
-
-	crc2 = k2;
-	_CRC32CX(crc2, k[3] & m[3]);
-	crc3 = k2 >> 32;
-
-	_CRC32CX(crc0, crc1);
-	_CRC32CX(crc2, crc3);
-
-	crc0 ^= crc2;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key, k0, k2;
-	uint64_t *m = mask;
-	uint32_t crc0, crc1, crc2, crc3;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-
-	crc0 = k0;
-	_CRC32CX(crc0, seed);
-	crc1 = k0 >> 32;
-	_CRC32CX(crc1, k[1] & m[1]);
-
-	crc2 = k2;
-	_CRC32CX(crc2, k[3] & m[3]);
-	crc3 = k2 >> 32;
-	_CRC32CX(crc3, k[4] & m[4]);
-
-	_CRC32CX(crc0, crc1);
-	_CRC32CX(crc2, crc3);
-
-	crc0 ^= crc2;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key, k0, k2, k5;
-	uint64_t *m = mask;
-	uint32_t crc0, crc1, crc2, crc3;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-	k5 = k[5] & m[5];
-
-	crc0 = k0;
-	_CRC32CX(crc0, seed);
-	crc1 = k0 >> 32;
-	_CRC32CX(crc1, k[1] & m[1]);
-
-	crc2 = k2;
-	_CRC32CX(crc2, k[3] & m[3]);
-	crc3 = k2 >> 32;
-	_CRC32CX(crc3, k[4] & m[4]);
-
-	_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
-	_CRC32CX(crc3, k5);
-
-	crc0 ^= crc3;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key, k0, k2, k5;
-	uint64_t *m = mask;
-	uint32_t crc0, crc1, crc2, crc3, crc4, crc5;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-	k5 = k[5] & m[5];
-
-	crc0 = k0;
-	_CRC32CX(crc0, seed);
-	crc1 = k0 >> 32;
-	_CRC32CX(crc1, k[1] & m[1]);
-
-	crc2 = k2;
-	_CRC32CX(crc2, k[3] & m[3]);
-	crc3 = k2 >> 32;
-	_CRC32CX(crc3, k[4] & m[4]);
-
-	crc4 = k5;
-	 _CRC32CX(crc4, k[6] & m[6]);
-	crc5 = k5 >> 32;
-
-	_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
-	_CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5);
-
-	crc0 ^= crc3;
-
-	return crc0;
-}
-
-static inline uint64_t
-hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size,
-	uint64_t seed)
-{
-	uint64_t *k = key, k0, k2, k5;
-	uint64_t *m = mask;
-	uint32_t crc0, crc1, crc2, crc3, crc4, crc5;
-
-	k0 = k[0] & m[0];
-	k2 = k[2] & m[2];
-	k5 = k[5] & m[5];
-
-	crc0 = k0;
-	_CRC32CX(crc0, seed);
-	crc1 = k0 >> 32;
-	_CRC32CX(crc1, k[1] & m[1]);
-
-	crc2 = k2;
-	_CRC32CX(crc2, k[3] & m[3]);
-	crc3 = k2 >> 32;
-	_CRC32CX(crc3, k[4] & m[4]);
-
-	crc4 = k5;
-	 _CRC32CX(crc4, k[6] & m[6]);
-	crc5 = k5 >> 32;
-	_CRC32CX(crc5, k[7] & m[7]);
-
-	_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
-	_CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5);
-
-	crc0 ^= crc3;
-
-	return crc0;
-}
-
-#define hash_default_key8			hash_crc_key8
-#define hash_default_key16			hash_crc_key16
-#define hash_default_key24			hash_crc_key24
-#define hash_default_key32			hash_crc_key32
-#define hash_default_key40			hash_crc_key40
-#define hash_default_key48			hash_crc_key48
-#define hash_default_key56			hash_crc_key56
-#define hash_default_key64			hash_crc_key64
-
-#endif
diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c
index 43fe867..b2fd215 100644
--- a/examples/ip_pipeline/pipeline.c
+++ b/examples/ip_pipeline/pipeline.c
@@ -22,6 +22,7 @@ 
 #include <rte_table_acl.h>
 #include <rte_table_array.h>
 #include <rte_table_hash.h>
+#include <rte_table_hash_func.h>
 #include <rte_table_lpm.h>
 #include <rte_table_lpm_ipv6.h>
 #include <rte_table_stub.h>
@@ -36,8 +37,6 @@ 
 #include "tmgr.h"
 #include "swq.h"
 
-#include "hash_func.h"
-
 #ifndef PIPELINE_MSGQ_SIZE
 #define PIPELINE_MSGQ_SIZE                                 64
 #endif
@@ -818,28 +817,28 @@  pipeline_table_create(const char *pipeline_name,
 
 		switch (params->match.hash.key_size) {
 		case  8:
-			f_hash = hash_default_key8;
+			f_hash = rte_table_hash_crc_key8;
 			break;
 		case 16:
-			f_hash = hash_default_key16;
+			f_hash = rte_table_hash_crc_key16;
 			break;
 		case 24:
-			f_hash = hash_default_key24;
+			f_hash = rte_table_hash_crc_key24;
 			break;
 		case 32:
-			f_hash = hash_default_key32;
+			f_hash = rte_table_hash_crc_key32;
 			break;
 		case 40:
-			f_hash = hash_default_key40;
+			f_hash = rte_table_hash_crc_key40;
 			break;
 		case 48:
-			f_hash = hash_default_key48;
+			f_hash = rte_table_hash_crc_key48;
 			break;
 		case 56:
-			f_hash = hash_default_key56;
+			f_hash = rte_table_hash_crc_key56;
 			break;
 		case 64:
-			f_hash = hash_default_key64;
+			f_hash = rte_table_hash_crc_key64;
 			break;
 		default:
 			return -1;