Allow latency thresholds for TST009 testing
[samplevnf.git] / VNFs / DPPD-PROX / thread_pipeline.h
1 /*
2 // Copyright (c) 2010-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 _THREAD_PIPELINE_H_
18 #define _THREAD_PIPELINE_H_
19
20 #include <rte_pipeline.h>
21
22 #include "lconf.h"
23 #include "task_base.h"
24
25 /* Tasks based on Packet Framework pipelines */
26 struct task_pipe {
27         struct task_base base;
28
29         struct rte_pipeline *p;
30         uint32_t port_in_id[MAX_RINGS_PER_TASK];
31         uint32_t port_out_id[MAX_RINGS_PER_TASK];
32         uint32_t table_id[MAX_RINGS_PER_TASK];
33         uint8_t n_ports_in;
34         uint8_t n_ports_out;
35         uint8_t n_tables;
36 };
37
38 /* Helper function: create pipeline, input ports and output ports */
39 void init_pipe_create_in_out(struct task_pipe *tpipe, struct task_args *targ);
40
41 /* Helper function: connect pipeline input ports to one pipeline table */
42 void init_pipe_connect_one(struct task_pipe *tpipe, struct task_args *targ, uint32_t table_id);
43
44 /* Helper function: connect pipeline input ports to all pipeline tables */
45 void init_pipe_connect_all(struct task_pipe *tpipe, struct task_args *targ);
46
47 /* Helper function: enable pipeline input ports */
48 void init_pipe_enable(struct task_pipe *tpipe, struct task_args *targ);
49
50 /* Helper function: check pipeline consistency */
51 void init_pipe_check(struct task_pipe *tpipe, struct task_args *targ);
52
53 /* This function will panic on purpose: tasks based on Packet Framework
54    pipelines should not be invoked via the usual task_base.handle_bulk method */
55 int handle_pipe(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts);
56
57 /* The pipeline thread can only run tasks based on Packet Framework pipelines */
58 int thread_pipeline(struct lcore_cfg *lconf);
59
60 #endif /* _THREAD_PIPELINE_H_ */