1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (C) 2020 Marvell International Ltd.
4 #ifndef _IPSEC_SECGW_H_
5 #define _IPSEC_SECGW_H_
11 #define MAX_PKT_BURST 32
13 #define RTE_LOGTYPE_IPSEC RTE_LOGTYPE_USER1
15 #if RTE_BYTE_ORDER != RTE_LITTLE_ENDIAN
16 #define __BYTES_TO_UINT64(a, b, c, d, e, f, g, h) \
17 (((uint64_t)((a) & 0xff) << 56) | \
18 ((uint64_t)((b) & 0xff) << 48) | \
19 ((uint64_t)((c) & 0xff) << 40) | \
20 ((uint64_t)((d) & 0xff) << 32) | \
21 ((uint64_t)((e) & 0xff) << 24) | \
22 ((uint64_t)((f) & 0xff) << 16) | \
23 ((uint64_t)((g) & 0xff) << 8) | \
24 ((uint64_t)(h) & 0xff))
26 #define __BYTES_TO_UINT64(a, b, c, d, e, f, g, h) \
27 (((uint64_t)((h) & 0xff) << 56) | \
28 ((uint64_t)((g) & 0xff) << 48) | \
29 ((uint64_t)((f) & 0xff) << 40) | \
30 ((uint64_t)((e) & 0xff) << 32) | \
31 ((uint64_t)((d) & 0xff) << 24) | \
32 ((uint64_t)((c) & 0xff) << 16) | \
33 ((uint64_t)((b) & 0xff) << 8) | \
34 ((uint64_t)(a) & 0xff))
37 #define ETHADDR(a, b, c, d, e, f) (__BYTES_TO_UINT64(a, b, c, d, e, f, 0, 0))
40 const uint8_t *data[MAX_PKT_BURST * 2];
41 struct rte_mbuf *pkts[MAX_PKT_BURST * 2];
42 void *saptr[MAX_PKT_BURST * 2];
43 uint32_t res[MAX_PKT_BURST * 2];
47 struct ipsec_traffic {
48 struct traffic_type ipsec;
49 struct traffic_type ip4;
50 struct traffic_type ip6;
53 /* Fields optimized for devices without burst */
54 struct traffic_type_nb {
61 struct ipsec_traffic_nb {
62 struct traffic_type_nb ipsec;
63 struct traffic_type_nb ip4;
64 struct traffic_type_nb ip6;
67 /* port/source ethernet addr and destination ethernet addr */
72 extern struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS];
74 /* Port mask to identify the unprotected ports */
75 extern uint32_t unprotected_port_mask;
77 /* Index of SA in single mode */
78 extern uint32_t single_sa_idx;
80 extern volatile bool force_quit;
83 is_unprotected_port(uint16_t port_id)
85 return unprotected_port_mask & (1 << port_id);
88 #endif /* _IPSEC_SECGW_H_ */