cryptodev: change queue pair configure structure
[dpdk.git] / drivers / crypto / kasumi / rte_kasumi_pmd_private.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2018 Intel Corporation
3  */
4
5 #ifndef _RTE_KASUMI_PMD_PRIVATE_H_
6 #define _RTE_KASUMI_PMD_PRIVATE_H_
7
8 #include <sso_kasumi.h>
9
10 #define CRYPTODEV_NAME_KASUMI_PMD       crypto_kasumi
11 /**< KASUMI PMD device name */
12
13 /** KASUMI PMD LOGTYPE DRIVER */
14 int kasumi_logtype_driver;
15
16 #define KASUMI_LOG(level, fmt, ...)  \
17         rte_log(RTE_LOG_ ## level, kasumi_logtype_driver,  \
18                         "%s() line %u: " fmt "\n", __func__, __LINE__,  \
19                                         ## __VA_ARGS__)
20
21 #define KASUMI_DIGEST_LENGTH 4
22
23 /** private data structure for each virtual KASUMI device */
24 struct kasumi_private {
25         unsigned max_nb_queue_pairs;
26         /**< Max number of queue pairs supported by device */
27 };
28
29 /** KASUMI buffer queue pair */
30 struct kasumi_qp {
31         uint16_t id;
32         /**< Queue Pair Identifier */
33         char name[RTE_CRYPTODEV_NAME_MAX_LEN];
34         /**< Unique Queue Pair Name */
35         struct rte_ring *processed_ops;
36         /**< Ring for placing processed ops */
37         struct rte_mempool *sess_mp;
38         /**< Session Mempool */
39         struct rte_mempool *sess_mp_priv;
40         /**< Session Private Data Mempool */
41         struct rte_cryptodev_stats qp_stats;
42         /**< Queue pair statistics */
43         uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
44         /**< Buffer used to store the digest generated
45          * by the driver when verifying a digest provided
46          * by the user (using authentication verify operation)
47          */
48 } __rte_cache_aligned;
49
50 enum kasumi_operation {
51         KASUMI_OP_ONLY_CIPHER,
52         KASUMI_OP_ONLY_AUTH,
53         KASUMI_OP_CIPHER_AUTH,
54         KASUMI_OP_AUTH_CIPHER,
55         KASUMI_OP_NOT_SUPPORTED
56 };
57
58 /** KASUMI private session structure */
59 struct kasumi_session {
60         /* Keys have to be 16-byte aligned */
61         sso_kasumi_key_sched_t pKeySched_cipher;
62         sso_kasumi_key_sched_t pKeySched_hash;
63         enum kasumi_operation op;
64         enum rte_crypto_auth_operation auth_op;
65         uint16_t cipher_iv_offset;
66 } __rte_cache_aligned;
67
68
69 int
70 kasumi_set_session_parameters(struct kasumi_session *sess,
71                 const struct rte_crypto_sym_xform *xform);
72
73
74 /** device specific operations function pointer structure */
75 struct rte_cryptodev_ops *rte_kasumi_pmd_ops;
76
77 #endif /* _RTE_KASUMI_PMD_PRIVATE_H_ */