2 // Copyright (c) 2010-2017 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _THREAD_PIPELINE_H_
18 #define _THREAD_PIPELINE_H_
20 #include <rte_pipeline.h>
23 #include "task_base.h"
25 /* Tasks based on Packet Framework pipelines */
27 struct task_base base;
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];
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);
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);
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);
47 /* Helper function: enable pipeline input ports */
48 void init_pipe_enable(struct task_pipe *tpipe, struct task_args *targ);
50 /* Helper function: check pipeline consistency */
51 void init_pipe_check(struct task_pipe *tpipe, struct task_args *targ);
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);
57 /* The pipeline thread can only run tasks based on Packet Framework pipelines */
58 int thread_pipeline(struct lcore_cfg *lconf);
60 #endif /* _THREAD_PIPELINE_H_ */