1
2
3
4
5#ifndef _OTX2_EVDEV_CRYPTO_ADPTR_RX_H_
6#define _OTX2_EVDEV_CRYPTO_ADPTR_RX_H_
7
8#include <rte_cryptodev.h>
9#include <rte_cryptodev_pmd.h>
10#include <rte_eventdev.h>
11
12#include "cpt_pmd_logs.h"
13#include "cpt_ucode.h"
14
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"
19
20static inline void
21otx2_ca_deq_post_process(const struct otx2_cpt_qp *qp,
22 struct rte_crypto_op *cop, uintptr_t *rsp,
23 uint8_t cc)
24{
25 if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
26 if (likely(cc == NO_ERR)) {
27
28 if (unlikely(rsp[2]))
29 compl_auth_verify(cop, (uint8_t *)rsp[2],
30 rsp[3]);
31 else
32 cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
33 } else {
34 if (cc == ERR_GC_ICV_MISCOMPARE)
35 cop->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
36 else
37 cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
38 }
39
40 if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
41 sym_session_clear(otx2_cryptodev_driver_id,
42 cop->sym->session);
43 memset(cop->sym->session, 0,
44 rte_cryptodev_sym_get_existing_header_session_size(
45 cop->sym->session));
46 rte_mempool_put(qp->sess_mp, cop->sym->session);
47 cop->sym->session = NULL;
48 }
49 }
50
51}
52
53static inline uint64_t
54otx2_handle_crypto_event(uint64_t get_work1)
55{
56 struct cpt_request_info *req;
57 const struct otx2_cpt_qp *qp;
58 struct rte_crypto_op *cop;
59 uintptr_t *rsp;
60 void *metabuf;
61 uint8_t cc;
62
63 req = (struct cpt_request_info *)(get_work1);
64 cc = otx2_cpt_compcode_get(req);
65 qp = req->qp;
66
67 rsp = req->op;
68 metabuf = (void *)rsp[0];
69 cop = (void *)rsp[1];
70
71 otx2_ca_deq_post_process(qp, cop, rsp, cc);
72
73 rte_mempool_put(qp->meta_info.pool, metabuf);
74
75 return (uint64_t)(cop);
76}
77#endif
78