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 */
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 */
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)
51 } __rte_cache_aligned;
54 enum aesni_gcm_operation {
55 AESNI_GCM_OP_AUTHENTICATED_ENCRYPTION,
56 AESNI_GCM_OP_AUTHENTICATED_DECRYPTION,
57 AESNI_GMAC_OP_GENERATE,
61 /** AESNI GCM private session structure */
62 struct aesni_gcm_session {
70 uint16_t digest_length;
72 enum aesni_gcm_operation op;
73 /**< GCM operation type */
74 enum aesni_gcm_key key;
76 struct gcm_key_data gdata_key;
77 /**< GCM parameters */
82 * Setup GCM session parameters
83 * @param sess aesni gcm session structure
84 * @param xform crypto transform chain
87 * - On success returns 0
88 * - On failure returns error code < 0
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);
97 * Device specific operations function pointer structure */
98 extern struct rte_cryptodev_ops *rte_aesni_gcm_pmd_ops;
101 #endif /* _RTE_AESNI_GCM_PMD_PRIVATE_H_ */