1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Advanced Micro Devices, Inc. All rights reserved.
5 #ifndef _CCP_PMD_PRIVATE_H_
6 #define _CCP_PMD_PRIVATE_H_
8 #include <rte_cryptodev.h>
10 #define CRYPTODEV_NAME_CCP_PMD crypto_ccp
12 #define CCP_LOG_ERR(fmt, args...) \
13 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
14 RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
15 __func__, __LINE__, ## args)
17 #ifdef RTE_LIBRTE_CCP_DEBUG
18 #define CCP_LOG_INFO(fmt, args...) \
19 RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
20 RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
21 __func__, __LINE__, ## args)
23 #define CCP_LOG_DBG(fmt, args...) \
24 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
25 RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
26 __func__, __LINE__, ## args)
28 #define CCP_LOG_INFO(fmt, args...)
29 #define CCP_LOG_DBG(fmt, args...)
32 /**< Maximum queue pairs supported by CCP PMD */
33 #define CCP_PMD_MAX_QUEUE_PAIRS 1
34 #define CCP_NB_MAX_DESCRIPTORS 1024
35 #define CCP_MAX_BURST 64
39 /* private data structure for each CCP crypto device */
41 unsigned int max_nb_qpairs; /**< Max number of queue pairs */
42 unsigned int max_nb_sessions; /**< Max number of sessions */
43 uint8_t crypto_num_dev; /**< Number of working crypto devices */
44 struct ccp_device *last_dev; /**< Last working crypto device */
48 struct ccp_batch_info {
49 struct rte_crypto_op *op[CCP_MAX_BURST];
50 /**< optable populated at enque time from app*/
52 struct ccp_queue *cmd_q;
54 /**< no. of crypto ops in batch*/
56 /**< no. of ccp queue descriptors*/
58 /**< ccp queue head tail offsets time of enqueue*/
60 uint8_t lsb_buf[CCP_SB_BYTES * CCP_MAX_BURST];
61 phys_addr_t lsb_buf_phys;
62 /**< LSB intermediate buf for passthru */
64 } __rte_cache_aligned;
66 /**< CCP crypto queue pair */
69 /**< Queue Pair Identifier */
70 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
71 /**< Unique Queue Pair Name */
72 struct rte_ring *processed_pkts;
73 /**< Ring for placing process packets */
74 struct rte_mempool *sess_mp;
75 /**< Session Mempool */
76 struct rte_mempool *batch_mp;
77 /**< Session Mempool for batch info */
78 struct rte_cryptodev_stats qp_stats;
79 /**< Queue pair statistics */
80 struct ccp_batch_info *b_info;
81 /**< Store ops pulled out of queue */
82 struct rte_cryptodev *dev;
83 /**< rte crypto device to which this qp belongs */
84 } __rte_cache_aligned;
87 /**< device specific operations function pointer structure */
88 extern struct rte_cryptodev_ops *ccp_pmd_ops;
91 ccp_cpu_pmd_enqueue_burst(void *queue_pair,
92 struct rte_crypto_op **ops,
95 ccp_cpu_pmd_dequeue_burst(void *queue_pair,
96 struct rte_crypto_op **ops,
99 #endif /* _CCP_PMD_PRIVATE_H_ */