77ffc8f72462a5cb56156cb13d384be467c2ecff
[dpdk.git] / qat_common.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4 #ifndef _QAT_COMMON_H_
5 #define _QAT_COMMON_H_
6
7 #include <stdint.h>
8
9 #include <rte_mbuf.h>
10
11 /**< Intel(R) QAT Symmetric Crypto PMD device name */
12 #define CRYPTODEV_NAME_QAT_SYM_PMD      crypto_qat
13
14 /*
15  * Maximum number of SGL entries
16  */
17 #define QAT_SGL_MAX_NUMBER      16
18
19 /* Intel(R) QuickAssist Technology device generation is enumerated
20  * from one according to the generation of the device
21  */
22
23 enum qat_device_gen {
24         QAT_GEN1 = 1,
25         QAT_GEN2,
26 };
27
28 enum qat_service_type {
29         QAT_SERVICE_ASYMMETRIC = 0,
30         QAT_SERVICE_SYMMETRIC,
31         QAT_SERVICE_COMPRESSION,
32         QAT_SERVICE_INVALID
33 };
34 #define QAT_MAX_SERVICES                (QAT_SERVICE_INVALID)
35
36 /**< Common struct for scatter-gather list operations */
37 struct qat_flat_buf {
38         uint32_t len;
39         uint32_t resrvd;
40         uint64_t addr;
41 } __rte_packed;
42
43 struct qat_sgl {
44         uint64_t resrvd;
45         uint32_t num_bufs;
46         uint32_t num_mapped_bufs;
47         struct qat_flat_buf buffers[QAT_SGL_MAX_NUMBER];
48 } __rte_packed __rte_cache_aligned;
49
50 int
51 qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buf_start,
52                 struct qat_sgl *list, uint32_t data_len);
53
54 #endif /* _QAT_COMMON_H_ */