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 /** MRVL PMD LOGTYPE DRIVER */
16 int mrvl_logtype_driver;
18 #define MRVL_LOG(level, fmt, ...) \
19 rte_log(RTE_LOG_ ## level, mrvl_logtype_driver, \
20 "%s() line %u: " fmt "\n", __func__, __LINE__, \
24 * Handy bits->bytes conversion macro.
26 #define BITS2BYTES(x) ((x) >> 3)
28 #define MRVL_MAX_SEGMENTS 16
30 /** The operation order mode enumerator. */
31 enum mrvl_crypto_chain_order {
32 MRVL_CRYPTO_CHAIN_CIPHER_ONLY,
33 MRVL_CRYPTO_CHAIN_AUTH_ONLY,
34 MRVL_CRYPTO_CHAIN_CIPHER_AUTH,
35 MRVL_CRYPTO_CHAIN_AUTH_CIPHER,
36 MRVL_CRYPTO_CHAIN_COMBINED,
37 MRVL_CRYPTO_CHAIN_NOT_SUPPORTED,
40 /** Private data structure for each crypto device. */
41 struct mrvl_crypto_private {
42 unsigned int max_nb_qpairs; /**< Max number of queue pairs */
43 unsigned int max_nb_sessions; /**< Max number of sessions */
46 /** MRVL crypto queue pair structure. */
47 struct mrvl_crypto_qp {
48 /** SAM CIO (MUSDK Queue Pair equivalent).*/
51 /** Session Mempool. */
52 struct rte_mempool *sess_mp;
54 /** Session Private Data Mempool. */
55 struct rte_mempool *sess_mp_priv;
57 /** Queue pair statistics. */
58 struct rte_cryptodev_stats stats;
60 /** CIO initialization parameters.*/
61 struct sam_cio_params cio_params;
62 } __rte_cache_aligned;
64 /** MRVL crypto private session structure. */
65 struct mrvl_crypto_session {
66 /** Crypto operations chain order. */
67 enum mrvl_crypto_chain_order chain_order;
69 /** Session initialization parameters. */
70 struct sam_session_params sam_sess_params;
72 /** SAM session pointer. */
73 struct sam_sa *sam_sess;
75 /** Cipher IV offset. */
76 uint16_t cipher_iv_offset;
77 } __rte_cache_aligned;
79 struct mrvl_crypto_src_table {
81 struct sam_buf_info src_bd[MRVL_MAX_SEGMENTS];
82 } __rte_cache_aligned;
84 /** Set and validate MRVL crypto session parameters */
86 mrvl_crypto_set_session_parameters(struct mrvl_crypto_session *sess,
87 const struct rte_crypto_sym_xform *xform);
89 /** device specific operations function pointer structure */
90 extern struct rte_cryptodev_ops *rte_mrvl_crypto_pmd_ops;
92 #endif /* _RTE_MRVL_PMD_PRIVATE_H_ */