DPDK  17.05.2
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 struct rte_cryptodev_session {
62  struct {
63  uint8_t dev_id;
64  enum rte_cryptodev_type type;
65  struct rte_mempool *mp;
66  } __rte_aligned(8);
67 
68  __extension__ char _private[0];
69 };
70 
72 
90 typedef int (*cryptodev_init_t)(struct rte_cryptodev_driver *drv,
91  struct rte_cryptodev *dev);
92 
110 typedef int (*cryptodev_uninit_t)(const struct rte_cryptodev_driver *drv,
111  struct rte_cryptodev *dev);
112 
127  unsigned dev_private_size;
131 };
132 
133 
136  struct rte_cryptodev *devs;
137  struct rte_cryptodev_data *data[RTE_CRYPTO_MAX_DEVS];
139  uint8_t nb_devs;
140  uint8_t max_devs;
141 };
142 
145 
155 struct rte_cryptodev *
157 
166 struct rte_cryptodev *
167 rte_cryptodev_pmd_get_named_dev(const char *name);
168 
177 unsigned int
179 
183 extern struct rte_cryptodev *rte_cryptodevs;
184 
185 
200 typedef int (*cryptodev_configure_t)(struct rte_cryptodev *dev,
201  struct rte_cryptodev_config *config);
202 
210 typedef int (*cryptodev_start_t)(struct rte_cryptodev *dev);
211 
217 typedef void (*cryptodev_stop_t)(struct rte_cryptodev *dev);
218 
227 typedef int (*cryptodev_close_t)(struct rte_cryptodev *dev);
228 
229 
236 typedef void (*cryptodev_stats_get_t)(struct rte_cryptodev *dev,
237  struct rte_cryptodev_stats *stats);
238 
239 
245 typedef void (*cryptodev_stats_reset_t)(struct rte_cryptodev *dev);
246 
247 
253 typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev,
254  struct rte_cryptodev_info *dev_info);
255 
264 typedef int (*cryptodev_queue_pair_start_t)(struct rte_cryptodev *dev,
265  uint16_t qp_id);
266 
275 typedef int (*cryptodev_queue_pair_stop_t)(struct rte_cryptodev *dev,
276  uint16_t qp_id);
277 
288 typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev,
289  uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf,
290  int socket_id);
291 
303  uint16_t qp_id);
304 
312 typedef uint32_t (*cryptodev_queue_pair_count_t)(struct rte_cryptodev *dev);
313 
327  struct rte_cryptodev *dev, unsigned nb_objs,
328  unsigned obj_cache_size, int socket_id);
329 
330 
341  struct rte_cryptodev *dev);
342 
354 typedef void (*cryptodev_sym_initialize_session_t)(struct rte_mempool *mempool,
355  void *session_private);
356 
368 typedef void * (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
369  struct rte_crypto_sym_xform *xform, void *session_private);
370 
375 typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev,
376  void *session_private);
377 
387  struct rte_cryptodev *dev,
388  uint16_t qp_id,
389  void *session_private);
390 
400  struct rte_cryptodev *dev,
401  uint16_t qp_id,
402  void *session_private);
403 
441 };
442 
443 
455 struct rte_cryptodev *
456 rte_cryptodev_pmd_allocate(const char *name, int socket_id);
457 
470 struct rte_cryptodev *
471 rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
472  int socket_id);
473 
474 
485 extern int
487 
499  enum rte_cryptodev_event_type event);
500 
505 int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
506  struct rte_pci_device *pci_dev);
507 
512 int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
513 
518 int
519 rte_cryptodev_pmd_create_dev_name(char *name, const char *dev_name_prefix);
520 
521 #ifdef __cplusplus
522 }
523 #endif
524 
525 #endif /* _RTE_CRYPTODEV_PMD_H_ */