]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright(c) 2017 Marvell International Ltd. | |
3 | * Copyright(c) 2017 Semihalf. | |
4 | * All rights reserved. | |
5 | */ | |
6 | ||
7 | #ifndef _RTE_MRVL_PMD_PRIVATE_H_ | |
8 | #define _RTE_MRVL_PMD_PRIVATE_H_ | |
9 | ||
10 | #include "rte_mrvl_compat.h" | |
11 | ||
12 | #define CRYPTODEV_NAME_MRVL_PMD crypto_mvsam | |
13 | /**< Marvell PMD device name */ | |
14 | ||
9f95a23c TL |
15 | /** MRVL PMD LOGTYPE DRIVER */ |
16 | int mrvl_logtype_driver; | |
17 | ||
18 | #define MRVL_LOG(level, fmt, ...) \ | |
19 | rte_log(RTE_LOG_ ## level, mrvl_logtype_driver, \ | |
20 | "%s() line %u: " fmt "\n", __func__, __LINE__, \ | |
21 | ## __VA_ARGS__) | |
11fdf7f2 TL |
22 | |
23 | /** | |
24 | * Handy bits->bytes conversion macro. | |
25 | */ | |
26 | #define BITS2BYTES(x) ((x) >> 3) | |
27 | ||
9f95a23c TL |
28 | #define MRVL_MAX_SEGMENTS 16 |
29 | ||
11fdf7f2 TL |
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, | |
38 | }; | |
39 | ||
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 */ | |
44 | }; | |
45 | ||
46 | /** MRVL crypto queue pair structure. */ | |
47 | struct mrvl_crypto_qp { | |
48 | /** SAM CIO (MUSDK Queue Pair equivalent).*/ | |
49 | struct sam_cio *cio; | |
50 | ||
51 | /** Session Mempool. */ | |
52 | struct rte_mempool *sess_mp; | |
53 | ||
9f95a23c TL |
54 | /** Session Private Data Mempool. */ |
55 | struct rte_mempool *sess_mp_priv; | |
56 | ||
11fdf7f2 TL |
57 | /** Queue pair statistics. */ |
58 | struct rte_cryptodev_stats stats; | |
59 | ||
60 | /** CIO initialization parameters.*/ | |
61 | struct sam_cio_params cio_params; | |
62 | } __rte_cache_aligned; | |
63 | ||
64 | /** MRVL crypto private session structure. */ | |
65 | struct mrvl_crypto_session { | |
66 | /** Crypto operations chain order. */ | |
67 | enum mrvl_crypto_chain_order chain_order; | |
68 | ||
69 | /** Session initialization parameters. */ | |
70 | struct sam_session_params sam_sess_params; | |
71 | ||
72 | /** SAM session pointer. */ | |
73 | struct sam_sa *sam_sess; | |
74 | ||
75 | /** Cipher IV offset. */ | |
76 | uint16_t cipher_iv_offset; | |
77 | } __rte_cache_aligned; | |
78 | ||
9f95a23c TL |
79 | struct mrvl_crypto_src_table { |
80 | uint16_t iter_ops; | |
81 | struct sam_buf_info src_bd[MRVL_MAX_SEGMENTS]; | |
82 | } __rte_cache_aligned; | |
83 | ||
11fdf7f2 TL |
84 | /** Set and validate MRVL crypto session parameters */ |
85 | extern int | |
86 | mrvl_crypto_set_session_parameters(struct mrvl_crypto_session *sess, | |
87 | const struct rte_crypto_sym_xform *xform); | |
88 | ||
89 | /** device specific operations function pointer structure */ | |
90 | extern struct rte_cryptodev_ops *rte_mrvl_crypto_pmd_ops; | |
91 | ||
92 | #endif /* _RTE_MRVL_PMD_PRIVATE_H_ */ |