1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2015 Intel Corporation
5 #include <rte_common.h>
6 #include <rte_malloc.h>
8 #include "pipeline_common_be.h"
11 pipeline_msg_req_ping_handler(__rte_unused struct pipeline *p,
14 struct pipeline_msg_rsp *rsp = msg;
16 rsp->status = 0; /* OK */
22 pipeline_msg_req_stats_port_in_handler(struct pipeline *p,
25 struct pipeline_stats_msg_req *req = msg;
26 struct pipeline_stats_port_in_msg_rsp *rsp = msg;
30 if (req->id >= p->n_ports_in) {
34 port_id = p->port_in_id[req->id];
37 rsp->status = rte_pipeline_port_in_stats_read(p->p,
46 pipeline_msg_req_stats_port_out_handler(struct pipeline *p,
49 struct pipeline_stats_msg_req *req = msg;
50 struct pipeline_stats_port_out_msg_rsp *rsp = msg;
54 if (req->id >= p->n_ports_out) {
58 port_id = p->port_out_id[req->id];
61 rsp->status = rte_pipeline_port_out_stats_read(p->p,
70 pipeline_msg_req_stats_table_handler(struct pipeline *p,
73 struct pipeline_stats_msg_req *req = msg;
74 struct pipeline_stats_table_msg_rsp *rsp = msg;
78 if (req->id >= p->n_tables) {
82 table_id = p->table_id[req->id];
85 rsp->status = rte_pipeline_table_stats_read(p->p,
94 pipeline_msg_req_port_in_enable_handler(struct pipeline *p,
97 struct pipeline_port_in_msg_req *req = msg;
98 struct pipeline_msg_rsp *rsp = msg;
102 if (req->port_id >= p->n_ports_in) {
106 port_id = p->port_in_id[req->port_id];
108 /* Process request */
109 rsp->status = rte_pipeline_port_in_enable(p->p,
116 pipeline_msg_req_port_in_disable_handler(struct pipeline *p,
119 struct pipeline_port_in_msg_req *req = msg;
120 struct pipeline_msg_rsp *rsp = msg;
124 if (req->port_id >= p->n_ports_in) {
128 port_id = p->port_in_id[req->port_id];
130 /* Process request */
131 rsp->status = rte_pipeline_port_in_disable(p->p,
138 pipeline_msg_req_invalid_handler(__rte_unused struct pipeline *p,
141 struct pipeline_msg_rsp *rsp = msg;
143 rsp->status = -1; /* Error */
149 pipeline_msg_req_handle(struct pipeline *p)
153 for (msgq_id = 0; msgq_id < p->n_msgq; msgq_id++) {
155 struct pipeline_msg_req *req;
156 pipeline_msg_req_handler f_handle;
158 req = pipeline_msg_recv(p, msgq_id);
162 f_handle = (req->type < PIPELINE_MSG_REQS) ?
163 p->handlers[req->type] :
164 pipeline_msg_req_invalid_handler;
166 if (f_handle == NULL)
167 f_handle = pipeline_msg_req_invalid_handler;
171 f_handle(p, (void *) req));