crypto/qat: move generic qp function to qp file
[dpdk.git] / drivers / crypto / qat / qat_qp.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4 #ifndef _QAT_QP_H_
5 #define _QAT_QP_H_
6
7 #include "qat_common.h"
8
9 typedef int (*build_request_t)(void *op,
10                 uint8_t *req, void *op_cookie,
11                 enum qat_device_gen qat_dev_gen);
12 /**< Build a request from an op. */
13
14 typedef int (*process_response_t)(void **ops,
15                 uint8_t *resp, void *op_cookie,
16                 enum qat_device_gen qat_dev_gen);
17 /**< Process a response descriptor and return the associated op. */
18
19 /**
20  * Structure associated with each queue.
21  */
22 struct qat_queue {
23         char            memz_name[RTE_MEMZONE_NAMESIZE];
24         void            *base_addr;             /* Base address */
25         rte_iova_t      base_phys_addr;         /* Queue physical address */
26         uint32_t        head;                   /* Shadow copy of the head */
27         uint32_t        tail;                   /* Shadow copy of the tail */
28         uint32_t        modulo;
29         uint32_t        msg_size;
30         uint16_t        max_inflights;
31         uint32_t        queue_size;
32         uint8_t         hw_bundle_number;
33         uint8_t         hw_queue_number;
34         /* HW queue aka ring offset on bundle */
35         uint32_t        csr_head;               /* last written head value */
36         uint32_t        csr_tail;               /* last written tail value */
37         uint16_t        nb_processed_responses;
38         /* number of responses processed since last CSR head write */
39         uint16_t        nb_pending_requests;
40         /* number of requests pending since last CSR tail write */
41 };
42
43 struct qat_qp {
44         void                    *mmap_bar_addr;
45         uint16_t                inflights16;
46         struct  qat_queue       tx_q;
47         struct  qat_queue       rx_q;
48         struct  rte_cryptodev_stats stats;
49         struct rte_mempool *op_cookie_pool;
50         void **op_cookies;
51         uint32_t nb_descriptors;
52         enum qat_device_gen qat_dev_gen;
53         build_request_t build_request;
54         process_response_t process_response;
55 } __rte_cache_aligned;
56
57 uint16_t
58 qat_enqueue_op_burst(void *qp, void **ops, uint16_t nb_ops);
59
60 uint16_t
61 qat_dequeue_op_burst(void *qp, void **ops, uint16_t nb_ops);
62
63 #endif /* _QAT_QP_H_ */