1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Marvell International Ltd.
3 * Copyright(c) 2017 Semihalf.
7 #ifndef _RTE_MRVL_PMD_PRIVATE_H_
8 #define _RTE_MRVL_PMD_PRIVATE_H_
10 #include "rte_mrvl_compat.h"
12 #define CRYPTODEV_NAME_MRVL_PMD crypto_mvsam
13 /**< Marvell PMD device name */
15 #define MRVL_CRYPTO_LOG_ERR(fmt, args...) \
16 RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
17 RTE_STR(CRYPTODEV_NAME_MRVL_PMD), \
18 __func__, __LINE__, ## args)
20 #ifdef RTE_LIBRTE_PMD_MRVL_CRYPTO_DEBUG
21 #define MRVL_CRYPTO_LOG_INFO(fmt, args...) \
22 RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
23 RTE_STR(CRYPTODEV_NAME_MRVL_PMD), \
24 __func__, __LINE__, ## args)
26 #define MRVL_CRYPTO_LOG_DBG(fmt, args...) \
27 RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
28 RTE_STR(CRYPTODEV_NAME_MRVL_PMD), \
29 __func__, __LINE__, ## args)
32 #define MRVL_CRYPTO_LOG_INFO(fmt, args...)
33 #define MRVL_CRYPTO_LOG_DBG(fmt, args...)
37 * Handy bits->bytes conversion macro.
39 #define BITS2BYTES(x) ((x) >> 3)
41 /** The operation order mode enumerator. */
42 enum mrvl_crypto_chain_order {
43 MRVL_CRYPTO_CHAIN_CIPHER_ONLY,
44 MRVL_CRYPTO_CHAIN_AUTH_ONLY,
45 MRVL_CRYPTO_CHAIN_CIPHER_AUTH,
46 MRVL_CRYPTO_CHAIN_AUTH_CIPHER,
47 MRVL_CRYPTO_CHAIN_COMBINED,
48 MRVL_CRYPTO_CHAIN_NOT_SUPPORTED,
51 /** Private data structure for each crypto device. */
52 struct mrvl_crypto_private {
53 unsigned int max_nb_qpairs; /**< Max number of queue pairs */
54 unsigned int max_nb_sessions; /**< Max number of sessions */
57 /** MRVL crypto queue pair structure. */
58 struct mrvl_crypto_qp {
59 /** SAM CIO (MUSDK Queue Pair equivalent).*/
62 /** Session Mempool. */
63 struct rte_mempool *sess_mp;
65 /** Queue pair statistics. */
66 struct rte_cryptodev_stats stats;
68 /** CIO initialization parameters.*/
69 struct sam_cio_params cio_params;
70 } __rte_cache_aligned;
72 /** MRVL crypto private session structure. */
73 struct mrvl_crypto_session {
74 /** Crypto operations chain order. */
75 enum mrvl_crypto_chain_order chain_order;
77 /** Session initialization parameters. */
78 struct sam_session_params sam_sess_params;
80 /** SAM session pointer. */
81 struct sam_sa *sam_sess;
83 /** Cipher IV offset. */
84 uint16_t cipher_iv_offset;
85 } __rte_cache_aligned;
87 /** Set and validate MRVL crypto session parameters */
89 mrvl_crypto_set_session_parameters(struct mrvl_crypto_session *sess,
90 const struct rte_crypto_sym_xform *xform);
92 /** device specific operations function pointer structure */
93 extern struct rte_cryptodev_ops *rte_mrvl_crypto_pmd_ops;
95 #endif /* _RTE_MRVL_PMD_PRIVATE_H_ */