crypto/cnxk: add queue pair operations
[dpdk.git] / drivers / crypto / cnxk / cnxk_cryptodev_ops.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #ifndef _CNXK_CRYPTODEV_OPS_H_
6 #define _CNXK_CRYPTODEV_OPS_H_
7
8 #include <rte_cryptodev.h>
9
10 #include "roc_api.h"
11
12 #define CNXK_CPT_MIN_HEADROOM_REQ 24
13
14 struct cpt_qp_meta_info {
15         struct rte_mempool *pool;
16         int mlen;
17 };
18
19 struct cpt_inflight_req {
20         union cpt_res_s res;
21         struct rte_crypto_op *cop;
22         void *mdata;
23         uint8_t op_flags;
24 } __rte_aligned(16);
25
26 struct pending_queue {
27         /** Pending requests count */
28         uint64_t pending_count;
29         /** Array of pending requests */
30         struct cpt_inflight_req *req_queue;
31         /** Tail of queue to be used for enqueue */
32         uint16_t enq_tail;
33         /** Head of queue to be used for dequeue */
34         uint16_t deq_head;
35         /** Timeout to track h/w being unresponsive */
36         uint64_t time_out;
37 };
38
39 struct cnxk_cpt_qp {
40         struct roc_cpt_lf lf;
41         /**< Crypto LF */
42         struct pending_queue pend_q;
43         /**< Pending queue */
44         struct rte_mempool *sess_mp;
45         /**< Session mempool */
46         struct rte_mempool *sess_mp_priv;
47         /**< Session private data mempool */
48         struct cpt_qp_meta_info meta_info;
49         /**< Metabuf info required to support operations on the queue pair */
50         struct roc_cpt_lmtline lmtline;
51         /**< Lmtline information */
52 };
53
54 int cnxk_cpt_dev_config(struct rte_cryptodev *dev,
55                         struct rte_cryptodev_config *conf);
56
57 int cnxk_cpt_dev_start(struct rte_cryptodev *dev);
58
59 void cnxk_cpt_dev_stop(struct rte_cryptodev *dev);
60
61 int cnxk_cpt_dev_close(struct rte_cryptodev *dev);
62
63 void cnxk_cpt_dev_info_get(struct rte_cryptodev *dev,
64                            struct rte_cryptodev_info *info);
65
66 int cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
67                               const struct rte_cryptodev_qp_conf *conf,
68                               int socket_id __rte_unused);
69
70 int cnxk_cpt_queue_pair_release(struct rte_cryptodev *dev, uint16_t qp_id);
71
72 #endif /* _CNXK_CRYPTODEV_OPS_H_ */