6 #ifndef _RTE_LPM_NEON_H_
7 #define _RTE_LPM_NEON_H_
25 uint64_t idx, pt, pt2;
28 const uint32_t mask = UINT8_MAX;
29 const int32x4_t mask8 = vdupq_n_s32(mask);
35 const uint64_t mask_xv =
36 ((uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK |
37 (uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 32);
43 const uint64_t mask_v =
48 i24 = vshrq_n_u32((uint32x4_t)ip, CHAR_BIT);
51 idx = vgetq_lane_u64((uint64x2_t)i24, 0);
53 ptbl = (
const uint32_t *)&lpm->tbl24[(uint32_t)idx];
55 ptbl = (
const uint32_t *)&lpm->tbl24[idx >> 32];
58 idx = vgetq_lane_u64((uint64x2_t)i24, 1);
60 ptbl = (
const uint32_t *)&lpm->tbl24[(uint32_t)idx];
62 ptbl = (
const uint32_t *)&lpm->tbl24[idx >> 32];
66 i8.x = vandq_s32(ip, mask8);
68 pt = (uint64_t)tbl[0] |
69 (uint64_t)tbl[1] << 32;
70 pt2 = (uint64_t)tbl[2] |
71 (uint64_t)tbl[3] << 32;
74 if (
likely((pt & mask_xv) == mask_v) &&
75 likely((pt2 & mask_xv) == mask_v)) {
76 *(uint64_t *)hop = pt & RTE_LPM_MASKX4_RES;
77 *(uint64_t *)(hop + 2) = pt2 & RTE_LPM_MASKX4_RES;
81 if (
unlikely((pt & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
82 RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
83 i8.u32[0] = i8.u32[0] +
84 (uint8_t)tbl[0] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
85 ptbl = (
const uint32_t *)&lpm->tbl8[i8.u32[0]];
88 if (
unlikely((pt >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
89 RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
90 i8.u32[1] = i8.u32[1] +
91 (uint8_t)tbl[1] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
92 ptbl = (
const uint32_t *)&lpm->tbl8[i8.u32[1]];
95 if (
unlikely((pt2 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
96 RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
97 i8.u32[2] = i8.u32[2] +
98 (uint8_t)tbl[2] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
99 ptbl = (
const uint32_t *)&lpm->tbl8[i8.u32[2]];
102 if (
unlikely((pt2 >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
103 RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
104 i8.u32[3] = i8.u32[3] +
105 (uint8_t)tbl[3] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;
106 ptbl = (
const uint32_t *)&lpm->tbl8[i8.u32[3]];
static void rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], uint32_t defv)
#define RTE_LPM_LOOKUP_SUCCESS