4 * Copyright(c) 2016 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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
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.
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.
33 #ifndef _RTE_SNOW3G_PMD_PRIVATE_H_
34 #define _RTE_SNOW3G_PMD_PRIVATE_H_
36 #include <sso_snow3g.h>
38 #define SNOW3G_LOG_ERR(fmt, args...) \
39 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
40 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), \
41 __func__, __LINE__, ## args)
43 #ifdef RTE_LIBRTE_SNOW3G_DEBUG
44 #define SNOW3G_LOG_INFO(fmt, args...) \
45 RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
46 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), \
47 __func__, __LINE__, ## args)
49 #define SNOW3G_LOG_DBG(fmt, args...) \
50 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
51 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), \
52 __func__, __LINE__, ## args)
54 #define SNOW3G_LOG_INFO(fmt, args...)
55 #define SNOW3G_LOG_DBG(fmt, args...)
58 /** private data structure for each virtual SNOW 3G device */
59 struct snow3g_private {
60 unsigned max_nb_queue_pairs;
61 /**< Max number of queue pairs supported by device */
62 unsigned max_nb_sessions;
63 /**< Max number of sessions supported by device */
66 /** SNOW 3G buffer queue pair */
69 /**< Queue Pair Identifier */
70 char name[RTE_CRYPTODEV_NAME_LEN];
71 /**< Unique Queue Pair Name */
72 struct rte_ring *processed_ops;
73 /**< Ring for placing processed ops */
74 struct rte_mempool *sess_mp;
75 /**< Session Mempool */
76 struct rte_cryptodev_stats qp_stats;
77 /**< Queue pair statistics */
78 } __rte_cache_aligned;
80 enum snow3g_operation {
81 SNOW3G_OP_ONLY_CIPHER,
83 SNOW3G_OP_CIPHER_AUTH,
84 SNOW3G_OP_AUTH_CIPHER,
85 SNOW3G_OP_NOT_SUPPORTED
88 /** SNOW 3G private session structure */
89 struct snow3g_session {
90 enum snow3g_operation op;
91 enum rte_crypto_auth_operation auth_op;
92 sso_snow3g_key_schedule_t pKeySched_cipher;
93 sso_snow3g_key_schedule_t pKeySched_hash;
94 } __rte_cache_aligned;
98 snow3g_set_session_parameters(struct snow3g_session *sess,
99 const struct rte_crypto_sym_xform *xform);
102 /** device specific operations function pointer structure */
103 extern struct rte_cryptodev_ops *rte_snow3g_pmd_ops;
107 #endif /* _RTE_SNOW3G_PMD_PRIVATE_H_ */