1d30ea906Sjfb8856606 /* SPDX-License-Identifier: BSD-3-Clause
2d30ea906Sjfb8856606 * Copyright(c) 2016-2017 Intel Corporation
3a9643ea8Slogwang */
4a9643ea8Slogwang
5a9643ea8Slogwang #ifndef __IPSEC_H__
6a9643ea8Slogwang #define __IPSEC_H__
7a9643ea8Slogwang
8a9643ea8Slogwang #include <stdint.h>
9a9643ea8Slogwang
10a9643ea8Slogwang #include <rte_byteorder.h>
11a9643ea8Slogwang #include <rte_crypto.h>
122bfe3f2eSlogwang #include <rte_security.h>
132bfe3f2eSlogwang #include <rte_flow.h>
144418919fSjohnjiang #include <rte_ipsec.h>
15a9643ea8Slogwang
16*2d9fd380Sjfb8856606 #include "ipsec-secgw.h"
17*2d9fd380Sjfb8856606
18a9643ea8Slogwang #define RTE_LOGTYPE_IPSEC_ESP RTE_LOGTYPE_USER2
19a9643ea8Slogwang #define RTE_LOGTYPE_IPSEC_IPIP RTE_LOGTYPE_USER3
20a9643ea8Slogwang
21d30ea906Sjfb8856606 #define MAX_INFLIGHT 128
22a9643ea8Slogwang #define MAX_QP_PER_LCORE 256
23a9643ea8Slogwang
24a9643ea8Slogwang #define MAX_DIGEST_SIZE 32 /* Bytes -- 256 bits */
25a9643ea8Slogwang
26d30ea906Sjfb8856606 #define IPSEC_OFFLOAD_ESN_SOFTLIMIT 0xffffff00
27d30ea906Sjfb8856606
282bfe3f2eSlogwang #define IV_OFFSET (sizeof(struct rte_crypto_op) + \
292bfe3f2eSlogwang sizeof(struct rte_crypto_sym_op))
302bfe3f2eSlogwang
31a9643ea8Slogwang #define DEFAULT_MAX_CATEGORIES 1
32a9643ea8Slogwang
33a9643ea8Slogwang #define INVALID_SPI (0)
34a9643ea8Slogwang
351646932aSjfb8856606 #define DISCARD INVALID_SPI
361646932aSjfb8856606 #define BYPASS UINT32_MAX
37a9643ea8Slogwang
38a9643ea8Slogwang #define IPSEC_XFORM_MAX 2
39a9643ea8Slogwang
40a9643ea8Slogwang #define IP6_VERSION (6)
41a9643ea8Slogwang
42a9643ea8Slogwang struct rte_crypto_xform;
43a9643ea8Slogwang struct ipsec_xform;
44a9643ea8Slogwang struct rte_mbuf;
45a9643ea8Slogwang
46a9643ea8Slogwang struct ipsec_sa;
47*2d9fd380Sjfb8856606 /*
48*2d9fd380Sjfb8856606 * Keeps number of configured SA's for each address family:
49*2d9fd380Sjfb8856606 */
50*2d9fd380Sjfb8856606 struct ipsec_sa_cnt {
51*2d9fd380Sjfb8856606 uint32_t nb_v4;
52*2d9fd380Sjfb8856606 uint32_t nb_v6;
53*2d9fd380Sjfb8856606 };
54a9643ea8Slogwang
55a9643ea8Slogwang typedef int32_t (*ipsec_xform_fn)(struct rte_mbuf *m, struct ipsec_sa *sa,
56a9643ea8Slogwang struct rte_crypto_op *cop);
57a9643ea8Slogwang
58a9643ea8Slogwang struct ip_addr {
59a9643ea8Slogwang union {
60a9643ea8Slogwang uint32_t ip4;
61a9643ea8Slogwang union {
62a9643ea8Slogwang uint64_t ip6[2];
63a9643ea8Slogwang uint8_t ip6_b[16];
64a9643ea8Slogwang } ip6;
65a9643ea8Slogwang } ip;
66a9643ea8Slogwang };
67a9643ea8Slogwang
68*2d9fd380Sjfb8856606 #define MAX_KEY_SIZE 36
692bfe3f2eSlogwang
704418919fSjohnjiang /*
714418919fSjohnjiang * application wide SA parameters
724418919fSjohnjiang */
734418919fSjohnjiang struct app_sa_prm {
744418919fSjohnjiang uint32_t enable; /* use librte_ipsec API for ipsec pkt processing */
754418919fSjohnjiang uint32_t window_size; /* replay window size */
764418919fSjohnjiang uint32_t enable_esn; /* enable/disable ESN support */
77*2d9fd380Sjfb8856606 uint32_t cache_sz; /* per lcore SA cache size */
784418919fSjohnjiang uint64_t flags; /* rte_ipsec_sa_prm.flags */
794418919fSjohnjiang };
804418919fSjohnjiang
814418919fSjohnjiang extern struct app_sa_prm app_sa_prm;
824418919fSjohnjiang
83*2d9fd380Sjfb8856606 struct flow_info {
84*2d9fd380Sjfb8856606 struct rte_flow *rx_def_flow;
85*2d9fd380Sjfb8856606 };
86*2d9fd380Sjfb8856606
87*2d9fd380Sjfb8856606 extern struct flow_info flow_info_tbl[RTE_MAX_ETHPORTS];
88*2d9fd380Sjfb8856606
894418919fSjohnjiang enum {
904418919fSjohnjiang IPSEC_SESSION_PRIMARY = 0,
914418919fSjohnjiang IPSEC_SESSION_FALLBACK = 1,
924418919fSjohnjiang IPSEC_SESSION_MAX
934418919fSjohnjiang };
944418919fSjohnjiang
954418919fSjohnjiang #define IPSEC_SA_OFFLOAD_FALLBACK_FLAG (1)
964418919fSjohnjiang
974418919fSjohnjiang static inline struct ipsec_sa *
ipsec_mask_saptr(void * ptr)984418919fSjohnjiang ipsec_mask_saptr(void *ptr)
994418919fSjohnjiang {
1004418919fSjohnjiang uintptr_t i = (uintptr_t)ptr;
1014418919fSjohnjiang static const uintptr_t mask = IPSEC_SA_OFFLOAD_FALLBACK_FLAG;
1024418919fSjohnjiang
1034418919fSjohnjiang i &= ~mask;
1044418919fSjohnjiang
1054418919fSjohnjiang return (struct ipsec_sa *)i;
1064418919fSjohnjiang }
1074418919fSjohnjiang
108a9643ea8Slogwang struct ipsec_sa {
1094418919fSjohnjiang struct rte_ipsec_session sessions[IPSEC_SESSION_MAX];
110a9643ea8Slogwang uint32_t spi;
111a9643ea8Slogwang uint32_t cdev_id_qp;
1122bfe3f2eSlogwang uint64_t seq;
1132bfe3f2eSlogwang uint32_t salt;
1144418919fSjohnjiang uint32_t fallback_sessions;
115a9643ea8Slogwang enum rte_crypto_cipher_algorithm cipher_algo;
116a9643ea8Slogwang enum rte_crypto_auth_algorithm auth_algo;
1172bfe3f2eSlogwang enum rte_crypto_aead_algorithm aead_algo;
118a9643ea8Slogwang uint16_t digest_len;
119a9643ea8Slogwang uint16_t iv_len;
120a9643ea8Slogwang uint16_t block_size;
121a9643ea8Slogwang uint16_t flags;
122a9643ea8Slogwang #define IP4_TUNNEL (1 << 0)
123a9643ea8Slogwang #define IP6_TUNNEL (1 << 1)
124a9643ea8Slogwang #define TRANSPORT (1 << 2)
1254b05018fSfengbojiang #define IP4_TRANSPORT (1 << 3)
1264b05018fSfengbojiang #define IP6_TRANSPORT (1 << 4)
127a9643ea8Slogwang struct ip_addr src;
128a9643ea8Slogwang struct ip_addr dst;
1292bfe3f2eSlogwang uint8_t cipher_key[MAX_KEY_SIZE];
1302bfe3f2eSlogwang uint16_t cipher_key_len;
1312bfe3f2eSlogwang uint8_t auth_key[MAX_KEY_SIZE];
1322bfe3f2eSlogwang uint16_t auth_key_len;
1332bfe3f2eSlogwang uint16_t aad_len;
1342bfe3f2eSlogwang union {
135a9643ea8Slogwang struct rte_crypto_sym_xform *xforms;
1362bfe3f2eSlogwang struct rte_security_ipsec_xform *sec_xform;
1372bfe3f2eSlogwang };
1382bfe3f2eSlogwang enum rte_security_ipsec_sa_direction direction;
1392bfe3f2eSlogwang uint16_t portid;
140*2d9fd380Sjfb8856606 uint8_t fdir_qid;
141*2d9fd380Sjfb8856606 uint8_t fdir_flag;
1422bfe3f2eSlogwang
1432bfe3f2eSlogwang #define MAX_RTE_FLOW_PATTERN (4)
144d30ea906Sjfb8856606 #define MAX_RTE_FLOW_ACTIONS (3)
1452bfe3f2eSlogwang struct rte_flow_item pattern[MAX_RTE_FLOW_PATTERN];
1462bfe3f2eSlogwang struct rte_flow_action action[MAX_RTE_FLOW_ACTIONS];
1472bfe3f2eSlogwang struct rte_flow_attr attr;
1482bfe3f2eSlogwang union {
1492bfe3f2eSlogwang struct rte_flow_item_ipv4 ipv4_spec;
1502bfe3f2eSlogwang struct rte_flow_item_ipv6 ipv6_spec;
1512bfe3f2eSlogwang };
1522bfe3f2eSlogwang struct rte_flow_item_esp esp_spec;
1532bfe3f2eSlogwang struct rte_flow *flow;
1542bfe3f2eSlogwang struct rte_security_session_conf sess_conf;
155a9643ea8Slogwang } __rte_cache_aligned;
156a9643ea8Slogwang
157*2d9fd380Sjfb8856606 struct ipsec_xf {
158*2d9fd380Sjfb8856606 struct rte_crypto_sym_xform a;
159*2d9fd380Sjfb8856606 struct rte_crypto_sym_xform b;
160*2d9fd380Sjfb8856606 };
161*2d9fd380Sjfb8856606
162*2d9fd380Sjfb8856606 struct ipsec_sad {
163*2d9fd380Sjfb8856606 struct rte_ipsec_sad *sad_v4;
164*2d9fd380Sjfb8856606 struct rte_ipsec_sad *sad_v6;
165*2d9fd380Sjfb8856606 };
166*2d9fd380Sjfb8856606
167*2d9fd380Sjfb8856606 struct sa_ctx {
168*2d9fd380Sjfb8856606 void *satbl; /* pointer to array of rte_ipsec_sa objects*/
169*2d9fd380Sjfb8856606 struct ipsec_sad sad;
170*2d9fd380Sjfb8856606 struct ipsec_xf *xf;
171*2d9fd380Sjfb8856606 uint32_t nb_sa;
172*2d9fd380Sjfb8856606 struct ipsec_sa sa[];
173*2d9fd380Sjfb8856606 };
174*2d9fd380Sjfb8856606
175a9643ea8Slogwang struct ipsec_mbuf_metadata {
176a9643ea8Slogwang struct ipsec_sa *sa;
177a9643ea8Slogwang struct rte_crypto_op cop;
178a9643ea8Slogwang struct rte_crypto_sym_op sym_cop;
1792bfe3f2eSlogwang uint8_t buf[32];
1802bfe3f2eSlogwang } __rte_cache_aligned;
181a9643ea8Slogwang
1824b05018fSfengbojiang #define IS_TRANSPORT(flags) ((flags) & TRANSPORT)
1834b05018fSfengbojiang
1844b05018fSfengbojiang #define IS_TUNNEL(flags) ((flags) & (IP4_TUNNEL | IP6_TUNNEL))
1854b05018fSfengbojiang
1864b05018fSfengbojiang #define IS_IP4(flags) ((flags) & (IP4_TUNNEL | IP4_TRANSPORT))
1874b05018fSfengbojiang
1884b05018fSfengbojiang #define IS_IP6(flags) ((flags) & (IP6_TUNNEL | IP6_TRANSPORT))
1894b05018fSfengbojiang
1904b05018fSfengbojiang #define IS_IP4_TUNNEL(flags) ((flags) & IP4_TUNNEL)
1914b05018fSfengbojiang
1924b05018fSfengbojiang #define IS_IP6_TUNNEL(flags) ((flags) & IP6_TUNNEL)
1934b05018fSfengbojiang
1944b05018fSfengbojiang /*
1954b05018fSfengbojiang * Macro for getting ipsec_sa flags statuses without version of protocol
1964b05018fSfengbojiang * used for transport (IP4_TRANSPORT and IP6_TRANSPORT flags).
1974b05018fSfengbojiang */
1984b05018fSfengbojiang #define WITHOUT_TRANSPORT_VERSION(flags) \
1994b05018fSfengbojiang ((flags) & (IP4_TUNNEL | \
2004b05018fSfengbojiang IP6_TUNNEL | \
2014b05018fSfengbojiang TRANSPORT))
2024b05018fSfengbojiang
203a9643ea8Slogwang struct cdev_qp {
204a9643ea8Slogwang uint16_t id;
205a9643ea8Slogwang uint16_t qp;
206a9643ea8Slogwang uint16_t in_flight;
207a9643ea8Slogwang uint16_t len;
208a9643ea8Slogwang struct rte_crypto_op *buf[MAX_PKT_BURST] __rte_aligned(sizeof(void *));
209a9643ea8Slogwang };
210a9643ea8Slogwang
211a9643ea8Slogwang struct ipsec_ctx {
212a9643ea8Slogwang struct rte_hash *cdev_map;
213a9643ea8Slogwang struct sp_ctx *sp4_ctx;
214a9643ea8Slogwang struct sp_ctx *sp6_ctx;
215a9643ea8Slogwang struct sa_ctx *sa_ctx;
216a9643ea8Slogwang uint16_t nb_qps;
217a9643ea8Slogwang uint16_t last_qp;
218a9643ea8Slogwang struct cdev_qp tbl[MAX_QP_PER_LCORE];
2192bfe3f2eSlogwang struct rte_mempool *session_pool;
2204418919fSjohnjiang struct rte_mempool *session_priv_pool;
221d30ea906Sjfb8856606 struct rte_mbuf *ol_pkts[MAX_PKT_BURST] __rte_aligned(sizeof(void *));
222d30ea906Sjfb8856606 uint16_t ol_pkts_cnt;
2234418919fSjohnjiang uint64_t ipv4_offloads;
2244418919fSjohnjiang uint64_t ipv6_offloads;
225a9643ea8Slogwang };
226a9643ea8Slogwang
227a9643ea8Slogwang struct cdev_key {
228a9643ea8Slogwang uint16_t lcore_id;
229a9643ea8Slogwang uint8_t cipher_algo;
230a9643ea8Slogwang uint8_t auth_algo;
2312bfe3f2eSlogwang uint8_t aead_algo;
232a9643ea8Slogwang };
233a9643ea8Slogwang
234a9643ea8Slogwang struct socket_ctx {
235a9643ea8Slogwang struct sa_ctx *sa_in;
236a9643ea8Slogwang struct sa_ctx *sa_out;
237a9643ea8Slogwang struct sp_ctx *sp_ip4_in;
238a9643ea8Slogwang struct sp_ctx *sp_ip4_out;
239a9643ea8Slogwang struct sp_ctx *sp_ip6_in;
240a9643ea8Slogwang struct sp_ctx *sp_ip6_out;
241a9643ea8Slogwang struct rt_ctx *rt_ip4;
242a9643ea8Slogwang struct rt_ctx *rt_ip6;
243a9643ea8Slogwang struct rte_mempool *mbuf_pool;
2444418919fSjohnjiang struct rte_mempool *mbuf_pool_indir;
2452bfe3f2eSlogwang struct rte_mempool *session_pool;
2464418919fSjohnjiang struct rte_mempool *session_priv_pool;
247a9643ea8Slogwang };
248a9643ea8Slogwang
2492bfe3f2eSlogwang struct cnt_blk {
2502bfe3f2eSlogwang uint32_t salt;
2512bfe3f2eSlogwang uint64_t iv;
2522bfe3f2eSlogwang uint32_t cnt;
253*2d9fd380Sjfb8856606 } __rte_packed;
2542bfe3f2eSlogwang
255*2d9fd380Sjfb8856606 /* Socket ctx */
256*2d9fd380Sjfb8856606 extern struct socket_ctx socket_ctx[NB_SOCKETS];
2574418919fSjohnjiang
258*2d9fd380Sjfb8856606 void
259*2d9fd380Sjfb8856606 ipsec_poll_mode_worker(void);
260*2d9fd380Sjfb8856606
261*2d9fd380Sjfb8856606 int
262*2d9fd380Sjfb8856606 ipsec_launch_one_lcore(void *args);
263*2d9fd380Sjfb8856606
264*2d9fd380Sjfb8856606 extern struct ipsec_sa *sa_out;
265*2d9fd380Sjfb8856606 extern uint32_t nb_sa_out;
266*2d9fd380Sjfb8856606
267*2d9fd380Sjfb8856606 extern struct ipsec_sa *sa_in;
268*2d9fd380Sjfb8856606 extern uint32_t nb_sa_in;
2694418919fSjohnjiang
270a9643ea8Slogwang uint16_t
271a9643ea8Slogwang ipsec_inbound(struct ipsec_ctx *ctx, struct rte_mbuf *pkts[],
272a9643ea8Slogwang uint16_t nb_pkts, uint16_t len);
273a9643ea8Slogwang
274a9643ea8Slogwang uint16_t
275a9643ea8Slogwang ipsec_outbound(struct ipsec_ctx *ctx, struct rte_mbuf *pkts[],
276a9643ea8Slogwang uint32_t sa_idx[], uint16_t nb_pkts, uint16_t len);
277a9643ea8Slogwang
2781646932aSjfb8856606 uint16_t
2791646932aSjfb8856606 ipsec_inbound_cqp_dequeue(struct ipsec_ctx *ctx, struct rte_mbuf *pkts[],
2801646932aSjfb8856606 uint16_t len);
2811646932aSjfb8856606
2821646932aSjfb8856606 uint16_t
2831646932aSjfb8856606 ipsec_outbound_cqp_dequeue(struct ipsec_ctx *ctx, struct rte_mbuf *pkts[],
2841646932aSjfb8856606 uint16_t len);
2851646932aSjfb8856606
2864418919fSjohnjiang void
2874418919fSjohnjiang ipsec_process(struct ipsec_ctx *ctx, struct ipsec_traffic *trf);
2884418919fSjohnjiang
2894418919fSjohnjiang void
2904418919fSjohnjiang ipsec_cqp_process(struct ipsec_ctx *ctx, struct ipsec_traffic *trf);
2914418919fSjohnjiang
292a9643ea8Slogwang static inline uint16_t
ipsec_metadata_size(void)293a9643ea8Slogwang ipsec_metadata_size(void)
294a9643ea8Slogwang {
295a9643ea8Slogwang return sizeof(struct ipsec_mbuf_metadata);
296a9643ea8Slogwang }
297a9643ea8Slogwang
298a9643ea8Slogwang static inline struct ipsec_mbuf_metadata *
get_priv(struct rte_mbuf * m)299a9643ea8Slogwang get_priv(struct rte_mbuf *m)
300a9643ea8Slogwang {
301d30ea906Sjfb8856606 return rte_mbuf_to_priv(m);
302a9643ea8Slogwang }
303a9643ea8Slogwang
3042bfe3f2eSlogwang static inline void *
get_cnt_blk(struct rte_mbuf * m)3052bfe3f2eSlogwang get_cnt_blk(struct rte_mbuf *m)
3062bfe3f2eSlogwang {
3072bfe3f2eSlogwang struct ipsec_mbuf_metadata *priv = get_priv(m);
3082bfe3f2eSlogwang
3092bfe3f2eSlogwang return &priv->buf[0];
3102bfe3f2eSlogwang }
3112bfe3f2eSlogwang
3122bfe3f2eSlogwang static inline void *
get_aad(struct rte_mbuf * m)3132bfe3f2eSlogwang get_aad(struct rte_mbuf *m)
3142bfe3f2eSlogwang {
3152bfe3f2eSlogwang struct ipsec_mbuf_metadata *priv = get_priv(m);
3162bfe3f2eSlogwang
3172bfe3f2eSlogwang return &priv->buf[16];
3182bfe3f2eSlogwang }
3192bfe3f2eSlogwang
3202bfe3f2eSlogwang static inline void *
get_sym_cop(struct rte_crypto_op * cop)3212bfe3f2eSlogwang get_sym_cop(struct rte_crypto_op *cop)
3222bfe3f2eSlogwang {
3232bfe3f2eSlogwang return (cop + 1);
3242bfe3f2eSlogwang }
3252bfe3f2eSlogwang
3264418919fSjohnjiang static inline struct rte_ipsec_session *
ipsec_get_primary_session(struct ipsec_sa * sa)3274418919fSjohnjiang ipsec_get_primary_session(struct ipsec_sa *sa)
3284418919fSjohnjiang {
3294418919fSjohnjiang return &sa->sessions[IPSEC_SESSION_PRIMARY];
3304418919fSjohnjiang }
3314418919fSjohnjiang
3324418919fSjohnjiang static inline struct rte_ipsec_session *
ipsec_get_fallback_session(struct ipsec_sa * sa)3334418919fSjohnjiang ipsec_get_fallback_session(struct ipsec_sa *sa)
3344418919fSjohnjiang {
3354418919fSjohnjiang return &sa->sessions[IPSEC_SESSION_FALLBACK];
3364418919fSjohnjiang }
3374418919fSjohnjiang
3384418919fSjohnjiang static inline enum rte_security_session_action_type
ipsec_get_action_type(struct ipsec_sa * sa)3394418919fSjohnjiang ipsec_get_action_type(struct ipsec_sa *sa)
3404418919fSjohnjiang {
3414418919fSjohnjiang struct rte_ipsec_session *ips;
3424418919fSjohnjiang ips = ipsec_get_primary_session(sa);
3434418919fSjohnjiang return ips->type;
3444418919fSjohnjiang }
3454418919fSjohnjiang
346a9643ea8Slogwang int
347a9643ea8Slogwang inbound_sa_check(struct sa_ctx *sa_ctx, struct rte_mbuf *m, uint32_t sa_idx);
348a9643ea8Slogwang
349a9643ea8Slogwang void
350a9643ea8Slogwang inbound_sa_lookup(struct sa_ctx *sa_ctx, struct rte_mbuf *pkts[],
3514418919fSjohnjiang void *sa[], uint16_t nb_pkts);
352a9643ea8Slogwang
353a9643ea8Slogwang void
354a9643ea8Slogwang outbound_sa_lookup(struct sa_ctx *sa_ctx, uint32_t sa_idx[],
3554418919fSjohnjiang void *sa[], uint16_t nb_pkts);
356a9643ea8Slogwang
357a9643ea8Slogwang void
3582bfe3f2eSlogwang sp4_init(struct socket_ctx *ctx, int32_t socket_id);
359a9643ea8Slogwang
360a9643ea8Slogwang void
3612bfe3f2eSlogwang sp6_init(struct socket_ctx *ctx, int32_t socket_id);
362a9643ea8Slogwang
3631646932aSjfb8856606 /*
3644b05018fSfengbojiang * Search through SP rules for given SPI.
3654b05018fSfengbojiang * Returns first rule index if found(greater or equal then zero),
3664b05018fSfengbojiang * or -ENOENT otherwise.
3674b05018fSfengbojiang */
3684b05018fSfengbojiang int
3694b05018fSfengbojiang sp4_spi_present(uint32_t spi, int inbound, struct ip_addr ip_addr[2],
3704b05018fSfengbojiang uint32_t mask[2]);
3714b05018fSfengbojiang int
3724b05018fSfengbojiang sp6_spi_present(uint32_t spi, int inbound, struct ip_addr ip_addr[2],
3734b05018fSfengbojiang uint32_t mask[2]);
3744b05018fSfengbojiang
3754b05018fSfengbojiang /*
3761646932aSjfb8856606 * Search through SA entries for given SPI.
3771646932aSjfb8856606 * Returns first entry index if found(greater or equal then zero),
3781646932aSjfb8856606 * or -ENOENT otherwise.
3791646932aSjfb8856606 */
3801646932aSjfb8856606 int
381*2d9fd380Sjfb8856606 sa_spi_present(struct sa_ctx *sa_ctx, uint32_t spi, int inbound);
3821646932aSjfb8856606
383a9643ea8Slogwang void
3842bfe3f2eSlogwang sa_init(struct socket_ctx *ctx, int32_t socket_id);
385a9643ea8Slogwang
386a9643ea8Slogwang void
3872bfe3f2eSlogwang rt_init(struct socket_ctx *ctx, int32_t socket_id);
388a9643ea8Slogwang
3894418919fSjohnjiang int
3904418919fSjohnjiang sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads,
3914418919fSjohnjiang uint64_t *tx_offloads);
3924418919fSjohnjiang
3934418919fSjohnjiang int
3944418919fSjohnjiang add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr);
3954418919fSjohnjiang
3961646932aSjfb8856606 void
3971646932aSjfb8856606 enqueue_cop_burst(struct cdev_qp *cqp);
3981646932aSjfb8856606
3994418919fSjohnjiang int
4004418919fSjohnjiang create_lookaside_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa,
4014418919fSjohnjiang struct rte_ipsec_session *ips);
4024418919fSjohnjiang
4034418919fSjohnjiang int
4044418919fSjohnjiang create_inline_session(struct socket_ctx *skt_ctx, struct ipsec_sa *sa,
4054418919fSjohnjiang struct rte_ipsec_session *ips);
406*2d9fd380Sjfb8856606 int
407*2d9fd380Sjfb8856606 check_flow_params(uint16_t fdir_portid, uint8_t fdir_qid);
408*2d9fd380Sjfb8856606
409*2d9fd380Sjfb8856606 int
410*2d9fd380Sjfb8856606 create_ipsec_esp_flow(struct ipsec_sa *sa);
411*2d9fd380Sjfb8856606
412*2d9fd380Sjfb8856606 uint32_t
413*2d9fd380Sjfb8856606 get_nb_crypto_sessions(void);
4144418919fSjohnjiang
415a9643ea8Slogwang #endif /* __IPSEC_H__ */
416