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 #include <rte_table_stub.h> //FIXME: ACL
21 #include "thread_pipeline.h"
24 struct task_pipe pipe;
28 static void init_task_pf_acl(struct task_base *tbase, struct task_args *targ)
30 struct task_pipe *tpipe = (struct task_pipe *)tbase;
31 // struct task_pf_acl *task = (struct task_pf_acl *)tpipe;
34 /* create pipeline, input ports and output ports */
35 init_pipe_create_in_out(tpipe, targ);
37 /* create ACL pipeline table */
40 //FIXME: this is not ACL (
41 /* create pipeline tables */
42 for (uint8_t i = 0; i < tpipe->n_ports_in; ++i) {
43 struct rte_pipeline_table_params table_params = {
44 .ops = &rte_table_stub_ops,
47 .f_action_miss = NULL,
49 .action_data_size = 0,
51 err = rte_pipeline_table_create(tpipe->p, &table_params,
53 PROX_PANIC(err != 0, "Failed to create table %u "
54 "for %s pipeline on core %u task %u: "
56 i, targ->task_init->mode_str,
57 targ->lconf->id, targ->task,
60 tpipe->n_tables = tpipe->n_ports_in;
61 PROX_PANIC(tpipe->n_tables < 1, "No table created "
62 "for %s pipeline on core %u task %u\n",
63 targ->task_init->mode_str, targ->lconf->id, targ->task);
65 /* add default entry to tables */
66 for (uint8_t i = 0; i < tpipe->n_tables; ++i) {
67 struct rte_pipeline_table_entry default_entry = {
68 .action = RTE_PIPELINE_ACTION_PORT,
69 {.port_id = tpipe->port_out_id[i % tpipe->n_ports_out]},
71 struct rte_pipeline_table_entry *default_entry_ptr;
72 err = rte_pipeline_table_default_entry_add(tpipe->p, tpipe->table_id[i],
73 &default_entry, &default_entry_ptr);
74 PROX_PANIC(err != 0, "Failed to add default entry to table %u "
75 "for %s pipeline on core %u task %u: "
77 i, targ->task_init->mode_str,
78 targ->lconf->id, targ->task,
81 //FIXME: this is not ACL )
83 /* connect pipeline input ports to ACL pipeline table */
84 init_pipe_connect_one(tpipe, targ, tpipe->table_id[0]);
86 /* enable pipeline input ports */
87 init_pipe_enable(tpipe, targ);
89 /* check pipeline consistency */
90 init_pipe_check(tpipe, targ);
93 static struct task_init task_init_pf_acl = {
95 .init = init_task_pf_acl,
96 .handle = handle_pipe,
97 .thread_x = thread_pipeline,
98 .size = sizeof(struct task_pf_acl),
101 __attribute__((constructor)) static void reg_task_pf_acl(void)
103 reg_task(&task_init_pf_acl);