1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
5 #ifndef _RTE_SNOW3G_PMD_PRIVATE_H_
6 #define _RTE_SNOW3G_PMD_PRIVATE_H_
8 #include <sso_snow3g.h>
10 #define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g
11 /**< SNOW 3G PMD device name */
13 #define SNOW3G_LOG_ERR(fmt, args...) \
14 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
15 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), \
16 __func__, __LINE__, ## args)
18 #ifdef RTE_LIBRTE_SNOW3G_DEBUG
19 #define SNOW3G_LOG_INFO(fmt, args...) \
20 RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
21 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), \
22 __func__, __LINE__, ## args)
24 #define SNOW3G_LOG_DBG(fmt, args...) \
25 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
26 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), \
27 __func__, __LINE__, ## args)
29 #define SNOW3G_LOG_INFO(fmt, args...)
30 #define SNOW3G_LOG_DBG(fmt, args...)
33 #define SNOW3G_DIGEST_LENGTH 4
35 /** private data structure for each virtual SNOW 3G device */
36 struct snow3g_private {
37 unsigned max_nb_queue_pairs;
38 /**< Max number of queue pairs supported by device */
39 unsigned max_nb_sessions;
40 /**< Max number of sessions supported by device */
43 /** SNOW 3G buffer queue pair */
46 /**< Queue Pair Identifier */
47 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
48 /**< Unique Queue Pair Name */
49 struct rte_ring *processed_ops;
50 /**< Ring for placing processed ops */
51 struct rte_mempool *sess_mp;
52 /**< Session Mempool */
53 struct rte_cryptodev_stats qp_stats;
54 /**< Queue pair statistics */
55 uint8_t temp_digest[SNOW3G_DIGEST_LENGTH];
56 /**< Buffer used to store the digest generated
57 * by the driver when verifying a digest provided
58 * by the user (using authentication verify operation)
60 } __rte_cache_aligned;
62 enum snow3g_operation {
63 SNOW3G_OP_ONLY_CIPHER,
65 SNOW3G_OP_CIPHER_AUTH,
66 SNOW3G_OP_AUTH_CIPHER,
67 SNOW3G_OP_NOT_SUPPORTED
70 /** SNOW 3G private session structure */
71 struct snow3g_session {
72 enum snow3g_operation op;
73 enum rte_crypto_auth_operation auth_op;
74 sso_snow3g_key_schedule_t pKeySched_cipher;
75 sso_snow3g_key_schedule_t pKeySched_hash;
76 uint16_t cipher_iv_offset;
77 uint16_t auth_iv_offset;
78 } __rte_cache_aligned;
82 snow3g_set_session_parameters(struct snow3g_session *sess,
83 const struct rte_crypto_sym_xform *xform);
86 /** device specific operations function pointer structure */
87 extern struct rte_cryptodev_ops *rte_snow3g_pmd_ops;
91 #endif /* _RTE_SNOW3G_PMD_PRIVATE_H_ */