1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (C) 2020 Marvell International Ltd. 3 */ 4 5 #ifndef __OTX2_CRYPTODEV_SEC_H__ 6 #define __OTX2_CRYPTODEV_SEC_H__ 7 8 #include <rte_cryptodev.h> 9 10 #include "otx2_ipsec_po.h" 11 12 struct otx2_sec_session_ipsec_lp { 13 RTE_STD_C11 14 union { 15 /* Inbound SA */ 16 struct otx2_ipsec_po_in_sa in_sa; 17 /* Outbound SA */ 18 struct otx2_ipsec_po_out_sa out_sa; 19 }; 20 21 uint64_t cpt_inst_w7; 22 union { 23 uint64_t ucmd_w0; 24 struct { 25 uint16_t ucmd_dlen; 26 uint16_t ucmd_param2; 27 uint16_t ucmd_param1; 28 uint16_t ucmd_opcode; 29 }; 30 }; 31 32 uint8_t partial_len; 33 uint8_t roundup_len; 34 uint8_t roundup_byte; 35 uint16_t ip_id; 36 union { 37 uint64_t esn; 38 struct { 39 uint32_t seq_lo; 40 uint32_t seq_hi; 41 }; 42 }; 43 44 /** Context length in 8-byte words */ 45 size_t ctx_len; 46 /** Auth IV offset in bytes */ 47 uint16_t auth_iv_offset; 48 /** IV offset in bytes */ 49 uint16_t iv_offset; 50 /** AAD length */ 51 uint16_t aad_length; 52 /** MAC len in bytes */ 53 uint8_t mac_len; 54 /** IV length in bytes */ 55 uint8_t iv_length; 56 /** Auth IV length in bytes */ 57 uint8_t auth_iv_length; 58 /** IPsec tunnel type */ 59 enum rte_security_ipsec_tunnel_type tunnel_type; 60 }; 61 62 int otx2_crypto_sec_ctx_create(struct rte_cryptodev *crypto_dev); 63 64 void otx2_crypto_sec_ctx_destroy(struct rte_cryptodev *crypto_dev); 65 66 #endif /* __OTX2_CRYPTODEV_SEC_H__ */ 67