examples/ip_pipeline: fix buffer size warning
[dpdk.git] / examples / ip_pipeline / init.c
index 28e959b..bc6d6d9 100644 (file)
@@ -49,7 +49,9 @@
 #include "pipeline_passthrough.h"
 #include "pipeline_firewall.h"
 #include "pipeline_flow_classification.h"
+#include "pipeline_flow_actions.h"
 #include "pipeline_routing.h"
+#include "thread_fe.h"
 
 #define APP_NAME_SIZE  32
 
@@ -1339,6 +1341,8 @@ app_init_pipelines(struct app_params *app)
                                "init error\n", params->name);
                }
 
+               data->ptype = ptype;
+
                data->timer_period = (rte_get_tsc_hz() * params->timer_period)
                        / 1000;
        }
@@ -1372,6 +1376,25 @@ app_init_threads(struct app_params *app)
 
                t = &app->thread_data[lcore_id];
 
+               t->timer_period = (rte_get_tsc_hz() * APP_THREAD_TIMER_PERIOD) / 1000;
+               t->thread_req_deadline = time + t->timer_period;
+
+               t->msgq_in = app_thread_msgq_in_get(app,
+                               params->socket_id,
+                               params->core_id,
+                               params->hyper_th_id);
+               if (t->msgq_in == NULL)
+                       rte_panic("Init error: Cannot find MSGQ_IN for thread %" PRId32,
+                               lcore_id);
+
+               t->msgq_out = app_thread_msgq_out_get(app,
+                               params->socket_id,
+                               params->core_id,
+                               params->hyper_th_id);
+               if (t->msgq_out == NULL)
+                       rte_panic("Init error: Cannot find MSGQ_OUT for thread %" PRId32,
+                               lcore_id);
+
                ptype = app_pipeline_type_find(app, params->type);
                if (ptype == NULL)
                        rte_panic("Init error: Unknown pipeline "
@@ -1381,12 +1404,15 @@ app_init_threads(struct app_params *app)
                        &t->regular[t->n_regular] :
                        &t->custom[t->n_custom];
 
+               p->pipeline_id = p_id;
                p->be = data->be;
                p->f_run = ptype->be_ops->f_run;
                p->f_timer = ptype->be_ops->f_timer;
                p->timer_period = data->timer_period;
                p->deadline = time + data->timer_period;
 
+               data->enabled = 1;
+
                if (ptype->be_ops->f_run == NULL)
                        t->n_regular++;
                else
@@ -1407,9 +1433,11 @@ int app_init(struct app_params *app)
        app_init_msgq(app);
 
        app_pipeline_common_cmd_push(app);
+       app_pipeline_thread_cmd_push(app);
        app_pipeline_type_register(app, &pipeline_master);
        app_pipeline_type_register(app, &pipeline_passthrough);
        app_pipeline_type_register(app, &pipeline_flow_classification);
+       app_pipeline_type_register(app, &pipeline_flow_actions);
        app_pipeline_type_register(app, &pipeline_firewall);
        app_pipeline_type_register(app, &pipeline_routing);
 
@@ -1444,7 +1472,7 @@ app_pipeline_type_cmd_push(struct app_params *app,
        /* Push pipeline commands into the application */
        memcpy(&app->cmds[app->n_cmds],
                cmds,
-               n_cmds * sizeof(cmdline_parse_ctx_t *));
+               n_cmds * sizeof(cmdline_parse_ctx_t));
 
        for (i = 0; i < n_cmds; i++)
                app->cmds[app->n_cmds + i]->data = app;