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