1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #ifndef __CN10K_IPSEC_LA_OPS_H__
6 #define __CN10K_IPSEC_LA_OPS_H__
8 #include <rte_crypto_sym.h>
9 #include <rte_security.h>
11 #include "cn10k_cryptodev.h"
12 #include "cn10k_ipsec.h"
13 #include "cnxk_cryptodev.h"
15 static __rte_always_inline int
16 process_outb_sa(struct rte_crypto_op *cop, struct cn10k_ipsec_sa *sess,
17 struct cpt_inst_s *inst)
19 struct rte_crypto_sym_op *sym_op = cop->sym;
20 struct rte_mbuf *m_src = sym_op->m_src;
22 if (unlikely(rte_pktmbuf_tailroom(m_src) < sess->max_extended_len)) {
23 plt_dp_err("Not enough tail room");
27 /* Prepare CPT instruction */
28 inst->w4.u64 = sess->inst.w4;
29 inst->w4.s.dlen = rte_pktmbuf_pkt_len(m_src);
30 inst->dptr = rte_pktmbuf_iova(m_src);
31 inst->rptr = inst->dptr;
36 static __rte_always_inline int
37 process_inb_sa(struct rte_crypto_op *cop, struct cn10k_ipsec_sa *sa,
38 struct cpt_inst_s *inst)
40 struct rte_crypto_sym_op *sym_op = cop->sym;
41 struct rte_mbuf *m_src = sym_op->m_src;
43 /* Prepare CPT instruction */
44 inst->w4.u64 = sa->inst.w4;
45 inst->w4.s.dlen = rte_pktmbuf_pkt_len(m_src);
46 inst->dptr = rte_pktmbuf_iova(m_src);
47 inst->rptr = inst->dptr;
52 #endif /* __CN10K_IPSEC_LA_OPS_H__ */