xref: /dpdk/lib/port/rte_port_ring.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_PORT_RING_H__
6 #define __INCLUDE_RTE_PORT_RING_H__
7 
8 /**
9  * @file
10  * RTE Port Ring
11  *
12  * ring_reader:
13  *      input port built on top of pre-initialized single consumer ring
14  * ring_writer:
15  *      output port built on top of pre-initialized single producer ring
16  * ring_multi_reader:
17  *      input port built on top of pre-initialized multi consumers ring
18  * ring_multi_writer:
19  *      output port built on top of pre-initialized multi producers ring
20  */
21 
22 #include <stdint.h>
23 
24 #include "rte_port.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /** ring_reader port parameters */
31 struct rte_port_ring_reader_params {
32 	/** Underlying consumer ring that has to be pre-initialized */
33 	struct rte_ring *ring;
34 };
35 
36 /** ring_reader port operations */
37 extern struct rte_port_in_ops rte_port_ring_reader_ops;
38 
39 /** ring_writer port parameters */
40 struct rte_port_ring_writer_params {
41 	/** Underlying producer ring that has to be pre-initialized */
42 	struct rte_ring *ring;
43 
44 	/** Recommended burst size to ring. The actual burst size can be
45 		bigger or smaller than this value. */
46 	uint32_t tx_burst_sz;
47 };
48 
49 /** ring_writer port operations */
50 extern struct rte_port_out_ops rte_port_ring_writer_ops;
51 
52 /** ring_writer_nodrop port parameters */
53 struct rte_port_ring_writer_nodrop_params {
54 	/** Underlying producer ring that has to be pre-initialized */
55 	struct rte_ring *ring;
56 
57 	/** Recommended burst size to ring. The actual burst size can be
58 		bigger or smaller than this value. */
59 	uint32_t tx_burst_sz;
60 
61 	/** Maximum number of retries, 0 for no limit */
62 	uint32_t n_retries;
63 };
64 
65 /** ring_writer_nodrop port operations */
66 extern struct rte_port_out_ops rte_port_ring_writer_nodrop_ops;
67 
68 /** ring_multi_reader port parameters */
69 #define rte_port_ring_multi_reader_params rte_port_ring_reader_params
70 
71 /** ring_multi_reader port operations */
72 extern struct rte_port_in_ops rte_port_ring_multi_reader_ops;
73 
74 /** ring_multi_writer port parameters */
75 #define rte_port_ring_multi_writer_params rte_port_ring_writer_params
76 
77 /** ring_multi_writer port operations */
78 extern struct rte_port_out_ops rte_port_ring_multi_writer_ops;
79 
80 /** ring_multi_writer_nodrop port parameters */
81 #define rte_port_ring_multi_writer_nodrop_params \
82 	rte_port_ring_writer_nodrop_params
83 
84 /** ring_multi_writer_nodrop port operations */
85 extern struct rte_port_out_ops rte_port_ring_multi_writer_nodrop_ops;
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif
92