DPDK 22.11.7
rte_efd_arm64.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Cavium, Inc
3 */
4
5/*
6 * rte_efd_arm64.h
7 * This file holds all arm64 specific EFD functions
8 */
9
10#ifndef __RTE_EFD_ARM64_H__
11#define __RTE_EFD_ARM64_H__
12
13#include <rte_vect.h>
14
15static inline efd_value_t
16efd_lookup_internal_neon(const efd_hashfunc_t *group_hash_idx,
17 const efd_lookuptbl_t *group_lookup_table,
18 const uint32_t hash_val_a, const uint32_t hash_val_b)
19{
20 efd_value_t value = 0;
21 uint32_t i = 0;
22 uint32x4_t vhash_val_a = vmovq_n_u32(hash_val_a);
23 uint32x4_t vhash_val_b = vmovq_n_u32(hash_val_b);
24 int32x4_t vshift = {0, 1, 2, 3};
25 uint32x4_t vmask = vdupq_n_u32(0x1);
26 int32x4_t vincr = vdupq_n_s32(4);
27
28 for (; i < RTE_EFD_VALUE_NUM_BITS; i += 4) {
29 uint32x4_t vhash_idx = vshll_n_u16(
30 vld1_u16((uint16_t const *)&group_hash_idx[i]), 0);
31 uint32x4_t vlookup_table = vshll_n_u16(
32 vld1_u16((uint16_t const *)&group_lookup_table[i]), 0);
33 uint32x4_t vhash = vaddq_u32(vhash_val_a,
34 vmulq_u32(vhash_idx, vhash_val_b));
35 int32x4_t vbucket_idx = vnegq_s32(vreinterpretq_s32_u32(
36 vshrq_n_u32(vhash, EFD_LOOKUPTBL_SHIFT)));
37 uint32x4_t vresult = vshlq_u32(vlookup_table, vbucket_idx);
38
39 vresult = vandq_u32(vresult, vmask);
40 vresult = vshlq_u32(vresult, vshift);
41 value |= vaddvq_u32(vresult);
42 vshift = vaddq_s32(vshift, vincr);
43 }
44
45 return value;
46}
47
48#endif /* __RTE_EFD_ARM64_H__ */
#define RTE_EFD_VALUE_NUM_BITS
Definition: rte_efd.h:65