DPDK  17.02.1
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 #include <rte_common.h>
56 
57 #include "rte_crypto.h"
58 #include "rte_cryptodev.h"
59 
60 
61 #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
62 #define RTE_PMD_DEBUG_TRACE(...) \
63  rte_pmd_debug_trace(__func__, __VA_ARGS__)
64 #else
65 #define RTE_PMD_DEBUG_TRACE(...)
66 #endif
67 
68 struct rte_cryptodev_session {
70  struct {
71  uint8_t dev_id;
72  enum rte_cryptodev_type type;
73  struct rte_mempool *mp;
74  } __rte_aligned(8);
75 
76  __extension__ char _private[0];
77 };
78 
80 
98 typedef int (*cryptodev_init_t)(struct rte_cryptodev_driver *drv,
99  struct rte_cryptodev *dev);
100 
118 typedef int (*cryptodev_uninit_t)(const struct rte_cryptodev_driver *drv,
119  struct rte_cryptodev *dev);
120 
135  unsigned dev_private_size;
139 };
140 
141 
144  struct rte_cryptodev *devs;
145  struct rte_cryptodev_data *data[RTE_CRYPTO_MAX_DEVS];
147  uint8_t nb_devs;
148  uint8_t max_devs;
149 };
150 
153 
163 struct rte_cryptodev *
165 
174 struct rte_cryptodev *
175 rte_cryptodev_pmd_get_named_dev(const char *name);
176 
185 unsigned int
187 
191 extern struct rte_cryptodev *rte_cryptodevs;
192 
193 
207 typedef int (*cryptodev_configure_t)(struct rte_cryptodev *dev);
208 
216 typedef int (*cryptodev_start_t)(struct rte_cryptodev *dev);
217 
223 typedef void (*cryptodev_stop_t)(struct rte_cryptodev *dev);
224 
233 typedef int (*cryptodev_close_t)(struct rte_cryptodev *dev);
234 
235 
242 typedef void (*cryptodev_stats_get_t)(struct rte_cryptodev *dev,
243  struct rte_cryptodev_stats *stats);
244 
245 
251 typedef void (*cryptodev_stats_reset_t)(struct rte_cryptodev *dev);
252 
253 
259 typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev,
260  struct rte_cryptodev_info *dev_info);
261 
270 typedef int (*cryptodev_queue_pair_start_t)(struct rte_cryptodev *dev,
271  uint16_t qp_id);
272 
281 typedef int (*cryptodev_queue_pair_stop_t)(struct rte_cryptodev *dev,
282  uint16_t qp_id);
283 
294 typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev,
295  uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf,
296  int socket_id);
297 
309  uint16_t qp_id);
310 
318 typedef uint32_t (*cryptodev_queue_pair_count_t)(struct rte_cryptodev *dev);
319 
333  struct rte_cryptodev *dev, unsigned nb_objs,
334  unsigned obj_cache_size, int socket_id);
335 
336 
347  struct rte_cryptodev *dev);
348 
360 typedef void (*cryptodev_sym_initialize_session_t)(struct rte_mempool *mempool,
361  void *session_private);
362 
374 typedef void * (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
375  struct rte_crypto_sym_xform *xform, void *session_private);
376 
381 typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
382  void *session_private);
383 
384 
418 };
419 
420 
432 struct rte_cryptodev *
433 rte_cryptodev_pmd_allocate(const char *name, int socket_id);
434 
447 struct rte_cryptodev *
448 rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
449  int socket_id);
450 
451 
462 extern int
464 
476  enum rte_cryptodev_event_type event);
477 
482 int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
483  struct rte_pci_device *pci_dev);
484 
489 int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
490 
495 int
496 rte_cryptodev_pmd_create_dev_name(char *name, const char *dev_name_prefix);
497 
498 #ifdef __cplusplus
499 }
500 #endif
501 
502 #endif /* _RTE_CRYPTODEV_PMD_H_ */