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