cryptodev: remove max number of sessions parameter
[dpdk.git] / drivers / crypto / aesni_gcm / aesni_gcm_pmd_private.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2017 Intel Corporation
3  */
4
5 #ifndef _RTE_AESNI_GCM_PMD_PRIVATE_H_
6 #define _RTE_AESNI_GCM_PMD_PRIVATE_H_
7
8 #include "aesni_gcm_ops.h"
9
10 #define CRYPTODEV_NAME_AESNI_GCM_PMD    crypto_aesni_gcm
11 /**< AES-NI GCM PMD device name */
12
13 /** AES-NI GCM PMD  LOGTYPE DRIVER */
14 int aesni_gcm_logtype_driver;
15 #define AESNI_GCM_LOG(level, fmt, ...) \
16         rte_log(RTE_LOG_ ## level, aesni_gcm_logtype_driver,    \
17                         "%s() line %u: "fmt "\n", __func__, __LINE__,   \
18                                         ## __VA_ARGS__)
19
20 /* Maximum length for digest */
21 #define DIGEST_LENGTH_MAX 16
22
23 /** private data structure for each virtual AESNI GCM device */
24 struct aesni_gcm_private {
25         enum aesni_gcm_vector_mode vector_mode;
26         /**< Vector mode */
27         unsigned max_nb_queue_pairs;
28         /**< Max number of queue pairs supported by device */
29 };
30
31 struct aesni_gcm_qp {
32         const struct aesni_gcm_ops *ops;
33         /**< Architecture dependent function pointer table of the gcm APIs */
34         struct rte_ring *processed_pkts;
35         /**< Ring for placing process packets */
36         struct gcm_context_data gdata_ctx; /* (16 * 5) + 8 = 88 B */
37         /**< GCM parameters */
38         struct rte_cryptodev_stats qp_stats; /* 8 * 4 = 32 B */
39         /**< Queue pair statistics */
40         struct rte_mempool *sess_mp;
41         /**< Session Mempool */
42         uint16_t id;
43         /**< Queue Pair Identifier */
44         char name[RTE_CRYPTODEV_NAME_MAX_LEN];
45         /**< Unique Queue Pair Name */
46         uint8_t temp_digest[DIGEST_LENGTH_MAX];
47         /**< Buffer used to store the digest generated
48          * by the driver when verifying a digest provided
49          * by the user (using authentication verify operation)
50          */
51 } __rte_cache_aligned;
52
53
54 enum aesni_gcm_operation {
55         AESNI_GCM_OP_AUTHENTICATED_ENCRYPTION,
56         AESNI_GCM_OP_AUTHENTICATED_DECRYPTION,
57         AESNI_GMAC_OP_GENERATE,
58         AESNI_GMAC_OP_VERIFY
59 };
60
61 /** AESNI GCM private session structure */
62 struct aesni_gcm_session {
63         struct {
64                 uint16_t length;
65                 uint16_t offset;
66         } iv;
67         /**< IV parameters */
68         uint16_t aad_length;
69         /**< AAD length */
70         uint16_t digest_length;
71         /**< Digest length */
72         enum aesni_gcm_operation op;
73         /**< GCM operation type */
74         enum aesni_gcm_key key;
75         /**< GCM key type */
76         struct gcm_key_data gdata_key;
77         /**< GCM parameters */
78 };
79
80
81 /**
82  * Setup GCM session parameters
83  * @param       sess    aesni gcm session structure
84  * @param       xform   crypto transform chain
85  *
86  * @return
87  * - On success returns 0
88  * - On failure returns error code < 0
89  */
90 extern int
91 aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *ops,
92                 struct aesni_gcm_session *sess,
93                 const struct rte_crypto_sym_xform *xform);
94
95
96 /**
97  * Device specific operations function pointer structure */
98 extern struct rte_cryptodev_ops *rte_aesni_gcm_pmd_ops;
99
100
101 #endif /* _RTE_AESNI_GCM_PMD_PRIVATE_H_ */