xref: /dpdk/lib/port/rte_port_sym_crypto.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_PORT_SYM_CRYPTO_H__
6 #define __INCLUDE_RTE_PORT_SYM_CRYPTO_H__
7 
8 /**
9  * @file
10  * RTE Port sym crypto Interface
11  *
12  * crypto_reader: input port built on top of pre-initialized crypto interface
13  * crypto_writer: output port built on top of pre-initialized crypto interface
14  */
15 
16 #include <stdint.h>
17 
18 #include <rte_cryptodev.h>
19 
20 #include "rte_port.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /** Function prototype for reader post action. */
27 typedef void (*rte_port_sym_crypto_reader_callback_fn)(struct rte_mbuf **pkts,
28 		uint16_t n_pkts, void *arg);
29 
30 /** Crypto_reader port parameters */
31 struct rte_port_sym_crypto_reader_params {
32 	/** Target cryptodev ID. */
33 	uint8_t cryptodev_id;
34 
35 	/** Target cryptodev Queue Pair ID. */
36 	uint16_t queue_id;
37 
38 	/** Crypto reader post callback function. */
39 	rte_port_sym_crypto_reader_callback_fn f_callback;
40 
41 	/** Crypto reader post callback function arguments. */
42 	void *arg_callback;
43 };
44 
45 /** Crypto_reader port operations. */
46 extern struct rte_port_in_ops rte_port_sym_crypto_reader_ops;
47 
48 
49 /** Crypto_writer port parameters. */
50 struct rte_port_sym_crypto_writer_params {
51 	/** Target cryptodev ID. */
52 	uint8_t cryptodev_id;
53 
54 	/** Target cryptodev Queue Pair ID. */
55 	uint16_t queue_id;
56 
57 	/** offset to rte_crypto_op in the mbufs. */
58 	uint16_t crypto_op_offset;
59 
60 	/** Burst size to crypto interface. */
61 	uint32_t tx_burst_sz;
62 };
63 
64 /** Crypto_writer port operations. */
65 extern struct rte_port_out_ops rte_port_sym_crypto_writer_ops;
66 
67 /** Crypto_writer_nodrop port parameters. */
68 struct rte_port_sym_crypto_writer_nodrop_params {
69 	/** Target cryptodev ID. */
70 	uint8_t cryptodev_id;
71 
72 	/** Target cryptodev queue pair id. */
73 	uint16_t queue_id;
74 
75 	/** Offset to rte_crypto_op in the mbufs. */
76 	uint16_t crypto_op_offset;
77 
78 	/** Burst size to crypto interface. */
79 	uint32_t tx_burst_sz;
80 
81 	/** Maximum number of retries, 0 for no limit. */
82 	uint32_t n_retries;
83 };
84 
85 /** Crypto_writer_nodrop port operations. */
86 extern struct rte_port_out_ops rte_port_sym_crypto_writer_nodrop_ops;
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif
93