xref: /dpdk/drivers/crypto/cnxk/cn9k_ipsec.h (revision 27595cd83053b2d39634a159d6709b3ce3cdf3b0)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 
5 #ifndef __CN9K_IPSEC_H__
6 #define __CN9K_IPSEC_H__
7 
8 #include <rte_security_driver.h>
9 
10 #include "cnxk_ipsec.h"
11 #include "cnxk_security.h"
12 #include "cnxk_security_ar.h"
13 
14 struct __rte_aligned(8) cn9k_ipsec_sa {
15 	union {
16 		/** Inbound SA */
17 		struct roc_ie_on_inb_sa in_sa;
18 		/** Outbound SA */
19 		struct roc_ie_on_outb_sa out_sa;
20 	};
21 };
22 
23 #define SEC_SESS_SIZE sizeof(struct rte_security_session)
24 
25 struct __rte_cache_aligned cn9k_sec_session {
26 	uint8_t rte_sess[SEC_SESS_SIZE];
27 
28 	/** PMD private space */
29 
30 	/** ESN */
31 	union {
32 		uint64_t esn;
33 		struct {
34 			uint32_t seq_lo;
35 			uint32_t seq_hi;
36 		};
37 	};
38 	/** IPsec SA direction */
39 	uint8_t is_outbound;
40 	/* ESN enable flag */
41 	uint8_t esn_en;
42 	/** Pre-populated CPT inst words */
43 	struct cnxk_cpt_inst_tmpl inst;
44 	/** Response length calculation data */
45 	struct cnxk_ipsec_outb_rlens rlens;
46 	/** Anti replay window size */
47 	uint32_t replay_win_sz;
48 	/** Cipher IV offset in bytes */
49 	uint16_t cipher_iv_off;
50 	/** Cipher IV length in bytes */
51 	uint8_t cipher_iv_len;
52 	/** Outbound custom header length */
53 	uint8_t custom_hdr_len;
54 	/** Anti replay */
55 	struct cnxk_on_ipsec_ar ar;
56 	/** Queue pair */
57 	struct cnxk_cpt_qp *qp;
58 
59 	struct cn9k_ipsec_sa sa;
60 };
61 
62 void cn9k_sec_ops_override(void);
63 
64 #endif /* __CN9K_IPSEC_H__ */
65