DPDK
16.04.0
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_cryptodev
rte_cryptodev_pmd.h
Go to the documentation of this file.
1
/*-
2
*
3
* Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
*
9
* * Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* * Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in
13
* the documentation and/or other materials provided with the
14
* distribution.
15
* * Neither the name of Intel Corporation nor the names of its
16
* contributors may be used to endorse or promote products derived
17
* from this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
*/
31
32
#ifndef _RTE_CRYPTODEV_PMD_H_
33
#define _RTE_CRYPTODEV_PMD_H_
34
43
#ifdef __cplusplus
44
extern
"C"
{
45
#endif
46
47
#include <string.h>
48
49
#include <
rte_dev.h
>
50
#include <
rte_pci.h
>
51
#include <
rte_malloc.h
>
52
#include <
rte_mbuf.h
>
53
#include <
rte_mempool.h
>
54
#include <
rte_log.h
>
55
56
#include "
rte_crypto.h
"
57
#include "
rte_cryptodev.h
"
58
59
60
#ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
61
#define RTE_PMD_DEBUG_TRACE(...) \
62
rte_pmd_debug_trace(__func__, __VA_ARGS__)
63
#else
64
#define RTE_PMD_DEBUG_TRACE(fmt, args...)
65
#endif
66
67
struct
rte_cryptodev_session {
68
struct
{
69
uint8_t
dev_id
;
70
enum
rte_cryptodev_type
type;
71
struct
rte_mempool
*
mp
;
72
}
__rte_aligned
(8);
73
74
char
_private[0];
75
};
76
77
struct
rte_cryptodev_driver
;
78
96
typedef
int (*
cryptodev_init_t
)(
struct
rte_cryptodev_driver
*drv,
97
struct
rte_cryptodev
*dev);
98
116
typedef
int (*
cryptodev_uninit_t
)(
const
struct
rte_cryptodev_driver
*drv,
117
struct
rte_cryptodev
*dev);
118
131
struct
rte_cryptodev_driver
{
132
struct
rte_pci_driver
pci_drv
;
133
unsigned
dev_private_size
;
135
cryptodev_init_t
cryptodev_init
;
136
cryptodev_uninit_t
cryptodev_uninit
;
137
};
138
139
141
struct
rte_cryptodev_global
{
142
struct
rte_cryptodev
*
devs
;
143
struct
rte_cryptodev_data
*
data
[RTE_CRYPTO_MAX_DEVS];
145
uint8_t
nb_devs
;
146
uint8_t
max_devs
;
147
};
148
150
extern
struct
rte_cryptodev_global
*
rte_cryptodev_globals
;
151
161
static
inline
struct
rte_cryptodev
*
162
rte_cryptodev_pmd_get_dev
(uint8_t
dev_id
)
163
{
164
return
&rte_cryptodev_globals->
devs
[
dev_id
];
165
}
166
175
static
inline
struct
rte_cryptodev
*
176
rte_cryptodev_pmd_get_named_dev
(
const
char
*name)
177
{
178
struct
rte_cryptodev
*dev;
179
unsigned
i;
180
181
if
(name == NULL)
182
return
NULL;
183
184
for
(i = 0, dev = &rte_cryptodev_globals->
devs
[i];
185
i < rte_cryptodev_globals->max_devs; i++) {
186
if
((dev->
attached
== RTE_CRYPTODEV_ATTACHED) &&
187
(strcmp(dev->
data
->
name
, name) == 0))
188
return
dev;
189
}
190
191
return
NULL;
192
}
193
202
static
inline
unsigned
203
rte_cryptodev_pmd_is_valid_dev
(uint8_t
dev_id
)
204
{
205
struct
rte_cryptodev
*dev = NULL;
206
207
if
(dev_id >= rte_cryptodev_globals->
nb_devs
)
208
return
0;
209
210
dev =
rte_cryptodev_pmd_get_dev
(dev_id);
211
if
(dev->
attached
!= RTE_CRYPTODEV_ATTACHED)
212
return
0;
213
else
214
return
1;
215
}
216
220
extern
struct
rte_cryptodev
*rte_cryptodevs;
221
222
236
typedef
int (*
cryptodev_configure_t
)(
struct
rte_cryptodev
*dev);
237
245
typedef
int (*
cryptodev_start_t
)(
struct
rte_cryptodev
*dev);
246
252
typedef
void (*
cryptodev_stop_t
)(
struct
rte_cryptodev
*dev);
253
262
typedef
int (*
cryptodev_close_t
)(
struct
rte_cryptodev
*dev);
263
264
271
typedef
void (*
cryptodev_stats_get_t
)(
struct
rte_cryptodev
*dev,
272
struct
rte_cryptodev_stats
*stats);
273
274
280
typedef
void (*
cryptodev_stats_reset_t
)(
struct
rte_cryptodev
*dev);
281
282
288
typedef
void (*
cryptodev_info_get_t
)(
struct
rte_cryptodev
*dev,
289
struct
rte_cryptodev_info
*dev_info);
290
299
typedef
int (*
cryptodev_queue_pair_start_t
)(
struct
rte_cryptodev
*dev,
300
uint16_t qp_id);
301
310
typedef
int (*
cryptodev_queue_pair_stop_t
)(
struct
rte_cryptodev
*dev,
311
uint16_t qp_id);
312
323
typedef
int (*
cryptodev_queue_pair_setup_t
)(
struct
rte_cryptodev
*dev,
324
uint16_t qp_id,
const
struct
rte_cryptodev_qp_conf
*qp_conf,
325
int
socket_id);
326
337
typedef
int (*
cryptodev_queue_pair_release_t
)(
struct
rte_cryptodev
*dev,
338
uint16_t qp_id);
339
347
typedef
uint32_t (*
cryptodev_queue_pair_count_t
)(
struct
rte_cryptodev
*dev);
348
361
typedef
int (*
cryptodev_sym_create_session_pool_t
)(
362
struct
rte_cryptodev
*dev,
unsigned
nb_objs,
363
unsigned
obj_cache_size,
int
socket_id);
364
365
375
typedef
unsigned (*
cryptodev_sym_get_session_private_size_t
)(
376
struct
rte_cryptodev
*dev);
377
389
typedef
void (*
cryptodev_sym_initialize_session_t
)(
struct
rte_mempool
*mempool,
390
void
*session_private);
391
403
typedef
void
* (*cryptodev_sym_configure_session_t)(
struct
rte_cryptodev
*dev,
404
struct
rte_crypto_sym_xform
*xform,
void
*session_private);
405
410
typedef
void (*
cryptodev_sym_free_session_t
)(
struct
rte_cryptodev
*dev,
411
void
*session_private);
412
413
415
struct
rte_cryptodev_ops
{
416
cryptodev_configure_t
dev_configure
;
417
cryptodev_start_t
dev_start
;
418
cryptodev_stop_t
dev_stop
;
419
cryptodev_close_t
dev_close
;
421
cryptodev_info_get_t
dev_infos_get
;
423
cryptodev_stats_get_t
stats_get
;
425
cryptodev_stats_reset_t
stats_reset
;
428
cryptodev_queue_pair_setup_t
queue_pair_setup
;
430
cryptodev_queue_pair_release_t
queue_pair_release
;
432
cryptodev_queue_pair_start_t
queue_pair_start
;
434
cryptodev_queue_pair_stop_t
queue_pair_stop
;
436
cryptodev_queue_pair_count_t
queue_pair_count
;
439
cryptodev_sym_get_session_private_size_t
session_get_size
;
441
cryptodev_sym_initialize_session_t
session_initialize
;
443
cryptodev_sym_configure_session_t
session_configure
;
445
cryptodev_sym_free_session_t
session_clear
;
447
};
448
449
462
struct
rte_cryptodev
*
463
rte_cryptodev_pmd_allocate
(
const
char
*name,
enum
pmd_type
type,
int
socket_id);
464
477
struct
rte_cryptodev
*
478
rte_cryptodev_pmd_virtual_dev_init
(
const
char
*name,
size_t
dev_private_size,
479
int
socket_id);
480
481
492
extern
int
493
rte_cryptodev_pmd_release_device
(
struct
rte_cryptodev
*cryptodev);
494
495
521
extern
int
522
rte_cryptodev_pmd_driver_register
(
struct
rte_cryptodev_driver
*crypto_drv,
523
enum
pmd_type
type);
524
535
void
rte_cryptodev_pmd_callback_process
(
struct
rte_cryptodev
*dev,
536
enum
rte_cryptodev_event_type
event);
537
538
539
#ifdef __cplusplus
540
}
541
#endif
542
543
#endif
/* _RTE_CRYPTODEV_PMD_H_ */
Generated by
1.8.1.2