1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2018 Intel Corporation.
3 * Copyright(c) 2017-2018 Linaro Limited.
4 */
5
6 #ifndef __L3FWD_EM_HLM_NEON_H__
7 #define __L3FWD_EM_HLM_NEON_H__
8
9 #include <arm_neon.h>
10
11 static inline void
get_ipv4_5tuple(struct rte_mbuf * m0,int32x4_t mask0,union ipv4_5tuple_host * key)12 get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0,
13 union ipv4_5tuple_host *key)
14 {
15 int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *,
16 sizeof(struct rte_ether_hdr) +
17 offsetof(struct rte_ipv4_hdr, time_to_live)));
18
19 key->xmm = vandq_s32(tmpdata0, mask0);
20 }
21
22 static inline void
get_ipv6_5tuple(struct rte_mbuf * m0,int32x4_t mask0,int32x4_t mask1,union ipv6_5tuple_host * key)23 get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0,
24 int32x4_t mask1, union ipv6_5tuple_host *key)
25 {
26 int32x4_t tmpdata0 = vld1q_s32(
27 rte_pktmbuf_mtod_offset(m0, int *,
28 sizeof(struct rte_ether_hdr) +
29 offsetof(struct rte_ipv6_hdr, payload_len)));
30
31 int32x4_t tmpdata1 = vld1q_s32(
32 rte_pktmbuf_mtod_offset(m0, int *,
33 sizeof(struct rte_ether_hdr) +
34 offsetof(struct rte_ipv6_hdr, payload_len) + 8));
35
36 int32x4_t tmpdata2 = vld1q_s32(
37 rte_pktmbuf_mtod_offset(m0, int *,
38 sizeof(struct rte_ether_hdr) +
39 offsetof(struct rte_ipv6_hdr, payload_len) + 16));
40
41 key->xmm[0] = vandq_s32(tmpdata0, mask0);
42 key->xmm[1] = tmpdata1;
43 key->xmm[2] = vandq_s32(tmpdata2, mask1);
44 }
45 #endif /* __L3FWD_EM_HLM_NEON_H__ */
46