4 * Copyright(c) 2016-2017 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_KASUMI_PMD_PRIVATE_H_
34 #define _RTE_KASUMI_PMD_PRIVATE_H_
36 #include <sso_kasumi.h>
38 #define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi
39 /**< KASUMI PMD device name */
41 #define KASUMI_LOG_ERR(fmt, args...) \
42 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
43 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
44 __func__, __LINE__, ## args)
46 #ifdef RTE_LIBRTE_KASUMI_DEBUG
47 #define KASUMI_LOG_INFO(fmt, args...) \
48 RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
49 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
50 __func__, __LINE__, ## args)
52 #define KASUMI_LOG_DBG(fmt, args...) \
53 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
54 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
55 __func__, __LINE__, ## args)
57 #define KASUMI_LOG_INFO(fmt, args...)
58 #define KASUMI_LOG_DBG(fmt, args...)
61 #define KASUMI_DIGEST_LENGTH 4
63 /** private data structure for each virtual KASUMI device */
64 struct kasumi_private {
65 unsigned max_nb_queue_pairs;
66 /**< Max number of queue pairs supported by device */
67 unsigned max_nb_sessions;
68 /**< Max number of sessions supported by device */
71 /** KASUMI buffer queue pair */
74 /**< Queue Pair Identifier */
75 char name[RTE_CRYPTODEV_NAME_LEN];
76 /**< Unique Queue Pair Name */
77 struct rte_ring *processed_ops;
78 /**< Ring for placing processed ops */
79 struct rte_mempool *sess_mp;
80 /**< Session Mempool */
81 struct rte_cryptodev_stats qp_stats;
82 /**< Queue pair statistics */
83 uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
84 /**< Buffer used to store the digest generated
85 * by the driver when verifying a digest provided
86 * by the user (using authentication verify operation)
88 } __rte_cache_aligned;
90 enum kasumi_operation {
91 KASUMI_OP_ONLY_CIPHER,
93 KASUMI_OP_CIPHER_AUTH,
94 KASUMI_OP_AUTH_CIPHER,
95 KASUMI_OP_NOT_SUPPORTED
98 /** KASUMI private session structure */
99 struct kasumi_session {
100 /* Keys have to be 16-byte aligned */
101 sso_kasumi_key_sched_t pKeySched_cipher;
102 sso_kasumi_key_sched_t pKeySched_hash;
103 enum kasumi_operation op;
104 enum rte_crypto_auth_operation auth_op;
105 uint16_t cipher_iv_offset;
106 } __rte_cache_aligned;
110 kasumi_set_session_parameters(struct kasumi_session *sess,
111 const struct rte_crypto_sym_xform *xform);
114 /** device specific operations function pointer structure */
115 struct rte_cryptodev_ops *rte_kasumi_pmd_ops;
117 #endif /* _RTE_KASUMI_PMD_PRIVATE_H_ */