DPDK  19.11.14
rte_ipsec_sa.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4 
5 #ifndef _RTE_IPSEC_SA_H_
6 #define _RTE_IPSEC_SA_H_
7 
15 #include <rte_common.h>
16 #include <rte_cryptodev.h>
17 #include <rte_security.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
26 struct rte_ipsec_sa;
27 
32 
33  uint64_t userdata;
34  uint64_t flags;
39  union {
40  struct {
41  uint8_t hdr_len;
42  uint8_t hdr_l3_off;
43  uint8_t next_proto;
44  const void *hdr;
45  } tun;
46  struct {
47  uint8_t proto;
48  } trs;
49  };
50 };
51 
71 #define RTE_IPSEC_SAFLAG_SQN_ATOM (1ULL << 0)
72 
85 enum {
86  RTE_SATP_LOG2_IPV,
87  RTE_SATP_LOG2_PROTO,
88  RTE_SATP_LOG2_DIR,
89  RTE_SATP_LOG2_MODE,
90  RTE_SATP_LOG2_SQN = RTE_SATP_LOG2_MODE + 2,
91  RTE_SATP_LOG2_ESN,
92  RTE_SATP_LOG2_ECN,
93  RTE_SATP_LOG2_DSCP,
94  RTE_SATP_LOG2_NUM
95 };
96 
97 #define RTE_IPSEC_SATP_IPV_MASK (1ULL << RTE_SATP_LOG2_IPV)
98 #define RTE_IPSEC_SATP_IPV4 (0ULL << RTE_SATP_LOG2_IPV)
99 #define RTE_IPSEC_SATP_IPV6 (1ULL << RTE_SATP_LOG2_IPV)
100 
101 #define RTE_IPSEC_SATP_PROTO_MASK (1ULL << RTE_SATP_LOG2_PROTO)
102 #define RTE_IPSEC_SATP_PROTO_AH (0ULL << RTE_SATP_LOG2_PROTO)
103 #define RTE_IPSEC_SATP_PROTO_ESP (1ULL << RTE_SATP_LOG2_PROTO)
104 
105 #define RTE_IPSEC_SATP_DIR_MASK (1ULL << RTE_SATP_LOG2_DIR)
106 #define RTE_IPSEC_SATP_DIR_IB (0ULL << RTE_SATP_LOG2_DIR)
107 #define RTE_IPSEC_SATP_DIR_OB (1ULL << RTE_SATP_LOG2_DIR)
108 
109 #define RTE_IPSEC_SATP_MODE_MASK (3ULL << RTE_SATP_LOG2_MODE)
110 #define RTE_IPSEC_SATP_MODE_TRANS (0ULL << RTE_SATP_LOG2_MODE)
111 #define RTE_IPSEC_SATP_MODE_TUNLV4 (1ULL << RTE_SATP_LOG2_MODE)
112 #define RTE_IPSEC_SATP_MODE_TUNLV6 (2ULL << RTE_SATP_LOG2_MODE)
113 
114 #define RTE_IPSEC_SATP_SQN_MASK (1ULL << RTE_SATP_LOG2_SQN)
115 #define RTE_IPSEC_SATP_SQN_RAW (0ULL << RTE_SATP_LOG2_SQN)
116 #define RTE_IPSEC_SATP_SQN_ATOM (1ULL << RTE_SATP_LOG2_SQN)
117 
118 #define RTE_IPSEC_SATP_ESN_MASK (1ULL << RTE_SATP_LOG2_ESN)
119 #define RTE_IPSEC_SATP_ESN_DISABLE (0ULL << RTE_SATP_LOG2_ESN)
120 #define RTE_IPSEC_SATP_ESN_ENABLE (1ULL << RTE_SATP_LOG2_ESN)
121 
122 #define RTE_IPSEC_SATP_ECN_MASK (1ULL << RTE_SATP_LOG2_ECN)
123 #define RTE_IPSEC_SATP_ECN_DISABLE (0ULL << RTE_SATP_LOG2_ECN)
124 #define RTE_IPSEC_SATP_ECN_ENABLE (1ULL << RTE_SATP_LOG2_ECN)
125 
126 #define RTE_IPSEC_SATP_DSCP_MASK (1ULL << RTE_SATP_LOG2_DSCP)
127 #define RTE_IPSEC_SATP_DSCP_DISABLE (0ULL << RTE_SATP_LOG2_DSCP)
128 #define RTE_IPSEC_SATP_DSCP_ENABLE (1ULL << RTE_SATP_LOG2_DSCP)
129 
135 __rte_experimental
136 uint64_t
137 rte_ipsec_sa_type(const struct rte_ipsec_sa *sa);
138 
147 __rte_experimental
148 int
149 rte_ipsec_sa_size(const struct rte_ipsec_sa_prm *prm);
150 
164 __rte_experimental
165 int
166 rte_ipsec_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm,
167  uint32_t size);
168 
174 __rte_experimental
175 void
176 rte_ipsec_sa_fini(struct rte_ipsec_sa *sa);
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif /* _RTE_IPSEC_SA_H_ */
__rte_experimental uint64_t rte_ipsec_sa_type(const struct rte_ipsec_sa *sa)
const void * hdr
Definition: rte_ipsec_sa.h:44
struct rte_ipsec_sa_prm::@202::@204 tun
struct rte_crypto_sym_xform * crypto_xform
Definition: rte_ipsec_sa.h:38
__rte_experimental int rte_ipsec_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, uint32_t size)
struct rte_security_ipsec_xform ipsec_xform
Definition: rte_ipsec_sa.h:36
struct rte_ipsec_sa_prm::@202::@205 trs
__rte_experimental void rte_ipsec_sa_fini(struct rte_ipsec_sa *sa)
uint8_t next_proto
Definition: rte_ipsec_sa.h:43
uint64_t userdata
Definition: rte_ipsec_sa.h:33
uint8_t hdr_l3_off
Definition: rte_ipsec_sa.h:42
__rte_experimental int rte_ipsec_sa_size(const struct rte_ipsec_sa_prm *prm)