pipeline: add SWX pipeline input port
[dpdk.git] / lib / librte_pipeline / rte_swx_pipeline.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4 #ifndef __INCLUDE_RTE_SWX_PIPELINE_H__
5 #define __INCLUDE_RTE_SWX_PIPELINE_H__
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 /**
12  * @file
13  * RTE SWX Pipeline
14  */
15
16 #include <stddef.h>
17 #include <stdint.h>
18
19 #include <rte_compat.h>
20
21 #include "rte_swx_port.h"
22
23 /** Name size. */
24 #ifndef RTE_SWX_NAME_SIZE
25 #define RTE_SWX_NAME_SIZE 64
26 #endif
27 /*
28  * Pipeline setup and operation
29  */
30
31 /** Pipeline opaque data structure. */
32 struct rte_swx_pipeline;
33
34 /**
35  * Pipeline configure
36  *
37  * @param[out] p
38  *   Pipeline handle. Must point to valid memory. Contains valid pipeline handle
39  *   when the function returns successfully.
40  * @param[in] numa_node
41  *   Non-Uniform Memory Access (NUMA) node.
42  * @return
43  *   0 on success or the following error codes otherwise:
44  *   -EINVAL: Invalid argument;
45  *   -ENOMEM: Not enough space/cannot allocate memory.
46  */
47 __rte_experimental
48 int
49 rte_swx_pipeline_config(struct rte_swx_pipeline **p,
50                         int numa_node);
51
52 /*
53  * Pipeline input ports
54  */
55
56 /**
57  * Pipeline input port type register
58  *
59  * @param[in] p
60  *   Pipeline handle.
61  * @param[in] name
62  *   Input port type name.
63  * @param[in] ops
64  *   Input port type operations.
65  * @return
66  *   0 on success or the following error codes otherwise:
67  *   -EINVAL: Invalid argument;
68  *   -ENOMEM: Not enough space/cannot allocate memory;
69  *   -EEXIST: Input port type with this name already exists.
70  */
71 __rte_experimental
72 int
73 rte_swx_pipeline_port_in_type_register(struct rte_swx_pipeline *p,
74                                        const char *name,
75                                        struct rte_swx_port_in_ops *ops);
76
77 /**
78  * Pipeline input port configure
79  *
80  * @param[in] p
81  *   Pipeline handle.
82  * @param[in] port_id
83  *   Input port ID.
84  * @param[in] port_type_name
85  *   Existing input port type name.
86  * @param[in] args
87  *   Input port creation arguments.
88  * @return
89  *   0 on success or the following error codes otherwise:
90  *   -EINVAL: Invalid argument;
91  *   -ENOMEM: Not enough space/cannot allocate memory;
92  *   -ENODEV: Input port object creation error.
93  */
94 __rte_experimental
95 int
96 rte_swx_pipeline_port_in_config(struct rte_swx_pipeline *p,
97                                 uint32_t port_id,
98                                 const char *port_type_name,
99                                 void *args);
100 /**
101  * Pipeline build
102  *
103  * Once called, the pipeline build operation marks the end of pipeline
104  * configuration. At this point, all the internal data structures needed to run
105  * the pipeline are built.
106  *
107  * @param[in] p
108  *   Pipeline handle.
109  * @return
110  *   0 on success or the following error codes otherwise:
111  *   -EINVAL: Invalid argument;
112  *   -ENOMEM: Not enough space/cannot allocate memory;
113  *   -EEXIST: Pipeline was already built successfully.
114  */
115 __rte_experimental
116 int
117 rte_swx_pipeline_build(struct rte_swx_pipeline *p);
118
119 /**
120  * Pipeline free
121  *
122  * @param[in] p
123  *   Pipeline handle.
124  */
125 __rte_experimental
126 void
127 rte_swx_pipeline_free(struct rte_swx_pipeline *p);
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif