New upstream version 18.08
[deb_dpdk.git] / drivers / crypto / zuc / rte_zuc_pmd_private.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2018 Intel Corporation
3  */
4
5 #ifndef _RTE_ZUC_PMD_PRIVATE_H_
6 #define _RTE_ZUC_PMD_PRIVATE_H_
7
8 #include <sso_zuc.h>
9
10 #define CRYPTODEV_NAME_ZUC_PMD          crypto_zuc
11 /**< KASUMI PMD device name */
12
13 /** ZUC PMD LOGTYPE DRIVER */
14 int zuc_logtype_driver;
15 #define ZUC_LOG(level, fmt, ...)  \
16         rte_log(RTE_LOG_ ## level, zuc_logtype_driver,  \
17                         "%s()... line %u: " fmt "\n", __func__, __LINE__,  \
18                                 ## __VA_ARGS__)
19
20 #define ZUC_IV_KEY_LENGTH 16
21 #define ZUC_DIGEST_LENGTH 4
22
23 /** private data structure for each virtual ZUC device */
24 struct zuc_private {
25         unsigned max_nb_queue_pairs;
26         /**< Max number of queue pairs supported by device */
27 };
28
29 /** ZUC buffer queue pair */
30 struct zuc_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_cryptodev_stats qp_stats;
40         /**< Queue pair statistics */
41         uint8_t temp_digest[ZUC_DIGEST_LENGTH];
42         /**< Buffer used to store the digest generated
43          * by the driver when verifying a digest provided
44          * by the user (using authentication verify operation)
45          */
46 } __rte_cache_aligned;
47
48 enum zuc_operation {
49         ZUC_OP_ONLY_CIPHER,
50         ZUC_OP_ONLY_AUTH,
51         ZUC_OP_CIPHER_AUTH,
52         ZUC_OP_AUTH_CIPHER,
53         ZUC_OP_NOT_SUPPORTED
54 };
55
56 /** ZUC private session structure */
57 struct zuc_session {
58         enum zuc_operation op;
59         enum rte_crypto_auth_operation auth_op;
60         uint8_t pKey_cipher[ZUC_IV_KEY_LENGTH];
61         uint8_t pKey_hash[ZUC_IV_KEY_LENGTH];
62         uint16_t cipher_iv_offset;
63         uint16_t auth_iv_offset;
64 } __rte_cache_aligned;
65
66
67 extern int
68 zuc_set_session_parameters(struct zuc_session *sess,
69                 const struct rte_crypto_sym_xform *xform);
70
71
72 /** device specific operations function pointer structure */
73 extern struct rte_cryptodev_ops *rte_zuc_pmd_ops;
74
75
76
77 #endif /* _RTE_ZUC_PMD_PRIVATE_H_ */