1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
5 #ifndef _RTE_AESNI_GCM_PMD_PRIVATE_H_
6 #define _RTE_AESNI_GCM_PMD_PRIVATE_H_
8 #include "aesni_gcm_ops.h"
10 #define CRYPTODEV_NAME_AESNI_GCM_PMD crypto_aesni_gcm
11 /**< AES-NI GCM PMD device name */
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__, \
20 /* Maximum length for digest */
21 #define DIGEST_LENGTH_MAX 16
23 /** private data structure for each virtual AESNI GCM device */
24 struct aesni_gcm_private {
25 enum aesni_gcm_vector_mode vector_mode;
27 unsigned max_nb_queue_pairs;
28 /**< Max number of queue pairs supported by device */
29 unsigned max_nb_sessions;
30 /**< Max number of sessions supported by device */
34 const struct aesni_gcm_ops *ops;
35 /**< Architecture dependent function pointer table of the gcm APIs */
36 struct rte_ring *processed_pkts;
37 /**< Ring for placing process packets */
38 struct gcm_context_data gdata_ctx; /* (16 * 5) + 8 = 88 B */
39 /**< GCM parameters */
40 struct rte_cryptodev_stats qp_stats; /* 8 * 4 = 32 B */
41 /**< Queue pair statistics */
42 struct rte_mempool *sess_mp;
43 /**< Session Mempool */
45 /**< Queue Pair Identifier */
46 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
47 /**< Unique Queue Pair Name */
48 uint8_t temp_digest[DIGEST_LENGTH_MAX];
49 /**< Buffer used to store the digest generated
50 * by the driver when verifying a digest provided
51 * by the user (using authentication verify operation)
53 } __rte_cache_aligned;
56 enum aesni_gcm_operation {
57 AESNI_GCM_OP_AUTHENTICATED_ENCRYPTION,
58 AESNI_GCM_OP_AUTHENTICATED_DECRYPTION,
59 AESNI_GMAC_OP_GENERATE,
63 /** AESNI GCM private session structure */
64 struct aesni_gcm_session {
72 uint16_t digest_length;
74 enum aesni_gcm_operation op;
75 /**< GCM operation type */
76 enum aesni_gcm_key key;
78 struct gcm_key_data gdata_key;
79 /**< GCM parameters */
84 * Setup GCM session parameters
85 * @param sess aesni gcm session structure
86 * @param xform crypto transform chain
89 * - On success returns 0
90 * - On failure returns error code < 0
93 aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *ops,
94 struct aesni_gcm_session *sess,
95 const struct rte_crypto_sym_xform *xform);
99 * Device specific operations function pointer structure */
100 extern struct rte_cryptodev_ops *rte_aesni_gcm_pmd_ops;
103 #endif /* _RTE_AESNI_GCM_PMD_PRIVATE_H_ */