1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (C) 2020 Marvell International Ltd.
5 #ifndef _OTX2_EVDEV_CRYPTO_ADPTR_RX_H_
6 #define _OTX2_EVDEV_CRYPTO_ADPTR_RX_H_
8 #include <rte_cryptodev.h>
9 #include <cryptodev_pmd.h>
10 #include <rte_eventdev.h>
12 #include "cpt_pmd_logs.h"
13 #include "cpt_ucode.h"
15 #include "otx2_cryptodev.h"
16 #include "otx2_cryptodev_hw_access.h"
17 #include "otx2_cryptodev_ops_helper.h"
18 #include "otx2_cryptodev_qp.h"
21 otx2_ca_deq_post_process(const struct otx2_cpt_qp *qp,
22 struct rte_crypto_op *cop, uintptr_t *rsp,
25 if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
26 if (likely(cc == NO_ERR)) {
27 /* Verify authentication data if required */
29 compl_auth_verify(cop, (uint8_t *)rsp[2],
32 cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
34 if (cc == ERR_GC_ICV_MISCOMPARE)
35 cop->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
37 cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
40 if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
41 sym_session_clear(otx2_cryptodev_driver_id,
43 memset(cop->sym->session, 0,
44 rte_cryptodev_sym_get_existing_header_session_size(
46 rte_mempool_put(qp->sess_mp, cop->sym->session);
47 cop->sym->session = NULL;
53 static inline uint64_t
54 otx2_handle_crypto_event(uint64_t get_work1)
56 struct cpt_request_info *req;
57 const struct otx2_cpt_qp *qp;
58 struct rte_crypto_op *cop;
63 req = (struct cpt_request_info *)(get_work1);
64 cc = otx2_cpt_compcode_get(req);
68 metabuf = (void *)rsp[0];
71 otx2_ca_deq_post_process(qp, cop, rsp, cc);
73 rte_mempool_put(qp->meta_info.pool, metabuf);
75 return (uint64_t)(cop);
77 #endif /* _OTX2_EVDEV_CRYPTO_ADPTR_RX_H_ */