xref: /dpdk/examples/ip_pipeline/pipeline.h (revision 3998e2a07220844d3f3c17f76a781ced3efe0de0)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2015 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_PIPELINE_H__
6 #define __INCLUDE_PIPELINE_H__
7 
8 #include <cmdline_parse.h>
9 
10 #include "pipeline_be.h"
11 
12 /*
13  * Pipeline type front-end operations
14  */
15 
16 typedef void* (*pipeline_fe_op_init)(struct pipeline_params *params,
17 	void *arg);
18 
19 typedef int (*pipeline_fe_op_post_init)(void *pipeline);
20 
21 typedef int (*pipeline_fe_op_free)(void *pipeline);
22 
23 typedef int (*pipeline_fe_op_track)(struct pipeline_params *params,
24 	uint32_t port_in,
25 	uint32_t *port_out);
26 
27 struct pipeline_fe_ops {
28 	pipeline_fe_op_init f_init;
29 	pipeline_fe_op_post_init f_post_init;
30 	pipeline_fe_op_free f_free;
31 	pipeline_fe_op_track f_track;
32 	cmdline_parse_ctx_t *cmds;
33 };
34 
35 /*
36  * Pipeline type
37  */
38 
39 struct pipeline_type {
40 	const char *name;
41 
42 	/* pipeline back-end */
43 	struct pipeline_be_ops *be_ops;
44 
45 	/* pipeline front-end */
46 	struct pipeline_fe_ops *fe_ops;
47 };
48 
49 static inline uint32_t
50 pipeline_type_cmds_count(struct pipeline_type *ptype)
51 {
52 	cmdline_parse_ctx_t *cmds;
53 	uint32_t n_cmds;
54 
55 	if (ptype->fe_ops == NULL)
56 		return 0;
57 
58 	cmds = ptype->fe_ops->cmds;
59 	if (cmds == NULL)
60 		return 0;
61 
62 	for (n_cmds = 0; cmds[n_cmds]; n_cmds++);
63 
64 	return n_cmds;
65 }
66 
67 int
68 parse_pipeline_core(uint32_t *socket,
69 	uint32_t *core,
70 	uint32_t *ht,
71 	const char *entry);
72 
73 #endif
74