DPDK  24.11.0-rc3
rte_ipsec.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018-2020 Intel Corporation
3  */
4 
5 #ifndef _RTE_IPSEC_H_
6 #define _RTE_IPSEC_H_
7 
17 #include <rte_ipsec_sa.h>
18 #include <rte_mbuf.h>
19 
20 struct rte_ipsec_session;
21 
30  uint64_t sqn;
31 };
32 
45  union {
46  uint16_t (*async)(const struct rte_ipsec_session *ss,
47  struct rte_mbuf *mb[],
48  struct rte_crypto_op *cop[],
49  uint16_t num);
50  uint16_t (*sync)(const struct rte_ipsec_session *ss,
51  struct rte_mbuf *mb[],
52  uint16_t num);
53  } prepare;
54  union {
55  uint16_t (*async)(const struct rte_ipsec_session *ss,
56  struct rte_mbuf *mb[],
57  struct rte_crypto_op *cop[],
58  uint16_t num,
59  struct rte_ipsec_state *state);
60  uint16_t (*sync)(const struct rte_ipsec_session *ss,
61  struct rte_mbuf *mb[],
62  uint16_t num,
63  struct rte_ipsec_state *state);
64  } prepare_stateless;
65  uint16_t (*process)(const struct rte_ipsec_session *ss,
66  struct rte_mbuf *mb[],
67  uint16_t num);
68 };
69 
83  struct rte_ipsec_sa *sa;
87  union {
88  struct {
89  struct rte_cryptodev_sym_session *ses;
90  uint8_t dev_id;
91  } crypto;
92  struct {
93  struct rte_security_session *ses;
94  struct rte_security_ctx *ctx;
95  uint32_t ol_flags;
96  } security;
97  };
99  struct rte_ipsec_sa_pkt_func pkt_func;
100 };
101 
113 int
115 
137 static inline uint16_t
139  struct rte_mbuf *mb[], struct rte_crypto_op *cop[], uint16_t num)
140 {
141  return ss->pkt_func.prepare.async(ss, mb, cop, num);
142 }
143 
144 static inline uint16_t
145 rte_ipsec_pkt_cpu_prepare(const struct rte_ipsec_session *ss,
146  struct rte_mbuf *mb[], uint16_t num)
147 {
148  return ss->pkt_func.prepare.sync(ss, mb, num);
149 }
150 
178 __rte_experimental
179 static inline uint16_t
181  struct rte_mbuf *mb[], struct rte_crypto_op *cop[], uint16_t num,
182  struct rte_ipsec_state *state)
183 {
184  return ss->pkt_func.prepare_stateless.async(ss, mb, cop, num, state);
185 }
186 
203 __rte_experimental
204 static inline uint16_t
206  struct rte_mbuf *mb[], uint16_t num, struct rte_ipsec_state *state)
207 {
208  return ss->pkt_func.prepare_stateless.sync(ss, mb, num, state);
209 }
210 
234 static inline uint16_t
235 rte_ipsec_pkt_process(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
236  uint16_t num)
237 {
238  return ss->pkt_func.process(ss, mb, num);
239 }
240 
241 
250 int
251 rte_ipsec_telemetry_sa_add(const struct rte_ipsec_sa *sa);
252 
259 void
260 rte_ipsec_telemetry_sa_del(const struct rte_ipsec_sa *sa);
261 
262 #include <rte_ipsec_group.h>
263 
264 #ifdef __cplusplus
265 extern "C" {
266 #endif
267 
268 #ifdef __cplusplus
269 }
270 #endif
271 
272 #endif /* _RTE_IPSEC_H_ */
rte_security_session_action_type
Definition: rte_security.h:731
struct rte_ipsec_sa * sa
Definition: rte_ipsec.h:83
int rte_ipsec_session_prepare(struct rte_ipsec_session *ss)
#define __rte_cache_aligned
Definition: rte_common.h:627
static uint16_t rte_ipsec_pkt_crypto_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[], struct rte_crypto_op *cop[], uint16_t num)
Definition: rte_ipsec.h:138
int rte_ipsec_telemetry_sa_add(const struct rte_ipsec_sa *sa)
void rte_ipsec_telemetry_sa_del(const struct rte_ipsec_sa *sa)
static __rte_experimental uint16_t rte_ipsec_pkt_crypto_prepare_stateless(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[], struct rte_crypto_op *cop[], uint16_t num, struct rte_ipsec_state *state)
Definition: rte_ipsec.h:180
static __rte_experimental uint16_t rte_ipsec_pkt_cpu_prepare_stateless(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[], uint16_t num, struct rte_ipsec_state *state)
Definition: rte_ipsec.h:205
static uint16_t rte_ipsec_pkt_process(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[], uint16_t num)
Definition: rte_ipsec.h:235
struct rte_ipsec_sa_pkt_func pkt_func
Definition: rte_ipsec.h:99
uint64_t sqn
Definition: rte_ipsec.h:30