Fix reorder count after reset
[samplevnf.git] / common / vnf_common / pipeline.h
1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #ifndef __INCLUDE_PIPELINE_H__
18 #define __INCLUDE_PIPELINE_H__
19
20 #include <cmdline_parse.h>
21
22 #include "pipeline_be.h"
23
24 /*
25  * Pipeline type front-end operations
26  */
27
28 typedef void* (*pipeline_fe_op_init)(struct pipeline_params *params, void *arg);
29
30 typedef int (*pipeline_fe_op_free)(void *pipeline);
31
32 struct pipeline_fe_ops {
33         pipeline_fe_op_init f_init;
34         pipeline_fe_op_free f_free;
35         cmdline_parse_ctx_t *cmds;
36 };
37
38 /*
39  * Pipeline type
40  */
41
42 struct pipeline_type {
43         const char *name;
44
45         /* pipeline back-end */
46         struct pipeline_be_ops *be_ops;
47
48         /* pipeline front-end */
49         struct pipeline_fe_ops *fe_ops;
50 };
51
52 static inline uint32_t
53 pipeline_type_cmds_count(struct pipeline_type *ptype)
54 {
55         cmdline_parse_ctx_t *cmds;
56         uint32_t n_cmds;
57
58         if (ptype->fe_ops == NULL)
59                 return 0;
60
61         cmds = ptype->fe_ops->cmds;
62         if (cmds == NULL)
63                 return 0;
64
65         for (n_cmds = 0; cmds[n_cmds]; n_cmds++);
66
67         return n_cmds;
68 }
69
70 int
71 parse_pipeline_core(uint32_t *socket,
72         uint32_t *core,
73         uint32_t *ht,
74         const char *entry);
75
76 #endif