DPDK
2.2.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 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
struct
rte_cryptodev_stats
;
60
struct
rte_cryptodev_info
;
61
struct
rte_cryptodev_qp_conf
;
62
63
enum
rte_cryptodev_event_type
;
64
65
#ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
66
#define RTE_PMD_DEBUG_TRACE(...) \
67
rte_pmd_debug_trace(__func__, __VA_ARGS__)
68
#else
69
#define RTE_PMD_DEBUG_TRACE(fmt, args...)
70
#endif
71
72
struct
rte_cryptodev_session {
73
struct
{
74
uint8_t dev_id;
75
enum
rte_cryptodev_type
type;
76
struct
rte_mempool
*mp;
77
}
__rte_aligned
(8);
78
79
char
_private[0];
80
};
81
82
struct
rte_cryptodev_driver
;
83
struct
rte_cryptodev
;
84
102
typedef
int (*
cryptodev_init_t
)(
struct
rte_cryptodev_driver
*drv,
103
struct
rte_cryptodev
*dev);
104
122
typedef
int (*
cryptodev_uninit_t
)(
const
struct
rte_cryptodev_driver
*drv,
123
struct
rte_cryptodev
*dev);
124
137
struct
rte_cryptodev_driver
{
138
struct
rte_pci_driver
pci_drv
;
139
unsigned
dev_private_size
;
141
cryptodev_init_t
cryptodev_init
;
142
cryptodev_uninit_t
cryptodev_uninit
;
143
};
144
145
147
struct
rte_cryptodev_global
{
148
struct
rte_cryptodev
*
devs
;
149
struct
rte_cryptodev_data
*
data
[RTE_CRYPTO_MAX_DEVS];
151
uint8_t
nb_devs
;
152
uint8_t
max_devs
;
153
};
154
156
extern
struct
rte_cryptodev_global
*
rte_cryptodev_globals
;
157
167
static
inline
struct
rte_cryptodev
*
168
rte_cryptodev_pmd_get_dev
(uint8_t dev_id)
169
{
170
return
&rte_cryptodev_globals->
devs
[dev_id];
171
}
172
181
static
inline
struct
rte_cryptodev
*
182
rte_cryptodev_pmd_get_named_dev
(
const
char
*name)
183
{
184
struct
rte_cryptodev
*dev;
185
unsigned
i;
186
187
if
(name == NULL)
188
return
NULL;
189
190
for
(i = 0, dev = &rte_cryptodev_globals->
devs
[i];
191
i < rte_cryptodev_globals->max_devs; i++) {
192
if
((dev->
attached
== RTE_CRYPTODEV_ATTACHED) &&
193
(strcmp(dev->
data
->
name
, name) == 0))
194
return
dev;
195
}
196
197
return
NULL;
198
}
199
208
static
inline
unsigned
209
rte_cryptodev_pmd_is_valid_dev
(uint8_t dev_id)
210
{
211
struct
rte_cryptodev
*dev = NULL;
212
213
if
(dev_id >= rte_cryptodev_globals->
nb_devs
)
214
return
0;
215
216
dev =
rte_cryptodev_pmd_get_dev
(dev_id);
217
if
(dev->
attached
!= RTE_CRYPTODEV_ATTACHED)
218
return
0;
219
else
220
return
1;
221
}
222
226
extern
struct
rte_cryptodev
*rte_cryptodevs;
227
228
242
typedef
int (*
cryptodev_configure_t
)(
struct
rte_cryptodev
*dev);
243
251
typedef
int (*
cryptodev_start_t
)(
struct
rte_cryptodev
*dev);
252
258
typedef
void (*
cryptodev_stop_t
)(
struct
rte_cryptodev
*dev);
259
268
typedef
int (*
cryptodev_close_t
)(
struct
rte_cryptodev
*dev);
269
270
277
typedef
void (*
cryptodev_stats_get_t
)(
struct
rte_cryptodev
*dev,
278
struct
rte_cryptodev_stats
*stats);
279
280
286
typedef
void (*
cryptodev_stats_reset_t
)(
struct
rte_cryptodev
*dev);
287
288
294
typedef
void (*
cryptodev_info_get_t
)(
struct
rte_cryptodev
*dev,
295
struct
rte_cryptodev_info
*dev_info);
296
305
typedef
int (*
cryptodev_queue_pair_start_t
)(
struct
rte_cryptodev
*dev,
306
uint16_t qp_id);
307
316
typedef
int (*
cryptodev_queue_pair_stop_t
)(
struct
rte_cryptodev
*dev,
317
uint16_t qp_id);
318
329
typedef
int (*
cryptodev_queue_pair_setup_t
)(
struct
rte_cryptodev
*dev,
330
uint16_t qp_id,
const
struct
rte_cryptodev_qp_conf
*qp_conf,
331
int
socket_id);
332
343
typedef
int (*
cryptodev_queue_pair_release_t
)(
struct
rte_cryptodev
*dev,
344
uint16_t qp_id);
345
353
typedef
uint32_t (*
cryptodev_queue_pair_count_t
)(
struct
rte_cryptodev
*dev);
354
367
typedef
int (*
cryptodev_create_session_pool_t
)(
368
struct
rte_cryptodev
*dev,
unsigned
nb_objs,
369
unsigned
obj_cache_size,
int
socket_id);
370
371
381
typedef
unsigned (*
cryptodev_get_session_private_size_t
)(
382
struct
rte_cryptodev
*dev);
383
395
typedef
void (*
cryptodev_initialize_session_t
)(
struct
rte_mempool
*mempool,
396
void
*session_private);
397
409
typedef
void
* (*cryptodev_configure_session_t)(
struct
rte_cryptodev
*dev,
410
struct
rte_crypto_xform
*xform,
void
*session_private);
411
416
typedef
void (*
cryptodev_free_session_t
)(
struct
rte_cryptodev
*dev,
417
void
*session_private);
418
419
421
struct
rte_cryptodev_ops
{
422
cryptodev_configure_t
dev_configure
;
423
cryptodev_start_t
dev_start
;
424
cryptodev_stop_t
dev_stop
;
425
cryptodev_close_t
dev_close
;
427
cryptodev_info_get_t
dev_infos_get
;
429
cryptodev_stats_get_t
stats_get
;
431
cryptodev_stats_reset_t
stats_reset
;
434
cryptodev_queue_pair_setup_t
queue_pair_setup
;
436
cryptodev_queue_pair_release_t
queue_pair_release
;
438
cryptodev_queue_pair_start_t
queue_pair_start
;
440
cryptodev_queue_pair_stop_t
queue_pair_stop
;
442
cryptodev_queue_pair_count_t
queue_pair_count
;
445
cryptodev_get_session_private_size_t
session_get_size
;
447
cryptodev_initialize_session_t
session_initialize
;
449
cryptodev_configure_session_t
session_configure
;
451
cryptodev_free_session_t
session_clear
;
453
};
454
455
468
struct
rte_cryptodev
*
469
rte_cryptodev_pmd_allocate
(
const
char
*name,
enum
pmd_type
type,
int
socket_id);
470
483
struct
rte_cryptodev
*
484
rte_cryptodev_pmd_virtual_dev_init
(
const
char
*name,
size_t
dev_private_size,
485
int
socket_id);
486
487
498
extern
int
499
rte_cryptodev_pmd_release_device
(
struct
rte_cryptodev
*cryptodev);
500
501
527
extern
int
528
rte_cryptodev_pmd_driver_register
(
struct
rte_cryptodev_driver
*crypto_drv,
529
enum
pmd_type
type);
530
541
void
rte_cryptodev_pmd_callback_process
(
struct
rte_cryptodev
*dev,
542
enum
rte_cryptodev_event_type
event);
543
544
545
#ifdef __cplusplus
546
}
547
#endif
548
549
#endif
/* _RTE_CRYPTODEV_PMD_H_ */
Generated by
1.8.1.2