]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/examples/l3fwd/l3fwd_em_hlm_sse.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / dpdk / examples / l3fwd / l3fwd_em_hlm_sse.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 Intel Corporation
3 */
4
5 #ifndef __L3FWD_EM_HLM_SSE_H__
6 #define __L3FWD_EM_HLM_SSE_H__
7
8 #include "l3fwd_sse.h"
9
10 static __rte_always_inline void
11 get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0,
12 union ipv4_5tuple_host *key)
13 {
14 __m128i tmpdata0 = _mm_loadu_si128(
15 rte_pktmbuf_mtod_offset(m0, __m128i *,
16 sizeof(struct ether_hdr) +
17 offsetof(struct ipv4_hdr, time_to_live)));
18
19 key->xmm = _mm_and_si128(tmpdata0, mask0);
20 }
21
22 static inline void
23 get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0,
24 __m128i mask1, union ipv6_5tuple_host *key)
25 {
26 __m128i tmpdata0 = _mm_loadu_si128(
27 rte_pktmbuf_mtod_offset(m0, __m128i *,
28 sizeof(struct ether_hdr) +
29 offsetof(struct ipv6_hdr, payload_len)));
30
31 __m128i tmpdata1 = _mm_loadu_si128(
32 rte_pktmbuf_mtod_offset(m0, __m128i *,
33 sizeof(struct ether_hdr) +
34 offsetof(struct ipv6_hdr, payload_len) +
35 sizeof(__m128i)));
36
37 __m128i tmpdata2 = _mm_loadu_si128(
38 rte_pktmbuf_mtod_offset(m0, __m128i *,
39 sizeof(struct ether_hdr) +
40 offsetof(struct ipv6_hdr, payload_len) +
41 sizeof(__m128i) + sizeof(__m128i)));
42
43 key->xmm[0] = _mm_and_si128(tmpdata0, mask0);
44 key->xmm[1] = tmpdata1;
45 key->xmm[2] = _mm_and_si128(tmpdata2, mask1);
46 }
47 #endif /* __L3FWD_EM_SSE_HLM_H__ */