]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*- |
2 | * BSD LICENSE | |
3 | * | |
11fdf7f2 TL |
4 | * Copyright (c) Intel Corporation. |
5 | * Copyright(c) 2016 6WIND S.A. | |
7c673cae FG |
6 | * All rights reserved. |
7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | |
11 | * | |
12 | * * Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | |
14 | * * Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in | |
16 | * the documentation and/or other materials provided with the | |
17 | * distribution. | |
18 | * * Neither the name of Intel Corporation nor the names of its | |
19 | * contributors may be used to endorse or promote products derived | |
20 | * from this software without specific prior written permission. | |
21 | * | |
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
26 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
11fdf7f2 | 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUcryptoION) HOWEVER CAUSED AND ON ANY |
7c673cae FG |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | |
34 | ||
11fdf7f2 TL |
35 | #ifndef _RTE_CRYPTO_H_ |
36 | #define _RTE_CRYPTO_H_ | |
7c673cae FG |
37 | |
38 | #ifdef __cplusplus | |
39 | extern "C" { | |
40 | #endif | |
41 | ||
11fdf7f2 TL |
42 | /* In order to mock some DPDK functions, we place headers here with the name name as the DPDK headers |
43 | * so these definitions wil be picked up. Only what's mocked is included. | |
44 | */ | |
7c673cae | 45 | |
11fdf7f2 TL |
46 | #include "rte_mbuf.h" |
47 | #include "rte_mempool.h" | |
48 | #include "rte_crypto_sym.h" | |
7c673cae | 49 | |
11fdf7f2 TL |
50 | enum rte_crypto_op_type { |
51 | RTE_CRYPTO_OP_TYPE_UNDEFINED, | |
52 | RTE_CRYPTO_OP_TYPE_SYMMETRIC, | |
7c673cae FG |
53 | }; |
54 | ||
11fdf7f2 TL |
55 | enum rte_crypto_op_status { |
56 | RTE_CRYPTO_OP_STATUS_SUCCESS, | |
57 | RTE_CRYPTO_OP_STATUS_NOT_PROCESSED, | |
58 | RTE_CRYPTO_OP_STATUS_AUTH_FAILED, | |
59 | RTE_CRYPTO_OP_STATUS_INVALID_SESSION, | |
60 | RTE_CRYPTO_OP_STATUS_INVALID_ARGS, | |
61 | RTE_CRYPTO_OP_STATUS_ERROR, | |
62 | }; | |
7c673cae | 63 | |
11fdf7f2 TL |
64 | struct rte_crypto_op { |
65 | uint8_t type; | |
66 | uint8_t status; | |
67 | uint8_t sess_type; | |
68 | uint8_t reserved[5]; | |
69 | struct rte_mempool *mempool; | |
70 | rte_iova_t phys_addr; | |
71 | __extension__ | |
72 | union { | |
73 | struct rte_crypto_sym_op sym[0]; | |
74 | }; | |
7c673cae FG |
75 | }; |
76 | ||
11fdf7f2 TL |
77 | extern struct rte_mempool * |
78 | rte_crypto_op_pool_create(const char *name, enum rte_crypto_op_type type, | |
79 | unsigned nb_elts, unsigned cache_size, uint16_t priv_size, | |
80 | int socket_id); | |
81 | ||
82 | static inline unsigned | |
83 | rte_crypto_op_bulk_alloc(struct rte_mempool *mempool, | |
84 | enum rte_crypto_op_type type, | |
85 | struct rte_crypto_op **ops, uint16_t nb_ops); | |
86 | ||
87 | static inline int | |
88 | rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, | |
89 | struct rte_cryptodev_sym_session *sess); | |
7c673cae FG |
90 | |
91 | #ifdef __cplusplus | |
92 | } | |
93 | #endif | |
94 | ||
95 | #endif |