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 #define GCM_LOG_ERR(fmt, args...) \
14 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
15 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), \
16 __func__, __LINE__, ## args)
18 #ifdef RTE_LIBRTE_AESNI_MB_DEBUG
19 #define GCM_LOG_INFO(fmt, args...) \
20 RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
21 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), \
22 __func__, __LINE__, ## args)
24 #define GCM_LOG_DBG(fmt, args...) \
25 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
26 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), \
27 __func__, __LINE__, ## args)
29 #define GCM_LOG_INFO(fmt, args...)
30 #define GCM_LOG_DBG(fmt, args...)
33 /* Maximum length for digest */
34 #define DIGEST_LENGTH_MAX 16
36 /** private data structure for each virtual AESNI GCM device */
37 struct aesni_gcm_private {
38 enum aesni_gcm_vector_mode vector_mode;
40 unsigned max_nb_queue_pairs;
41 /**< Max number of queue pairs supported by device */
42 unsigned max_nb_sessions;
43 /**< Max number of sessions supported by device */
47 const struct aesni_gcm_ops *ops;
48 /**< Architecture dependent function pointer table of the gcm APIs */
49 struct rte_ring *processed_pkts;
50 /**< Ring for placing process packets */
51 struct gcm_context_data gdata_ctx; /* (16 * 5) + 8 = 88 B */
52 /**< GCM parameters */
53 struct rte_cryptodev_stats qp_stats; /* 8 * 4 = 32 B */
54 /**< Queue pair statistics */
55 struct rte_mempool *sess_mp;
56 /**< Session Mempool */
58 /**< Queue Pair Identifier */
59 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
60 /**< Unique Queue Pair Name */
61 uint8_t temp_digest[DIGEST_LENGTH_MAX];
62 /**< Buffer used to store the digest generated
63 * by the driver when verifying a digest provided
64 * by the user (using authentication verify operation)
66 } __rte_cache_aligned;
69 enum aesni_gcm_operation {
70 AESNI_GCM_OP_AUTHENTICATED_ENCRYPTION,
71 AESNI_GCM_OP_AUTHENTICATED_DECRYPTION,
72 AESNI_GMAC_OP_GENERATE,
76 /** AESNI GCM private session structure */
77 struct aesni_gcm_session {
85 uint16_t digest_length;
87 enum aesni_gcm_operation op;
88 /**< GCM operation type */
89 enum aesni_gcm_key key;
91 struct gcm_key_data gdata_key;
92 /**< GCM parameters */
97 * Setup GCM session parameters
98 * @param sess aesni gcm session structure
99 * @param xform crypto transform chain
102 * - On success returns 0
103 * - On failure returns error code < 0
106 aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *ops,
107 struct aesni_gcm_session *sess,
108 const struct rte_crypto_sym_xform *xform);
112 * Device specific operations function pointer structure */
113 extern struct rte_cryptodev_ops *rte_aesni_gcm_pmd_ops;
116 #endif /* _RTE_AESNI_GCM_PMD_PRIVATE_H_ */