4 * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include <sys/queue.h>
37 #include <netinet/in.h>
39 #include <rte_common.h>
40 #include <rte_hexdump.h>
41 #include <rte_malloc.h>
42 #include <cmdline_rdline.h>
43 #include <cmdline_parse.h>
44 #include <cmdline_parse_num.h>
45 #include <cmdline_parse_string.h>
46 #include <cmdline_parse_ipaddr.h>
47 #include <cmdline_parse_etheraddr.h>
50 #include "pipeline_common_fe.h"
51 #include "pipeline_flow_actions.h"
52 #include "hash_func.h"
55 * Flow actions pipeline
58 #define N_FLOWS_BULK 4096
61 struct app_pipeline_fa_flow {
62 struct pipeline_fa_flow_params params;
66 struct app_pipeline_fa_dscp {
67 uint32_t traffic_class;
68 enum rte_meter_color color;
71 struct app_pipeline_fa {
75 struct pipeline_fa_params params;
78 struct app_pipeline_fa_dscp dscp[PIPELINE_FA_N_DSCP];
79 struct app_pipeline_fa_flow *flows;
80 } __rte_cache_aligned;
83 app_pipeline_fa_init(struct pipeline_params *params,
84 __rte_unused void *arg)
86 struct app_pipeline_fa *p;
89 /* Check input arguments */
90 if ((params == NULL) ||
91 (params->n_ports_in == 0) ||
92 (params->n_ports_out == 0))
95 /* Memory allocation */
96 size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct app_pipeline_fa));
97 p = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
102 p->n_ports_in = params->n_ports_in;
103 p->n_ports_out = params->n_ports_out;
104 if (pipeline_fa_parse_args(&p->params, params)) {
109 /* Memory allocation */
110 size = RTE_CACHE_LINE_ROUNDUP(
111 p->params.n_flows * sizeof(struct app_pipeline_fa_flow));
112 p->flows = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
113 if (p->flows == NULL) {
118 /* Initialization of flow table */
119 for (i = 0; i < p->params.n_flows; i++)
120 pipeline_fa_flow_params_set_default(&p->flows[i].params);
122 /* Initialization of DSCP table */
123 for (i = 0; i < RTE_DIM(p->dscp); i++) {
124 p->dscp[i].traffic_class = 0;
125 p->dscp[i].color = e_RTE_METER_GREEN;
132 app_pipeline_fa_free(void *pipeline)
134 struct app_pipeline_fa *p = pipeline;
136 /* Check input arguments */
148 flow_params_check(struct app_pipeline_fa *p,
149 __rte_unused uint32_t meter_update_mask,
150 uint32_t policer_update_mask,
151 uint32_t port_update,
152 struct pipeline_fa_flow_params *params)
159 for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
160 struct pipeline_fa_policer_params *p = ¶ms->p[i];
163 if ((mask & policer_update_mask) == 0)
166 for (j = 0; j < e_RTE_METER_COLORS; j++) {
167 struct pipeline_fa_policer_action *action =
170 if ((action->drop == 0) &&
171 (action->color >= e_RTE_METER_COLORS))
177 if (port_update && (params->port_id >= p->n_ports_out))
184 app_pipeline_fa_flow_config(struct app_params *app,
185 uint32_t pipeline_id,
187 uint32_t meter_update_mask,
188 uint32_t policer_update_mask,
189 uint32_t port_update,
190 struct pipeline_fa_flow_params *params)
192 struct app_pipeline_fa *p;
193 struct app_pipeline_fa_flow *flow;
195 struct pipeline_fa_flow_config_msg_req *req;
196 struct pipeline_fa_flow_config_msg_rsp *rsp;
200 /* Check input arguments */
202 ((meter_update_mask == 0) &&
203 (policer_update_mask == 0) &&
204 (port_update == 0)) ||
205 (meter_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
206 (policer_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
210 p = app_pipeline_data_fe(app, pipeline_id,
211 &pipeline_flow_actions);
215 if (flow_params_check(p,
222 flow_id %= p->params.n_flows;
223 flow = &p->flows[flow_id];
225 /* Allocate and write request */
226 req = app_msg_alloc(app);
230 req->type = PIPELINE_MSG_REQ_CUSTOM;
231 req->subtype = PIPELINE_FA_MSG_REQ_FLOW_CONFIG;
232 req->entry_ptr = flow->entry_ptr;
233 req->flow_id = flow_id;
234 req->meter_update_mask = meter_update_mask;
235 req->policer_update_mask = policer_update_mask;
236 req->port_update = port_update;
237 memcpy(&req->params, params, sizeof(*params));
239 /* Send request and wait for response */
240 rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
246 (rsp->entry_ptr == NULL)) {
247 app_msg_free(app, rsp);
252 for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
253 if ((mask & meter_update_mask) == 0)
256 memcpy(&flow->params.m[i], ¶ms->m[i], sizeof(params->m[i]));
259 for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
260 if ((mask & policer_update_mask) == 0)
263 memcpy(&flow->params.p[i], ¶ms->p[i], sizeof(params->p[i]));
267 flow->params.port_id = params->port_id;
269 flow->entry_ptr = rsp->entry_ptr;
272 app_msg_free(app, rsp);
278 app_pipeline_fa_flow_config_bulk(struct app_params *app,
279 uint32_t pipeline_id,
282 uint32_t meter_update_mask,
283 uint32_t policer_update_mask,
284 uint32_t port_update,
285 struct pipeline_fa_flow_params *params)
287 struct app_pipeline_fa *p;
288 struct pipeline_fa_flow_config_bulk_msg_req *req;
289 struct pipeline_fa_flow_config_bulk_msg_rsp *rsp;
290 void **req_entry_ptr;
291 uint32_t *req_flow_id;
294 /* Check input arguments */
298 ((meter_update_mask == 0) &&
299 (policer_update_mask == 0) &&
300 (port_update == 0)) ||
301 (meter_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
302 (policer_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
306 p = app_pipeline_data_fe(app, pipeline_id,
307 &pipeline_flow_actions);
311 for (i = 0; i < n_flows; i++) {
312 struct pipeline_fa_flow_params *flow_params = ¶ms[i];
314 if (flow_params_check(p,
322 /* Allocate and write request */
323 req_entry_ptr = (void **) rte_malloc(NULL,
324 n_flows * sizeof(void *),
325 RTE_CACHE_LINE_SIZE);
326 if (req_entry_ptr == NULL)
329 req_flow_id = (uint32_t *) rte_malloc(NULL,
330 n_flows * sizeof(uint32_t),
331 RTE_CACHE_LINE_SIZE);
332 if (req_flow_id == NULL) {
333 rte_free(req_entry_ptr);
337 for (i = 0; i < n_flows; i++) {
338 uint32_t fid = flow_id[i] % p->params.n_flows;
339 struct app_pipeline_fa_flow *flow = &p->flows[fid];
341 req_flow_id[i] = fid;
342 req_entry_ptr[i] = flow->entry_ptr;
345 req = app_msg_alloc(app);
347 rte_free(req_flow_id);
348 rte_free(req_entry_ptr);
352 req->type = PIPELINE_MSG_REQ_CUSTOM;
353 req->subtype = PIPELINE_FA_MSG_REQ_FLOW_CONFIG_BULK;
354 req->entry_ptr = req_entry_ptr;
355 req->flow_id = req_flow_id;
356 req->n_flows = n_flows;
357 req->meter_update_mask = meter_update_mask;
358 req->policer_update_mask = policer_update_mask;
359 req->port_update = port_update;
360 req->params = params;
362 /* Send request and wait for response */
363 rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
365 rte_free(req_flow_id);
366 rte_free(req_entry_ptr);
373 for (i = 0; i < rsp->n_flows; i++) {
374 uint32_t fid = flow_id[i] % p->params.n_flows;
375 struct app_pipeline_fa_flow *flow = &p->flows[fid];
376 struct pipeline_fa_flow_params *flow_params = ¶ms[i];
377 void *entry_ptr = req_entry_ptr[i];
380 for (j = 0, mask = 1; j < PIPELINE_FA_N_TC_MAX;
382 if ((mask & meter_update_mask) == 0)
385 memcpy(&flow->params.m[j],
387 sizeof(flow_params->m[j]));
390 for (j = 0, mask = 1; j < PIPELINE_FA_N_TC_MAX;
392 if ((mask & policer_update_mask) == 0)
395 memcpy(&flow->params.p[j],
397 sizeof(flow_params->p[j]));
401 flow->params.port_id = flow_params->port_id;
403 flow->entry_ptr = entry_ptr;
407 app_msg_free(app, rsp);
408 rte_free(req_flow_id);
409 rte_free(req_entry_ptr);
411 return (rsp->n_flows == n_flows) ? 0 : -1;
415 app_pipeline_fa_dscp_config(struct app_params *app,
416 uint32_t pipeline_id,
418 uint32_t traffic_class,
419 enum rte_meter_color color)
421 struct app_pipeline_fa *p;
423 struct pipeline_fa_dscp_config_msg_req *req;
424 struct pipeline_fa_dscp_config_msg_rsp *rsp;
426 /* Check input arguments */
428 (dscp >= PIPELINE_FA_N_DSCP) ||
429 (traffic_class >= PIPELINE_FA_N_TC_MAX) ||
430 (color >= e_RTE_METER_COLORS))
433 p = app_pipeline_data_fe(app, pipeline_id,
434 &pipeline_flow_actions);
438 if (p->params.dscp_enabled == 0)
441 /* Allocate and write request */
442 req = app_msg_alloc(app);
446 req->type = PIPELINE_MSG_REQ_CUSTOM;
447 req->subtype = PIPELINE_FA_MSG_REQ_DSCP_CONFIG;
449 req->traffic_class = traffic_class;
452 /* Send request and wait for response */
453 rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
459 app_msg_free(app, rsp);
464 p->dscp[dscp].traffic_class = traffic_class;
465 p->dscp[dscp].color = color;
468 app_msg_free(app, rsp);
474 app_pipeline_fa_flow_policer_stats_read(struct app_params *app,
475 uint32_t pipeline_id,
479 struct pipeline_fa_policer_stats *stats)
481 struct app_pipeline_fa *p;
482 struct app_pipeline_fa_flow *flow;
484 struct pipeline_fa_policer_stats_msg_req *req;
485 struct pipeline_fa_policer_stats_msg_rsp *rsp;
487 /* Check input arguments */
488 if ((app == NULL) || (stats == NULL))
491 p = app_pipeline_data_fe(app, pipeline_id,
492 &pipeline_flow_actions);
496 flow_id %= p->params.n_flows;
497 flow = &p->flows[flow_id];
499 if ((policer_id >= p->params.n_meters_per_flow) ||
500 (flow->entry_ptr == NULL))
503 /* Allocate and write request */
504 req = app_msg_alloc(app);
508 req->type = PIPELINE_MSG_REQ_CUSTOM;
509 req->subtype = PIPELINE_FA_MSG_REQ_POLICER_STATS_READ;
510 req->entry_ptr = flow->entry_ptr;
511 req->policer_id = policer_id;
514 /* Send request and wait for response */
515 rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
521 app_msg_free(app, rsp);
525 memcpy(stats, &rsp->stats, sizeof(*stats));
528 app_msg_free(app, rsp);
534 color_to_string(enum rte_meter_color color)
537 case e_RTE_METER_GREEN: return "G";
538 case e_RTE_METER_YELLOW: return "Y";
539 case e_RTE_METER_RED: return "R";
545 string_to_color(char *s, enum rte_meter_color *c)
547 if (strcmp(s, "G") == 0) {
548 *c = e_RTE_METER_GREEN;
552 if (strcmp(s, "Y") == 0) {
553 *c = e_RTE_METER_YELLOW;
557 if (strcmp(s, "R") == 0) {
558 *c = e_RTE_METER_RED;
566 policer_action_to_string(struct pipeline_fa_policer_action *a)
571 return color_to_string(a->color);
575 string_to_policer_action(char *s, struct pipeline_fa_policer_action *a)
577 if (strcmp(s, "G") == 0) {
579 a->color = e_RTE_METER_GREEN;
583 if (strcmp(s, "Y") == 0) {
585 a->color = e_RTE_METER_YELLOW;
589 if (strcmp(s, "R") == 0) {
591 a->color = e_RTE_METER_RED;
595 if (strcmp(s, "D") == 0) {
597 a->color = e_RTE_METER_GREEN;
605 print_flow(struct app_pipeline_fa *p,
607 struct app_pipeline_fa_flow *flow)
611 printf("Flow ID = %" PRIu32 "\n", flow_id);
613 for (i = 0; i < p->params.n_meters_per_flow; i++) {
614 struct rte_meter_trtcm_params *meter = &flow->params.m[i];
615 struct pipeline_fa_policer_params *policer = &flow->params.p[i];
617 printf("\ttrTCM [CIR = %" PRIu64
618 ", CBS = %" PRIu64 ", PIR = %" PRIu64
619 ", PBS = %" PRIu64 "] Policer [G : %s, Y : %s, R : %s]\n",
624 policer_action_to_string(&policer->action[e_RTE_METER_GREEN]),
625 policer_action_to_string(&policer->action[e_RTE_METER_YELLOW]),
626 policer_action_to_string(&policer->action[e_RTE_METER_RED]));
629 printf("\tPort %u (entry_ptr = %p)\n",
630 flow->params.port_id,
636 app_pipeline_fa_flow_ls(struct app_params *app,
637 uint32_t pipeline_id)
639 struct app_pipeline_fa *p;
642 /* Check input arguments */
646 p = app_pipeline_data_fe(app, pipeline_id,
647 &pipeline_flow_actions);
651 for (i = 0; i < p->params.n_flows; i++) {
652 struct app_pipeline_fa_flow *flow = &p->flows[i];
654 print_flow(p, i, flow);
661 app_pipeline_fa_dscp_ls(struct app_params *app,
662 uint32_t pipeline_id)
664 struct app_pipeline_fa *p;
667 /* Check input arguments */
671 p = app_pipeline_data_fe(app, pipeline_id,
672 &pipeline_flow_actions);
676 if (p->params.dscp_enabled == 0)
679 for (i = 0; i < RTE_DIM(p->dscp); i++) {
680 struct app_pipeline_fa_dscp *dscp = &p->dscp[i];
682 printf("DSCP = %2" PRIu32 ": Traffic class = %" PRIu32
686 color_to_string(dscp->color));
693 * Flow meter configuration (single flow)
695 * p <pipeline ID> flow <flow ID> meter <meter ID> trtcm <trtcm params>
698 struct cmd_fa_meter_config_result {
699 cmdline_fixed_string_t p_string;
700 uint32_t pipeline_id;
701 cmdline_fixed_string_t flow_string;
703 cmdline_fixed_string_t meter_string;
705 cmdline_fixed_string_t trtcm_string;
713 cmd_fa_meter_config_parsed(
715 __rte_unused struct cmdline *cl,
718 struct cmd_fa_meter_config_result *params = parsed_result;
719 struct app_params *app = data;
720 struct pipeline_fa_flow_params flow_params;
723 if (params->meter_id >= PIPELINE_FA_N_TC_MAX) {
724 printf("Command failed\n");
728 flow_params.m[params->meter_id].cir = params->cir;
729 flow_params.m[params->meter_id].pir = params->pir;
730 flow_params.m[params->meter_id].cbs = params->cbs;
731 flow_params.m[params->meter_id].pbs = params->pbs;
733 status = app_pipeline_fa_flow_config(app,
736 1 << params->meter_id,
742 printf("Command failed\n");
745 cmdline_parse_token_string_t cmd_fa_meter_config_p_string =
746 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_result,
749 cmdline_parse_token_num_t cmd_fa_meter_config_pipeline_id =
750 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_result,
751 pipeline_id, UINT32);
753 cmdline_parse_token_string_t cmd_fa_meter_config_flow_string =
754 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_result,
755 flow_string, "flow");
757 cmdline_parse_token_num_t cmd_fa_meter_config_flow_id =
758 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_result,
761 cmdline_parse_token_string_t cmd_fa_meter_config_meter_string =
762 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_result,
763 meter_string, "meter");
765 cmdline_parse_token_num_t cmd_fa_meter_config_meter_id =
766 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_result,
769 cmdline_parse_token_string_t cmd_fa_meter_config_trtcm_string =
770 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_result,
771 trtcm_string, "trtcm");
773 cmdline_parse_token_num_t cmd_fa_meter_config_cir =
774 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_result, cir, UINT64);
776 cmdline_parse_token_num_t cmd_fa_meter_config_pir =
777 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_result, pir, UINT64);
779 cmdline_parse_token_num_t cmd_fa_meter_config_cbs =
780 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_result, cbs, UINT64);
782 cmdline_parse_token_num_t cmd_fa_meter_config_pbs =
783 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_result, pbs, UINT64);
785 cmdline_parse_inst_t cmd_fa_meter_config = {
786 .f = cmd_fa_meter_config_parsed,
788 .help_str = "Flow meter configuration (single flow) ",
790 (void *) &cmd_fa_meter_config_p_string,
791 (void *) &cmd_fa_meter_config_pipeline_id,
792 (void *) &cmd_fa_meter_config_flow_string,
793 (void *) &cmd_fa_meter_config_flow_id,
794 (void *) &cmd_fa_meter_config_meter_string,
795 (void *) &cmd_fa_meter_config_meter_id,
796 (void *) &cmd_fa_meter_config_trtcm_string,
797 (void *) &cmd_fa_meter_config_cir,
798 (void *) &cmd_fa_meter_config_pir,
799 (void *) &cmd_fa_meter_config_cbs,
800 (void *) &cmd_fa_meter_config_pbs,
806 * Flow meter configuration (multiple flows)
808 * p <pipeline ID> flows <n_flows> meter <meter ID> trtcm <trtcm params>
811 struct cmd_fa_meter_config_bulk_result {
812 cmdline_fixed_string_t p_string;
813 uint32_t pipeline_id;
814 cmdline_fixed_string_t flows_string;
816 cmdline_fixed_string_t meter_string;
818 cmdline_fixed_string_t trtcm_string;
826 cmd_fa_meter_config_bulk_parsed(
828 __rte_unused struct cmdline *cl,
831 struct cmd_fa_meter_config_bulk_result *params = parsed_result;
832 struct app_params *app = data;
833 struct pipeline_fa_flow_params flow_template, *flow_params;
837 if ((params->n_flows == 0) ||
838 (params->meter_id >= PIPELINE_FA_N_TC_MAX)) {
839 printf("Invalid arguments\n");
843 flow_id = (uint32_t *) rte_malloc(NULL,
844 N_FLOWS_BULK * sizeof(uint32_t),
845 RTE_CACHE_LINE_SIZE);
846 if (flow_id == NULL) {
847 printf("Memory allocation failed\n");
851 flow_params = (struct pipeline_fa_flow_params *) rte_malloc(NULL,
852 N_FLOWS_BULK * sizeof(struct pipeline_fa_flow_params),
853 RTE_CACHE_LINE_SIZE);
854 if (flow_params == NULL) {
856 printf("Memory allocation failed\n");
860 memset(&flow_template, 0, sizeof(flow_template));
861 flow_template.m[params->meter_id].cir = params->cir;
862 flow_template.m[params->meter_id].pir = params->pir;
863 flow_template.m[params->meter_id].cbs = params->cbs;
864 flow_template.m[params->meter_id].pbs = params->pbs;
866 for (i = 0; i < params->n_flows; i++) {
867 uint32_t pos = i % N_FLOWS_BULK;
870 memcpy(&flow_params[pos],
872 sizeof(flow_template));
874 if ((pos == N_FLOWS_BULK - 1) ||
875 (i == params->n_flows - 1)) {
878 status = app_pipeline_fa_flow_config_bulk(app,
882 1 << params->meter_id,
888 printf("Command failed\n");
895 rte_free(flow_params);
900 cmdline_parse_token_string_t cmd_fa_meter_config_bulk_p_string =
901 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
904 cmdline_parse_token_num_t cmd_fa_meter_config_bulk_pipeline_id =
905 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
906 pipeline_id, UINT32);
908 cmdline_parse_token_string_t cmd_fa_meter_config_bulk_flows_string =
909 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
910 flows_string, "flows");
912 cmdline_parse_token_num_t cmd_fa_meter_config_bulk_n_flows =
913 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
916 cmdline_parse_token_string_t cmd_fa_meter_config_bulk_meter_string =
917 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
918 meter_string, "meter");
920 cmdline_parse_token_num_t cmd_fa_meter_config_bulk_meter_id =
921 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
924 cmdline_parse_token_string_t cmd_fa_meter_config_bulk_trtcm_string =
925 TOKEN_STRING_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
926 trtcm_string, "trtcm");
928 cmdline_parse_token_num_t cmd_fa_meter_config_bulk_cir =
929 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
932 cmdline_parse_token_num_t cmd_fa_meter_config_bulk_pir =
933 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
936 cmdline_parse_token_num_t cmd_fa_meter_config_bulk_cbs =
937 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
940 cmdline_parse_token_num_t cmd_fa_meter_config_bulk_pbs =
941 TOKEN_NUM_INITIALIZER(struct cmd_fa_meter_config_bulk_result,
944 cmdline_parse_inst_t cmd_fa_meter_config_bulk = {
945 .f = cmd_fa_meter_config_bulk_parsed,
947 .help_str = "Flow meter configuration (multiple flows)",
949 (void *) &cmd_fa_meter_config_bulk_p_string,
950 (void *) &cmd_fa_meter_config_bulk_pipeline_id,
951 (void *) &cmd_fa_meter_config_bulk_flows_string,
952 (void *) &cmd_fa_meter_config_bulk_n_flows,
953 (void *) &cmd_fa_meter_config_bulk_meter_string,
954 (void *) &cmd_fa_meter_config_bulk_meter_id,
955 (void *) &cmd_fa_meter_config_bulk_trtcm_string,
956 (void *) &cmd_fa_meter_config_cir,
957 (void *) &cmd_fa_meter_config_pir,
958 (void *) &cmd_fa_meter_config_cbs,
959 (void *) &cmd_fa_meter_config_pbs,
965 * Flow policer configuration (single flow)
967 * p <pipeline ID> flow <flow ID> policer <policer ID>
968 * G <action> Y <action> R <action>
970 * <action> = G (green) | Y (yellow) | R (red) | D (drop)
973 struct cmd_fa_policer_config_result {
974 cmdline_fixed_string_t p_string;
975 uint32_t pipeline_id;
976 cmdline_fixed_string_t flow_string;
978 cmdline_fixed_string_t policer_string;
980 cmdline_fixed_string_t green_string;
981 cmdline_fixed_string_t g_action;
982 cmdline_fixed_string_t yellow_string;
983 cmdline_fixed_string_t y_action;
984 cmdline_fixed_string_t red_string;
985 cmdline_fixed_string_t r_action;
989 cmd_fa_policer_config_parsed(
991 __rte_unused struct cmdline *cl,
994 struct cmd_fa_policer_config_result *params = parsed_result;
995 struct app_params *app = data;
996 struct pipeline_fa_flow_params flow_params;
999 if (params->policer_id >= PIPELINE_FA_N_TC_MAX) {
1000 printf("Command failed\n");
1004 status = string_to_policer_action(params->g_action,
1005 &flow_params.p[params->policer_id].action[e_RTE_METER_GREEN]);
1007 printf("Invalid policer green action\n");
1009 status = string_to_policer_action(params->y_action,
1010 &flow_params.p[params->policer_id].action[e_RTE_METER_YELLOW]);
1012 printf("Invalid policer yellow action\n");
1014 status = string_to_policer_action(params->r_action,
1015 &flow_params.p[params->policer_id].action[e_RTE_METER_RED]);
1017 printf("Invalid policer red action\n");
1019 status = app_pipeline_fa_flow_config(app,
1020 params->pipeline_id,
1023 1 << params->policer_id,
1028 printf("Command failed\n");
1032 cmdline_parse_token_string_t cmd_fa_policer_config_p_string =
1033 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1036 cmdline_parse_token_num_t cmd_fa_policer_config_pipeline_id =
1037 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_config_result,
1038 pipeline_id, UINT32);
1040 cmdline_parse_token_string_t cmd_fa_policer_config_flow_string =
1041 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1042 flow_string, "flow");
1044 cmdline_parse_token_num_t cmd_fa_policer_config_flow_id =
1045 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_config_result,
1048 cmdline_parse_token_string_t cmd_fa_policer_config_policer_string =
1049 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1050 policer_string, "policer");
1052 cmdline_parse_token_num_t cmd_fa_policer_config_policer_id =
1053 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_config_result,
1054 policer_id, UINT32);
1056 cmdline_parse_token_string_t cmd_fa_policer_config_green_string =
1057 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1060 cmdline_parse_token_string_t cmd_fa_policer_config_g_action =
1061 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1062 g_action, "R#Y#G#D");
1064 cmdline_parse_token_string_t cmd_fa_policer_config_yellow_string =
1065 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1066 yellow_string, "Y");
1068 cmdline_parse_token_string_t cmd_fa_policer_config_y_action =
1069 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1070 y_action, "R#Y#G#D");
1072 cmdline_parse_token_string_t cmd_fa_policer_config_red_string =
1073 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1076 cmdline_parse_token_string_t cmd_fa_policer_config_r_action =
1077 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_result,
1078 r_action, "R#Y#G#D");
1080 cmdline_parse_inst_t cmd_fa_policer_config = {
1081 .f = cmd_fa_policer_config_parsed,
1083 .help_str = "Flow policer configuration (single flow)",
1085 (void *) &cmd_fa_policer_config_p_string,
1086 (void *) &cmd_fa_policer_config_pipeline_id,
1087 (void *) &cmd_fa_policer_config_flow_string,
1088 (void *) &cmd_fa_policer_config_flow_id,
1089 (void *) &cmd_fa_policer_config_policer_string,
1090 (void *) &cmd_fa_policer_config_policer_id,
1091 (void *) &cmd_fa_policer_config_green_string,
1092 (void *) &cmd_fa_policer_config_g_action,
1093 (void *) &cmd_fa_policer_config_yellow_string,
1094 (void *) &cmd_fa_policer_config_y_action,
1095 (void *) &cmd_fa_policer_config_red_string,
1096 (void *) &cmd_fa_policer_config_r_action,
1102 * Flow policer configuration (multiple flows)
1104 * p <pipeline ID> flows <n_flows> policer <policer ID>
1105 * G <action> Y <action> R <action>
1107 * <action> = G (green) | Y (yellow) | R (red) | D (drop)
1110 struct cmd_fa_policer_config_bulk_result {
1111 cmdline_fixed_string_t p_string;
1112 uint32_t pipeline_id;
1113 cmdline_fixed_string_t flows_string;
1115 cmdline_fixed_string_t policer_string;
1116 uint32_t policer_id;
1117 cmdline_fixed_string_t green_string;
1118 cmdline_fixed_string_t g_action;
1119 cmdline_fixed_string_t yellow_string;
1120 cmdline_fixed_string_t y_action;
1121 cmdline_fixed_string_t red_string;
1122 cmdline_fixed_string_t r_action;
1126 cmd_fa_policer_config_bulk_parsed(
1127 void *parsed_result,
1128 __rte_unused struct cmdline *cl,
1131 struct cmd_fa_policer_config_bulk_result *params = parsed_result;
1132 struct app_params *app = data;
1133 struct pipeline_fa_flow_params flow_template, *flow_params;
1134 uint32_t *flow_id, i;
1137 if ((params->n_flows == 0) ||
1138 (params->policer_id >= PIPELINE_FA_N_TC_MAX)) {
1139 printf("Invalid arguments\n");
1143 flow_id = (uint32_t *) rte_malloc(NULL,
1144 N_FLOWS_BULK * sizeof(uint32_t),
1145 RTE_CACHE_LINE_SIZE);
1146 if (flow_id == NULL) {
1147 printf("Memory allocation failed\n");
1151 flow_params = (struct pipeline_fa_flow_params *) rte_malloc(NULL,
1152 N_FLOWS_BULK * sizeof(struct pipeline_fa_flow_params),
1153 RTE_CACHE_LINE_SIZE);
1154 if (flow_params == NULL) {
1156 printf("Memory allocation failed\n");
1160 memset(&flow_template, 0, sizeof(flow_template));
1162 status = string_to_policer_action(params->g_action,
1163 &flow_template.p[params->policer_id].action[e_RTE_METER_GREEN]);
1165 printf("Invalid policer green action\n");
1167 status = string_to_policer_action(params->y_action,
1168 &flow_template.p[params->policer_id].action[e_RTE_METER_YELLOW]);
1170 printf("Invalid policer yellow action\n");
1172 status = string_to_policer_action(params->r_action,
1173 &flow_template.p[params->policer_id].action[e_RTE_METER_RED]);
1175 printf("Invalid policer red action\n");
1177 for (i = 0; i < params->n_flows; i++) {
1178 uint32_t pos = i % N_FLOWS_BULK;
1181 memcpy(&flow_params[pos], &flow_template,
1182 sizeof(flow_template));
1184 if ((pos == N_FLOWS_BULK - 1) ||
1185 (i == params->n_flows - 1)) {
1188 status = app_pipeline_fa_flow_config_bulk(app,
1189 params->pipeline_id,
1193 1 << params->policer_id,
1198 printf("Command failed\n");
1205 rte_free(flow_params);
1210 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_p_string =
1211 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1214 cmdline_parse_token_num_t cmd_fa_policer_config_bulk_pipeline_id =
1215 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1216 pipeline_id, UINT32);
1218 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_flows_string =
1219 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1220 flows_string, "flows");
1222 cmdline_parse_token_num_t cmd_fa_policer_config_bulk_n_flows =
1223 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1226 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_policer_string =
1227 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1228 policer_string, "policer");
1230 cmdline_parse_token_num_t cmd_fa_policer_config_bulk_policer_id =
1231 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1232 policer_id, UINT32);
1234 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_green_string =
1235 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1238 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_g_action =
1239 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1240 g_action, "R#Y#G#D");
1242 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_yellow_string =
1243 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1244 yellow_string, "Y");
1246 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_y_action =
1247 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1248 y_action, "R#Y#G#D");
1250 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_red_string =
1251 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1254 cmdline_parse_token_string_t cmd_fa_policer_config_bulk_r_action =
1255 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_config_bulk_result,
1256 r_action, "R#Y#G#D");
1258 cmdline_parse_inst_t cmd_fa_policer_config_bulk = {
1259 .f = cmd_fa_policer_config_bulk_parsed,
1261 .help_str = "Flow policer configuration (multiple flows)",
1263 (void *) &cmd_fa_policer_config_bulk_p_string,
1264 (void *) &cmd_fa_policer_config_bulk_pipeline_id,
1265 (void *) &cmd_fa_policer_config_bulk_flows_string,
1266 (void *) &cmd_fa_policer_config_bulk_n_flows,
1267 (void *) &cmd_fa_policer_config_bulk_policer_string,
1268 (void *) &cmd_fa_policer_config_bulk_policer_id,
1269 (void *) &cmd_fa_policer_config_bulk_green_string,
1270 (void *) &cmd_fa_policer_config_bulk_g_action,
1271 (void *) &cmd_fa_policer_config_bulk_yellow_string,
1272 (void *) &cmd_fa_policer_config_bulk_y_action,
1273 (void *) &cmd_fa_policer_config_bulk_red_string,
1274 (void *) &cmd_fa_policer_config_bulk_r_action,
1280 * Flow output port configuration (single flow)
1282 * p <pipeline ID> flow <flow ID> port <port ID>
1285 struct cmd_fa_output_port_config_result {
1286 cmdline_fixed_string_t p_string;
1287 uint32_t pipeline_id;
1288 cmdline_fixed_string_t flow_string;
1290 cmdline_fixed_string_t port_string;
1295 cmd_fa_output_port_config_parsed(
1296 void *parsed_result,
1297 __rte_unused struct cmdline *cl,
1300 struct cmd_fa_output_port_config_result *params = parsed_result;
1301 struct app_params *app = data;
1302 struct pipeline_fa_flow_params flow_params;
1305 flow_params.port_id = params->port_id;
1307 status = app_pipeline_fa_flow_config(app,
1308 params->pipeline_id,
1316 printf("Command failed\n");
1319 cmdline_parse_token_string_t cmd_fa_output_port_config_p_string =
1320 TOKEN_STRING_INITIALIZER(struct cmd_fa_output_port_config_result,
1323 cmdline_parse_token_num_t cmd_fa_output_port_config_pipeline_id =
1324 TOKEN_NUM_INITIALIZER(struct cmd_fa_output_port_config_result,
1325 pipeline_id, UINT32);
1327 cmdline_parse_token_string_t cmd_fa_output_port_config_flow_string =
1328 TOKEN_STRING_INITIALIZER(struct cmd_fa_output_port_config_result,
1329 flow_string, "flow");
1331 cmdline_parse_token_num_t cmd_fa_output_port_config_flow_id =
1332 TOKEN_NUM_INITIALIZER(struct cmd_fa_output_port_config_result,
1335 cmdline_parse_token_string_t cmd_fa_output_port_config_port_string =
1336 TOKEN_STRING_INITIALIZER(struct cmd_fa_output_port_config_result,
1337 port_string, "port");
1339 cmdline_parse_token_num_t cmd_fa_output_port_config_port_id =
1340 TOKEN_NUM_INITIALIZER(struct cmd_fa_output_port_config_result,
1343 cmdline_parse_inst_t cmd_fa_output_port_config = {
1344 .f = cmd_fa_output_port_config_parsed,
1346 .help_str = "Flow output port configuration (single flow)",
1348 (void *) &cmd_fa_output_port_config_p_string,
1349 (void *) &cmd_fa_output_port_config_pipeline_id,
1350 (void *) &cmd_fa_output_port_config_flow_string,
1351 (void *) &cmd_fa_output_port_config_flow_id,
1352 (void *) &cmd_fa_output_port_config_port_string,
1353 (void *) &cmd_fa_output_port_config_port_id,
1359 * Flow output port configuration (multiple flows)
1361 * p <pipeline ID> flows <n_flows> ports <n_ports>
1364 struct cmd_fa_output_port_config_bulk_result {
1365 cmdline_fixed_string_t p_string;
1366 uint32_t pipeline_id;
1367 cmdline_fixed_string_t flows_string;
1369 cmdline_fixed_string_t ports_string;
1374 cmd_fa_output_port_config_bulk_parsed(
1375 void *parsed_result,
1376 __rte_unused struct cmdline *cl,
1379 struct cmd_fa_output_port_config_bulk_result *params = parsed_result;
1380 struct app_params *app = data;
1381 struct pipeline_fa_flow_params *flow_params;
1385 if (params->n_flows == 0) {
1386 printf("Invalid arguments\n");
1390 flow_id = (uint32_t *) rte_malloc(NULL,
1391 N_FLOWS_BULK * sizeof(uint32_t),
1392 RTE_CACHE_LINE_SIZE);
1393 if (flow_id == NULL) {
1394 printf("Memory allocation failed\n");
1398 flow_params = (struct pipeline_fa_flow_params *) rte_malloc(NULL,
1399 N_FLOWS_BULK * sizeof(struct pipeline_fa_flow_params),
1400 RTE_CACHE_LINE_SIZE);
1401 if (flow_params == NULL) {
1403 printf("Memory allocation failed\n");
1407 for (i = 0; i < params->n_flows; i++) {
1408 uint32_t pos = i % N_FLOWS_BULK;
1409 uint32_t port_id = i % params->n_ports;
1413 memset(&flow_params[pos], 0, sizeof(flow_params[pos]));
1414 flow_params[pos].port_id = port_id;
1416 if ((pos == N_FLOWS_BULK - 1) ||
1417 (i == params->n_flows - 1)) {
1420 status = app_pipeline_fa_flow_config_bulk(app,
1421 params->pipeline_id,
1430 printf("Command failed\n");
1437 rte_free(flow_params);
1442 cmdline_parse_token_string_t cmd_fa_output_port_config_bulk_p_string =
1443 TOKEN_STRING_INITIALIZER(struct cmd_fa_output_port_config_bulk_result,
1446 cmdline_parse_token_num_t cmd_fa_output_port_config_bulk_pipeline_id =
1447 TOKEN_NUM_INITIALIZER(struct cmd_fa_output_port_config_bulk_result,
1448 pipeline_id, UINT32);
1450 cmdline_parse_token_string_t cmd_fa_output_port_config_bulk_flows_string =
1451 TOKEN_STRING_INITIALIZER(struct cmd_fa_output_port_config_bulk_result,
1452 flows_string, "flows");
1454 cmdline_parse_token_num_t cmd_fa_output_port_config_bulk_n_flows =
1455 TOKEN_NUM_INITIALIZER(struct cmd_fa_output_port_config_bulk_result,
1458 cmdline_parse_token_string_t cmd_fa_output_port_config_bulk_ports_string =
1459 TOKEN_STRING_INITIALIZER(struct cmd_fa_output_port_config_bulk_result,
1460 ports_string, "ports");
1462 cmdline_parse_token_num_t cmd_fa_output_port_config_bulk_n_ports =
1463 TOKEN_NUM_INITIALIZER(struct cmd_fa_output_port_config_bulk_result,
1466 cmdline_parse_inst_t cmd_fa_output_port_config_bulk = {
1467 .f = cmd_fa_output_port_config_bulk_parsed,
1469 .help_str = "Flow output port configuration (multiple flows)",
1471 (void *) &cmd_fa_output_port_config_bulk_p_string,
1472 (void *) &cmd_fa_output_port_config_bulk_pipeline_id,
1473 (void *) &cmd_fa_output_port_config_bulk_flows_string,
1474 (void *) &cmd_fa_output_port_config_bulk_n_flows,
1475 (void *) &cmd_fa_output_port_config_bulk_ports_string,
1476 (void *) &cmd_fa_output_port_config_bulk_n_ports,
1482 * Flow DiffServ Code Point (DSCP) translation table configuration
1484 * p <pipeline ID> dscp <DSCP ID> class <traffic class ID> color <color>
1486 * <color> = G (green) | Y (yellow) | R (red)
1489 struct cmd_fa_dscp_config_result {
1490 cmdline_fixed_string_t p_string;
1491 uint32_t pipeline_id;
1492 cmdline_fixed_string_t dscp_string;
1494 cmdline_fixed_string_t class_string;
1495 uint32_t traffic_class_id;
1496 cmdline_fixed_string_t color_string;
1497 cmdline_fixed_string_t color;
1502 cmd_fa_dscp_config_parsed(
1503 void *parsed_result,
1504 __rte_unused struct cmdline *cl,
1507 struct cmd_fa_dscp_config_result *params = parsed_result;
1508 struct app_params *app = data;
1509 enum rte_meter_color color;
1512 status = string_to_color(params->color, &color);
1514 printf("Invalid color\n");
1518 status = app_pipeline_fa_dscp_config(app,
1519 params->pipeline_id,
1521 params->traffic_class_id,
1525 printf("Command failed\n");
1528 cmdline_parse_token_string_t cmd_fa_dscp_config_p_string =
1529 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_config_result,
1532 cmdline_parse_token_num_t cmd_fa_dscp_config_pipeline_id =
1533 TOKEN_NUM_INITIALIZER(struct cmd_fa_dscp_config_result,
1534 pipeline_id, UINT32);
1536 cmdline_parse_token_string_t cmd_fa_dscp_config_dscp_string =
1537 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_config_result,
1538 dscp_string, "dscp");
1540 cmdline_parse_token_num_t cmd_fa_dscp_config_dscp_id =
1541 TOKEN_NUM_INITIALIZER(struct cmd_fa_dscp_config_result,
1544 cmdline_parse_token_string_t cmd_fa_dscp_config_class_string =
1545 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_config_result,
1546 class_string, "class");
1548 cmdline_parse_token_num_t cmd_fa_dscp_config_traffic_class_id =
1549 TOKEN_NUM_INITIALIZER(struct cmd_fa_dscp_config_result,
1550 traffic_class_id, UINT32);
1552 cmdline_parse_token_string_t cmd_fa_dscp_config_color_string =
1553 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_config_result,
1554 color_string, "color");
1556 cmdline_parse_token_string_t cmd_fa_dscp_config_color =
1557 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_config_result,
1560 cmdline_parse_inst_t cmd_fa_dscp_config = {
1561 .f = cmd_fa_dscp_config_parsed,
1563 .help_str = "Flow DSCP translation table configuration",
1565 (void *) &cmd_fa_dscp_config_p_string,
1566 (void *) &cmd_fa_dscp_config_pipeline_id,
1567 (void *) &cmd_fa_dscp_config_dscp_string,
1568 (void *) &cmd_fa_dscp_config_dscp_id,
1569 (void *) &cmd_fa_dscp_config_class_string,
1570 (void *) &cmd_fa_dscp_config_traffic_class_id,
1571 (void *) &cmd_fa_dscp_config_color_string,
1572 (void *) &cmd_fa_dscp_config_color,
1578 * Flow policer stats read
1580 * p <pipeline ID> flow <flow ID> policer <policer ID> stats
1583 struct cmd_fa_policer_stats_result {
1584 cmdline_fixed_string_t p_string;
1585 uint32_t pipeline_id;
1586 cmdline_fixed_string_t flow_string;
1588 cmdline_fixed_string_t policer_string;
1589 uint32_t policer_id;
1590 cmdline_fixed_string_t stats_string;
1594 cmd_fa_policer_stats_parsed(
1595 void *parsed_result,
1596 __rte_unused struct cmdline *cl,
1599 struct cmd_fa_policer_stats_result *params = parsed_result;
1600 struct app_params *app = data;
1601 struct pipeline_fa_policer_stats stats;
1604 status = app_pipeline_fa_flow_policer_stats_read(app,
1605 params->pipeline_id,
1611 printf("Command failed\n");
1616 printf("\tPkts G: %" PRIu64
1617 "\tPkts Y: %" PRIu64
1618 "\tPkts R: %" PRIu64
1619 "\tPkts D: %" PRIu64 "\n",
1620 stats.n_pkts[e_RTE_METER_GREEN],
1621 stats.n_pkts[e_RTE_METER_YELLOW],
1622 stats.n_pkts[e_RTE_METER_RED],
1626 cmdline_parse_token_string_t cmd_fa_policer_stats_p_string =
1627 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_stats_result,
1630 cmdline_parse_token_num_t cmd_fa_policer_stats_pipeline_id =
1631 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_stats_result,
1632 pipeline_id, UINT32);
1634 cmdline_parse_token_string_t cmd_fa_policer_stats_flow_string =
1635 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_stats_result,
1636 flow_string, "flow");
1638 cmdline_parse_token_num_t cmd_fa_policer_stats_flow_id =
1639 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_stats_result,
1642 cmdline_parse_token_string_t cmd_fa_policer_stats_policer_string =
1643 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_stats_result,
1644 policer_string, "policer");
1646 cmdline_parse_token_num_t cmd_fa_policer_stats_policer_id =
1647 TOKEN_NUM_INITIALIZER(struct cmd_fa_policer_stats_result,
1648 policer_id, UINT32);
1650 cmdline_parse_token_string_t cmd_fa_policer_stats_string =
1651 TOKEN_STRING_INITIALIZER(struct cmd_fa_policer_stats_result,
1652 stats_string, "stats");
1654 cmdline_parse_inst_t cmd_fa_policer_stats = {
1655 .f = cmd_fa_policer_stats_parsed,
1657 .help_str = "Flow policer stats read",
1659 (void *) &cmd_fa_policer_stats_p_string,
1660 (void *) &cmd_fa_policer_stats_pipeline_id,
1661 (void *) &cmd_fa_policer_stats_flow_string,
1662 (void *) &cmd_fa_policer_stats_flow_id,
1663 (void *) &cmd_fa_policer_stats_policer_string,
1664 (void *) &cmd_fa_policer_stats_policer_id,
1665 (void *) &cmd_fa_policer_stats_string,
1673 * p <pipeline ID> flow ls
1676 struct cmd_fa_flow_ls_result {
1677 cmdline_fixed_string_t p_string;
1678 uint32_t pipeline_id;
1679 cmdline_fixed_string_t flow_string;
1680 cmdline_fixed_string_t actions_string;
1681 cmdline_fixed_string_t ls_string;
1685 cmd_fa_flow_ls_parsed(
1686 void *parsed_result,
1687 __rte_unused struct cmdline *cl,
1690 struct cmd_fa_flow_ls_result *params = parsed_result;
1691 struct app_params *app = data;
1694 status = app_pipeline_fa_flow_ls(app, params->pipeline_id);
1696 printf("Command failed\n");
1699 cmdline_parse_token_string_t cmd_fa_flow_ls_p_string =
1700 TOKEN_STRING_INITIALIZER(struct cmd_fa_flow_ls_result,
1703 cmdline_parse_token_num_t cmd_fa_flow_ls_pipeline_id =
1704 TOKEN_NUM_INITIALIZER(struct cmd_fa_flow_ls_result,
1705 pipeline_id, UINT32);
1707 cmdline_parse_token_string_t cmd_fa_flow_ls_flow_string =
1708 TOKEN_STRING_INITIALIZER(struct cmd_fa_flow_ls_result,
1709 flow_string, "flow");
1711 cmdline_parse_token_string_t cmd_fa_flow_ls_actions_string =
1712 TOKEN_STRING_INITIALIZER(struct cmd_fa_flow_ls_result,
1713 actions_string, "actions");
1715 cmdline_parse_token_string_t cmd_fa_flow_ls_ls_string =
1716 TOKEN_STRING_INITIALIZER(struct cmd_fa_flow_ls_result,
1719 cmdline_parse_inst_t cmd_fa_flow_ls = {
1720 .f = cmd_fa_flow_ls_parsed,
1722 .help_str = "Flow actions list",
1724 (void *) &cmd_fa_flow_ls_p_string,
1725 (void *) &cmd_fa_flow_ls_pipeline_id,
1726 (void *) &cmd_fa_flow_ls_flow_string,
1727 (void *) &cmd_fa_flow_ls_actions_string,
1728 (void *) &cmd_fa_flow_ls_ls_string,
1734 * Flow DiffServ Code Point (DSCP) translation table list
1736 * p <pipeline ID> dscp ls
1739 struct cmd_fa_dscp_ls_result {
1740 cmdline_fixed_string_t p_string;
1741 uint32_t pipeline_id;
1742 cmdline_fixed_string_t dscp_string;
1743 cmdline_fixed_string_t ls_string;
1747 cmd_fa_dscp_ls_parsed(
1748 void *parsed_result,
1749 __rte_unused struct cmdline *cl,
1752 struct cmd_fa_dscp_ls_result *params = parsed_result;
1753 struct app_params *app = data;
1756 status = app_pipeline_fa_dscp_ls(app, params->pipeline_id);
1758 printf("Command failed\n");
1761 cmdline_parse_token_string_t cmd_fa_dscp_ls_p_string =
1762 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_ls_result,
1765 cmdline_parse_token_num_t cmd_fa_dscp_ls_pipeline_id =
1766 TOKEN_NUM_INITIALIZER(struct cmd_fa_dscp_ls_result,
1767 pipeline_id, UINT32);
1769 cmdline_parse_token_string_t cmd_fa_dscp_ls_dscp_string =
1770 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_ls_result,
1771 dscp_string, "dscp");
1773 cmdline_parse_token_string_t cmd_fa_dscp_ls_string =
1774 TOKEN_STRING_INITIALIZER(struct cmd_fa_dscp_ls_result, ls_string,
1777 cmdline_parse_inst_t cmd_fa_dscp_ls = {
1778 .f = cmd_fa_dscp_ls_parsed,
1780 .help_str = "Flow DSCP translaton table list",
1782 (void *) &cmd_fa_dscp_ls_p_string,
1783 (void *) &cmd_fa_dscp_ls_pipeline_id,
1784 (void *) &cmd_fa_dscp_ls_dscp_string,
1785 (void *) &cmd_fa_dscp_ls_string,
1790 static cmdline_parse_ctx_t pipeline_cmds[] = {
1791 (cmdline_parse_inst_t *) &cmd_fa_meter_config,
1792 (cmdline_parse_inst_t *) &cmd_fa_meter_config_bulk,
1793 (cmdline_parse_inst_t *) &cmd_fa_policer_config,
1794 (cmdline_parse_inst_t *) &cmd_fa_policer_config_bulk,
1795 (cmdline_parse_inst_t *) &cmd_fa_output_port_config,
1796 (cmdline_parse_inst_t *) &cmd_fa_output_port_config_bulk,
1797 (cmdline_parse_inst_t *) &cmd_fa_dscp_config,
1798 (cmdline_parse_inst_t *) &cmd_fa_policer_stats,
1799 (cmdline_parse_inst_t *) &cmd_fa_flow_ls,
1800 (cmdline_parse_inst_t *) &cmd_fa_dscp_ls,
1804 static struct pipeline_fe_ops pipeline_flow_actions_fe_ops = {
1805 .f_init = app_pipeline_fa_init,
1806 .f_free = app_pipeline_fa_free,
1807 .cmds = pipeline_cmds,
1810 struct pipeline_type pipeline_flow_actions = {
1811 .name = "FLOW_ACTIONS",
1812 .be_ops = &pipeline_flow_actions_be_ops,
1813 .fe_ops = &pipeline_flow_actions_fe_ops,