xref: /dpdk/drivers/crypto/null/null_crypto_pmd_private.h (revision 3e0ceb9f17fff027fc6c8f18de35e11719ffa61e)
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2016 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Intel Corporation nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef _NULL_CRYPTO_PMD_PRIVATE_H_
34 #define _NULL_CRYPTO_PMD_PRIVATE_H_
35 
36 #define CRYPTODEV_NAME_NULL_PMD		crypto_null
37 /**< Null crypto PMD device name */
38 
39 #define NULL_CRYPTO_LOG_ERR(fmt, args...) \
40 	RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n",  \
41 			RTE_STR(CRYPTODEV_NAME_NULL_PMD), \
42 			__func__, __LINE__, ## args)
43 
44 #ifdef RTE_LIBRTE_NULL_CRYPTO_DEBUG
45 #define NULL_CRYPTO_LOG_INFO(fmt, args...) \
46 	RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
47 			RTE_STR(CRYPTODEV_NAME_NULL_PMD), \
48 			__func__, __LINE__, ## args)
49 
50 #define NULL_CRYPTO_LOG_DBG(fmt, args...) \
51 	RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
52 			RTE_STR(CRYPTODEV_NAME_NULL_PMD), \
53 			__func__, __LINE__, ## args)
54 #else
55 #define NULL_CRYPTO_LOG_INFO(fmt, args...)
56 #define NULL_CRYPTO_LOG_DBG(fmt, args...)
57 #endif
58 
59 
60 /** private data structure for each NULL crypto device */
61 struct null_crypto_private {
62 	unsigned max_nb_qpairs;		/**< Max number of queue pairs */
63 	unsigned max_nb_sessions;	/**< Max number of sessions */
64 };
65 
66 /** NULL crypto queue pair */
67 struct null_crypto_qp {
68 	uint16_t id;
69 	/**< Queue Pair Identifier */
70 	char name[RTE_CRYPTODEV_NAME_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_cryptodev_stats qp_stats;
77 	/**< Queue pair statistics */
78 } __rte_cache_aligned;
79 
80 
81 /** NULL crypto private session structure */
82 struct null_crypto_session {
83 	uint32_t reserved;
84 } __rte_cache_aligned;
85 
86 /** Set and validate NULL crypto session parameters */
87 extern int
88 null_crypto_set_session_parameters(struct null_crypto_session *sess,
89 		const struct rte_crypto_sym_xform *xform);
90 
91 /** device specific operations function pointer structure */
92 extern struct rte_cryptodev_ops *null_crypto_pmd_ops;
93 
94 #endif /* _NULL_CRYPTO_PMD_PRIVATE_H_ */
95