New upstream version 18.02
[deb_dpdk.git] / examples / ip_pipeline / pipeline / pipeline_passthrough.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2015 Intel Corporation
3  */
4
5 #include "pipeline_passthrough.h"
6 #include "pipeline_passthrough_be.h"
7
8 static int
9 app_pipeline_passthrough_track(struct pipeline_params *p,
10         uint32_t port_in,
11         uint32_t *port_out)
12 {
13         struct pipeline_passthrough_params pp;
14         int status;
15
16         /* Check input arguments */
17         if ((p == NULL) ||
18                 (port_in >= p->n_ports_in) ||
19                 (port_out == NULL))
20                 return -1;
21
22         status = pipeline_passthrough_parse_args(&pp, p);
23         if (status)
24                 return -1;
25
26         if (pp.dma_hash_lb_enabled)
27                 return -1;
28
29         *port_out = port_in / (p->n_ports_in / p->n_ports_out);
30         return 0;
31 }
32
33 static struct pipeline_fe_ops pipeline_passthrough_fe_ops = {
34         .f_init = NULL,
35         .f_post_init = NULL,
36         .f_free = NULL,
37         .f_track = app_pipeline_passthrough_track,
38         .cmds = NULL,
39 };
40
41 struct pipeline_type pipeline_passthrough = {
42         .name = "PASS-THROUGH",
43         .be_ops = &pipeline_passthrough_be_ops,
44         .fe_ops = &pipeline_passthrough_fe_ops,
45 };