Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2024 Marvell. 3 : : */ 4 : : 5 : : #ifndef __CN10K_CRYPTODEV_SEC_H__ 6 : : #define __CN10K_CRYPTODEV_SEC_H__ 7 : : 8 : : #include <rte_security.h> 9 : : 10 : : #include "roc_constants.h" 11 : : #include "roc_cpt.h" 12 : : 13 : : #include "cn10k_ipsec.h" 14 : : #include "cn10k_tls.h" 15 : : 16 : : #define SEC_SESS_SIZE sizeof(struct rte_security_session) 17 : : 18 : : struct cn10k_sec_session { 19 : : uint8_t rte_sess[SEC_SESS_SIZE]; 20 : : 21 : : /** PMD private space */ 22 : : 23 : : enum rte_security_session_protocol proto; 24 : : /** Pre-populated CPT inst words */ 25 : : struct cnxk_cpt_inst_tmpl inst; 26 : : uint16_t max_extended_len; 27 : : uint16_t iv_offset; 28 : : uint8_t iv_length; 29 : : union { 30 : : struct { 31 : : uint8_t ip_csum; 32 : : bool is_outbound; 33 : : } ipsec; 34 : : struct { 35 : : uint8_t enable_padding : 1; 36 : : uint8_t rvsd : 7; 37 : : bool is_write; 38 : : } tls; 39 : : }; 40 : : /** Queue pair */ 41 : : struct cnxk_cpt_qp *qp; 42 : : /** Userdata to be set for Rx inject */ 43 : : void *userdata; 44 : : 45 : : /** 46 : : * End of SW mutable area 47 : : */ 48 : : union { 49 : : struct cn10k_ipsec_sa sa; 50 : : struct cn10k_tls_record tls_rec; 51 : : }; 52 : : } __rte_aligned(ROC_ALIGN); 53 : : 54 : : static inline uint64_t 55 : : cpt_inst_w7_get(struct roc_cpt *roc_cpt, void *cptr) 56 : : { 57 : : union cpt_inst_w7 w7; 58 : : 59 : 0 : w7.u64 = 0; 60 : 0 : w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_IE]; 61 : 0 : w7.s.ctx_val = 1; 62 : 0 : w7.s.cptr = (uint64_t)cptr; 63 : : rte_mb(); 64 : : 65 [ # # # # ]: 0 : return w7.u64; 66 : : } 67 : : 68 : : void cn10k_sec_ops_override(void); 69 : : 70 : : #endif /* __CN10K_CRYPTODEV_SEC_H__ */