1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2019 Intel Corporation
5 #ifndef _SNOW3G_PMD_PRIVATE_H_
6 #define _SNOW3G_PMD_PRIVATE_H_
8 #include <intel-ipsec-mb.h>
10 #define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g
11 /**< SNOW 3G PMD device name */
13 /** SNOW 3G PMD LOGTYPE DRIVER */
14 extern int snow3g_logtype_driver;
16 #define SNOW3G_LOG(level, fmt, ...) \
17 rte_log(RTE_LOG_ ## level, snow3g_logtype_driver, \
18 "%s() line %u: " fmt "\n", __func__, __LINE__, \
21 #define SNOW3G_DIGEST_LENGTH 4
22 #define SNOW3G_MAX_KEY_SIZE 128
24 /** private data structure for each virtual SNOW 3G device */
25 struct snow3g_private {
26 unsigned max_nb_queue_pairs;
27 /**< Max number of queue pairs supported by device */
29 /**< Multi-buffer instance */
32 /** SNOW 3G buffer queue pair */
35 /**< Queue Pair Identifier */
36 char name[RTE_CRYPTODEV_NAME_MAX_LEN];
37 /**< Unique Queue Pair Name */
38 struct rte_ring *processed_ops;
39 /**< Ring for placing processed ops */
40 struct rte_mempool *sess_mp;
41 /**< Session Mempool */
42 struct rte_mempool *sess_mp_priv;
43 /**< Session Private Data Mempool */
44 struct rte_cryptodev_stats qp_stats;
45 /**< Queue pair statistics */
46 uint8_t temp_digest[SNOW3G_DIGEST_LENGTH];
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)
52 /**< Multi-buffer instance */
53 } __rte_cache_aligned;
55 enum snow3g_operation {
56 SNOW3G_OP_ONLY_CIPHER,
58 SNOW3G_OP_CIPHER_AUTH,
59 SNOW3G_OP_AUTH_CIPHER,
60 SNOW3G_OP_NOT_SUPPORTED
63 /** SNOW 3G private session structure */
64 struct snow3g_session {
65 enum snow3g_operation op;
66 enum rte_crypto_auth_operation auth_op;
67 snow3g_key_schedule_t pKeySched_cipher;
68 snow3g_key_schedule_t pKeySched_hash;
69 uint16_t cipher_iv_offset;
70 uint16_t auth_iv_offset;
71 } __rte_cache_aligned;
75 snow3g_set_session_parameters(MB_MGR *mgr, struct snow3g_session *sess,
76 const struct rte_crypto_sym_xform *xform);
79 /** device specific operations function pointer structure */
80 extern struct rte_cryptodev_ops *rte_snow3g_pmd_ops;
84 #endif /* _SNOW3G_PMD_PRIVATE_H_ */