examples/ip_pipeline: remove flow actions pipeline
authorJasvinder Singh <jasvinder.singh@intel.com>
Thu, 29 Mar 2018 18:31:35 +0000 (19:31 +0100)
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>
Wed, 4 Apr 2018 10:26:21 +0000 (12:26 +0200)
Remove flow actions pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
examples/ip_pipeline/Makefile
examples/ip_pipeline/init.c
examples/ip_pipeline/meson.build
examples/ip_pipeline/pipeline/pipeline_flow_actions.c [deleted file]
examples/ip_pipeline/pipeline/pipeline_flow_actions.h [deleted file]
examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c [deleted file]
examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h [deleted file]

index e43001f..0782308 100644 (file)
@@ -21,8 +21,6 @@ SRCS-y += pipeline_master_be.c
 SRCS-y += pipeline_master.c
 SRCS-y += pipeline_firewall_be.c
 SRCS-y += pipeline_firewall.c
-SRCS-y += pipeline_flow_actions_be.c
-SRCS-y += pipeline_flow_actions.c
 
 # Build using pkg-config variables if possible
 $(shell pkg-config --exists libdpdk)
index 4780bb1..6599b0d 100644 (file)
@@ -27,7 +27,6 @@
 #include "pipeline_common_fe.h"
 #include "pipeline_master.h"
 #include "pipeline_firewall.h"
-#include "pipeline_flow_actions.h"
 #include "thread_fe.h"
 
 #define APP_NAME_SIZE  32
@@ -1819,7 +1818,6 @@ int app_init(struct app_params *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_flow_actions);
        app_pipeline_type_register(app, &pipeline_firewall);
 
        app_init_pipelines(app);
index dd12870..71812f4 100644 (file)
@@ -23,8 +23,6 @@ sources = files(
        'pipeline/pipeline_common_fe.c',
        'pipeline/pipeline_firewall_be.c',
        'pipeline/pipeline_firewall.c',
-       'pipeline/pipeline_flow_actions_be.c',
-       'pipeline/pipeline_flow_actions.c',
        'pipeline/pipeline_master_be.c',
        'pipeline/pipeline_master.c',
 )
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_actions.c b/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
deleted file mode 100644 (file)
index 021aee1..0000000
+++ /dev/null
@@ -1,1286 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/queue.h>
-#include <netinet/in.h>
-#include <unistd.h>
-
-#include <rte_common.h>
-#include <rte_hexdump.h>
-#include <rte_malloc.h>
-#include <cmdline_rdline.h>
-#include <cmdline_parse.h>
-#include <cmdline_parse_num.h>
-#include <cmdline_parse_string.h>
-
-#include "app.h"
-#include "pipeline_common_fe.h"
-#include "pipeline_flow_actions.h"
-#include "hash_func.h"
-#include "parser.h"
-
-/*
- * Flow actions pipeline
- */
-#ifndef N_FLOWS_BULK
-#define N_FLOWS_BULK                                   4096
-#endif
-
-struct app_pipeline_fa_flow {
-       struct pipeline_fa_flow_params params;
-       void *entry_ptr;
-};
-
-struct app_pipeline_fa_dscp {
-       uint32_t traffic_class;
-       enum rte_meter_color color;
-};
-
-struct app_pipeline_fa {
-       /* Parameters */
-       uint32_t n_ports_in;
-       uint32_t n_ports_out;
-       struct pipeline_fa_params params;
-
-       /* Flows */
-       struct app_pipeline_fa_dscp dscp[PIPELINE_FA_N_DSCP];
-       struct app_pipeline_fa_flow *flows;
-} __rte_cache_aligned;
-
-static void*
-app_pipeline_fa_init(struct pipeline_params *params,
-       __rte_unused void *arg)
-{
-       struct app_pipeline_fa *p;
-       uint32_t size, i;
-
-       /* Check input arguments */
-       if ((params == NULL) ||
-               (params->n_ports_in == 0) ||
-               (params->n_ports_out == 0))
-               return NULL;
-
-       /* Memory allocation */
-       size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct app_pipeline_fa));
-       p = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
-       if (p == NULL)
-               return NULL;
-
-       /* Initialization */
-       p->n_ports_in = params->n_ports_in;
-       p->n_ports_out = params->n_ports_out;
-       if (pipeline_fa_parse_args(&p->params, params)) {
-               rte_free(p);
-               return NULL;
-       }
-
-       /* Memory allocation */
-       size = RTE_CACHE_LINE_ROUNDUP(
-               p->params.n_flows * sizeof(struct app_pipeline_fa_flow));
-       p->flows = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
-       if (p->flows == NULL) {
-               rte_free(p);
-               return NULL;
-       }
-
-       /* Initialization of flow table */
-       for (i = 0; i < p->params.n_flows; i++)
-               pipeline_fa_flow_params_set_default(&p->flows[i].params);
-
-       /* Initialization of DSCP table */
-       for (i = 0; i < RTE_DIM(p->dscp); i++) {
-               p->dscp[i].traffic_class = 0;
-               p->dscp[i].color = e_RTE_METER_GREEN;
-       }
-
-       return (void *) p;
-}
-
-static int
-app_pipeline_fa_free(void *pipeline)
-{
-       struct app_pipeline_fa *p = pipeline;
-
-       /* Check input arguments */
-       if (p == NULL)
-               return -1;
-
-       /* Free resources */
-       rte_free(p->flows);
-       rte_free(p);
-
-       return 0;
-}
-
-static int
-flow_params_check(struct app_pipeline_fa *p,
-       __rte_unused uint32_t meter_update_mask,
-       uint32_t policer_update_mask,
-       uint32_t port_update,
-       struct pipeline_fa_flow_params *params)
-{
-       uint32_t mask, i;
-
-       /* Meter */
-
-       /* Policer */
-       for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
-               struct pipeline_fa_policer_params *p = &params->p[i];
-               uint32_t j;
-
-               if ((mask & policer_update_mask) == 0)
-                       continue;
-
-               for (j = 0; j < e_RTE_METER_COLORS; j++) {
-                       struct pipeline_fa_policer_action *action =
-                               &p->action[j];
-
-                       if ((action->drop == 0) &&
-                               (action->color >= e_RTE_METER_COLORS))
-                               return -1;
-               }
-       }
-
-       /* Port */
-       if (port_update && (params->port_id >= p->n_ports_out))
-               return -1;
-
-       return 0;
-}
-
-int
-app_pipeline_fa_flow_config(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t flow_id,
-       uint32_t meter_update_mask,
-       uint32_t policer_update_mask,
-       uint32_t port_update,
-       struct pipeline_fa_flow_params *params)
-{
-       struct app_pipeline_fa *p;
-       struct app_pipeline_fa_flow *flow;
-
-       struct pipeline_fa_flow_config_msg_req *req;
-       struct pipeline_fa_flow_config_msg_rsp *rsp;
-
-       uint32_t i, mask;
-
-       /* Check input arguments */
-       if ((app == NULL) ||
-               ((meter_update_mask == 0) &&
-               (policer_update_mask == 0) &&
-               (port_update == 0)) ||
-               (meter_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
-               (policer_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
-               (params == NULL))
-               return -1;
-
-       p = app_pipeline_data_fe(app, pipeline_id,
-               &pipeline_flow_actions);
-       if (p == NULL)
-               return -1;
-
-       if (flow_params_check(p,
-               meter_update_mask,
-               policer_update_mask,
-               port_update,
-               params) != 0)
-               return -1;
-
-       flow_id %= p->params.n_flows;
-       flow = &p->flows[flow_id];
-
-       /* Allocate and write request */
-       req = app_msg_alloc(app);
-       if (req == NULL)
-               return -1;
-
-       req->type = PIPELINE_MSG_REQ_CUSTOM;
-       req->subtype = PIPELINE_FA_MSG_REQ_FLOW_CONFIG;
-       req->entry_ptr = flow->entry_ptr;
-       req->flow_id = flow_id;
-       req->meter_update_mask = meter_update_mask;
-       req->policer_update_mask = policer_update_mask;
-       req->port_update = port_update;
-       memcpy(&req->params, params, sizeof(*params));
-
-       /* Send request and wait for response */
-       rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
-       if (rsp == NULL)
-               return -1;
-
-       /* Read response */
-       if (rsp->status ||
-               (rsp->entry_ptr == NULL)) {
-               app_msg_free(app, rsp);
-               return -1;
-       }
-
-       /* Commit flow */
-       for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
-               if ((mask & meter_update_mask) == 0)
-                       continue;
-
-               memcpy(&flow->params.m[i], &params->m[i], sizeof(params->m[i]));
-       }
-
-       for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
-               if ((mask & policer_update_mask) == 0)
-                       continue;
-
-               memcpy(&flow->params.p[i], &params->p[i], sizeof(params->p[i]));
-       }
-
-       if (port_update)
-               flow->params.port_id = params->port_id;
-
-       flow->entry_ptr = rsp->entry_ptr;
-
-       /* Free response */
-       app_msg_free(app, rsp);
-
-       return 0;
-}
-
-int
-app_pipeline_fa_flow_config_bulk(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t *flow_id,
-       uint32_t n_flows,
-       uint32_t meter_update_mask,
-       uint32_t policer_update_mask,
-       uint32_t port_update,
-       struct pipeline_fa_flow_params *params)
-{
-       struct app_pipeline_fa *p;
-       struct pipeline_fa_flow_config_bulk_msg_req *req;
-       struct pipeline_fa_flow_config_bulk_msg_rsp *rsp;
-       void **req_entry_ptr;
-       uint32_t *req_flow_id;
-       uint32_t i;
-       int status;
-
-       /* Check input arguments */
-       if ((app == NULL) ||
-               (flow_id == NULL) ||
-               (n_flows == 0) ||
-               ((meter_update_mask == 0) &&
-               (policer_update_mask == 0) &&
-               (port_update == 0)) ||
-               (meter_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
-               (policer_update_mask >= (1 << PIPELINE_FA_N_TC_MAX)) ||
-               (params == NULL))
-               return -1;
-
-       p = app_pipeline_data_fe(app, pipeline_id,
-               &pipeline_flow_actions);
-       if (p == NULL)
-               return -1;
-
-       for (i = 0; i < n_flows; i++) {
-               struct pipeline_fa_flow_params *flow_params = &params[i];
-
-               if (flow_params_check(p,
-                       meter_update_mask,
-                       policer_update_mask,
-                       port_update,
-                       flow_params) != 0)
-                       return -1;
-       }
-
-       /* Allocate and write request */
-       req_entry_ptr = (void **) rte_malloc(NULL,
-               n_flows * sizeof(void *),
-               RTE_CACHE_LINE_SIZE);
-       if (req_entry_ptr == NULL)
-               return -1;
-
-       req_flow_id = (uint32_t *) rte_malloc(NULL,
-               n_flows * sizeof(uint32_t),
-               RTE_CACHE_LINE_SIZE);
-       if (req_flow_id == NULL) {
-               rte_free(req_entry_ptr);
-               return -1;
-       }
-
-       for (i = 0; i < n_flows; i++) {
-               uint32_t fid = flow_id[i] % p->params.n_flows;
-               struct app_pipeline_fa_flow *flow = &p->flows[fid];
-
-               req_flow_id[i] = fid;
-               req_entry_ptr[i] = flow->entry_ptr;
-       }
-
-       req = app_msg_alloc(app);
-       if (req == NULL) {
-               rte_free(req_flow_id);
-               rte_free(req_entry_ptr);
-               return -1;
-       }
-
-       req->type = PIPELINE_MSG_REQ_CUSTOM;
-       req->subtype = PIPELINE_FA_MSG_REQ_FLOW_CONFIG_BULK;
-       req->entry_ptr = req_entry_ptr;
-       req->flow_id = req_flow_id;
-       req->n_flows = n_flows;
-       req->meter_update_mask = meter_update_mask;
-       req->policer_update_mask = policer_update_mask;
-       req->port_update = port_update;
-       req->params = params;
-
-       /* Send request and wait for response */
-       rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
-       if (rsp == NULL) {
-               rte_free(req_flow_id);
-               rte_free(req_entry_ptr);
-               return -1;
-       }
-
-       /* Read response */
-       status = (rsp->n_flows == n_flows) ? 0 : -1;
-
-       /* Commit flows */
-       for (i = 0; i < rsp->n_flows; i++) {
-               uint32_t fid = flow_id[i] % p->params.n_flows;
-               struct app_pipeline_fa_flow *flow = &p->flows[fid];
-               struct pipeline_fa_flow_params *flow_params = &params[i];
-               void *entry_ptr = req_entry_ptr[i];
-               uint32_t j, mask;
-
-               for (j = 0, mask = 1; j < PIPELINE_FA_N_TC_MAX;
-                       j++, mask <<= 1) {
-                       if ((mask & meter_update_mask) == 0)
-                               continue;
-
-                       memcpy(&flow->params.m[j],
-                               &flow_params->m[j],
-                               sizeof(flow_params->m[j]));
-               }
-
-               for (j = 0, mask = 1; j < PIPELINE_FA_N_TC_MAX;
-                       j++, mask <<= 1) {
-                       if ((mask & policer_update_mask) == 0)
-                               continue;
-
-                       memcpy(&flow->params.p[j],
-                               &flow_params->p[j],
-                               sizeof(flow_params->p[j]));
-               }
-
-               if (port_update)
-                       flow->params.port_id = flow_params->port_id;
-
-               flow->entry_ptr = entry_ptr;
-       }
-
-       /* Free response */
-       app_msg_free(app, rsp);
-       rte_free(req_flow_id);
-       rte_free(req_entry_ptr);
-
-       return status;
-}
-
-int
-app_pipeline_fa_dscp_config(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t dscp,
-       uint32_t traffic_class,
-       enum rte_meter_color color)
-{
-       struct app_pipeline_fa *p;
-
-       struct pipeline_fa_dscp_config_msg_req *req;
-       struct pipeline_fa_dscp_config_msg_rsp *rsp;
-
-       /* Check input arguments */
-       if ((app == NULL) ||
-               (dscp >= PIPELINE_FA_N_DSCP) ||
-               (traffic_class >= PIPELINE_FA_N_TC_MAX) ||
-               (color >= e_RTE_METER_COLORS))
-               return -1;
-
-       p = app_pipeline_data_fe(app, pipeline_id,
-               &pipeline_flow_actions);
-       if (p == NULL)
-               return -1;
-
-       if (p->params.dscp_enabled == 0)
-               return -1;
-
-       /* Allocate and write request */
-       req = app_msg_alloc(app);
-       if (req == NULL)
-               return -1;
-
-       req->type = PIPELINE_MSG_REQ_CUSTOM;
-       req->subtype = PIPELINE_FA_MSG_REQ_DSCP_CONFIG;
-       req->dscp = dscp;
-       req->traffic_class = traffic_class;
-       req->color = color;
-
-       /* Send request and wait for response */
-       rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
-       if (rsp == NULL)
-               return -1;
-
-       /* Read response */
-       if (rsp->status) {
-               app_msg_free(app, rsp);
-               return -1;
-       }
-
-       /* Commit DSCP */
-       p->dscp[dscp].traffic_class = traffic_class;
-       p->dscp[dscp].color = color;
-
-       /* Free response */
-       app_msg_free(app, rsp);
-
-       return 0;
-}
-
-int
-app_pipeline_fa_flow_policer_stats_read(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t flow_id,
-       uint32_t policer_id,
-       int clear,
-       struct pipeline_fa_policer_stats *stats)
-{
-       struct app_pipeline_fa *p;
-       struct app_pipeline_fa_flow *flow;
-
-       struct pipeline_fa_policer_stats_msg_req *req;
-       struct pipeline_fa_policer_stats_msg_rsp *rsp;
-
-       /* Check input arguments */
-       if ((app == NULL) || (stats == NULL))
-               return -1;
-
-       p = app_pipeline_data_fe(app, pipeline_id,
-               &pipeline_flow_actions);
-       if (p == NULL)
-               return -1;
-
-       flow_id %= p->params.n_flows;
-       flow = &p->flows[flow_id];
-
-       if ((policer_id >= p->params.n_meters_per_flow) ||
-               (flow->entry_ptr == NULL))
-               return -1;
-
-       /* Allocate and write request */
-       req = app_msg_alloc(app);
-       if (req == NULL)
-               return -1;
-
-       req->type = PIPELINE_MSG_REQ_CUSTOM;
-       req->subtype = PIPELINE_FA_MSG_REQ_POLICER_STATS_READ;
-       req->entry_ptr = flow->entry_ptr;
-       req->policer_id = policer_id;
-       req->clear = clear;
-
-       /* Send request and wait for response */
-       rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
-       if (rsp == NULL)
-               return -1;
-
-       /* Read response */
-       if (rsp->status) {
-               app_msg_free(app, rsp);
-               return -1;
-       }
-
-       memcpy(stats, &rsp->stats, sizeof(*stats));
-
-       /* Free response */
-       app_msg_free(app, rsp);
-
-       return 0;
-}
-
-static const char *
-color_to_string(enum rte_meter_color color)
-{
-       switch (color) {
-       case e_RTE_METER_GREEN: return "G";
-       case e_RTE_METER_YELLOW: return "Y";
-       case e_RTE_METER_RED: return "R";
-       default: return "?";
-       }
-}
-
-static int
-string_to_color(char *s, enum rte_meter_color *c)
-{
-       if (strcmp(s, "G") == 0) {
-               *c = e_RTE_METER_GREEN;
-               return 0;
-       }
-
-       if (strcmp(s, "Y") == 0) {
-               *c = e_RTE_METER_YELLOW;
-               return 0;
-       }
-
-       if (strcmp(s, "R") == 0) {
-               *c = e_RTE_METER_RED;
-               return 0;
-       }
-
-       return -1;
-}
-
-static const char *
-policer_action_to_string(struct pipeline_fa_policer_action *a)
-{
-       if (a->drop)
-               return "D";
-
-       return color_to_string(a->color);
-}
-
-static int
-string_to_policer_action(char *s, struct pipeline_fa_policer_action *a)
-{
-       if (strcmp(s, "G") == 0) {
-               a->drop = 0;
-               a->color = e_RTE_METER_GREEN;
-               return 0;
-       }
-
-       if (strcmp(s, "Y") == 0) {
-               a->drop = 0;
-               a->color = e_RTE_METER_YELLOW;
-               return 0;
-       }
-
-       if (strcmp(s, "R") == 0) {
-               a->drop = 0;
-               a->color = e_RTE_METER_RED;
-               return 0;
-       }
-
-       if (strcmp(s, "D") == 0) {
-               a->drop = 1;
-               a->color = e_RTE_METER_GREEN;
-               return 0;
-       }
-
-       return -1;
-}
-
-static void
-print_flow(struct app_pipeline_fa *p,
-       uint32_t flow_id,
-       struct app_pipeline_fa_flow *flow)
-{
-       uint32_t i;
-
-       printf("Flow ID = %" PRIu32 "\n", flow_id);
-
-       for (i = 0; i < p->params.n_meters_per_flow; i++) {
-               struct rte_meter_trtcm_params *meter = &flow->params.m[i];
-               struct pipeline_fa_policer_params *policer = &flow->params.p[i];
-
-       printf("\ttrTCM [CIR = %" PRIu64
-               ", CBS = %" PRIu64 ", PIR = %" PRIu64
-               ", PBS = %" PRIu64      "] Policer [G : %s, Y : %s, R : %s]\n",
-               meter->cir,
-               meter->cbs,
-               meter->pir,
-               meter->pbs,
-               policer_action_to_string(&policer->action[e_RTE_METER_GREEN]),
-               policer_action_to_string(&policer->action[e_RTE_METER_YELLOW]),
-               policer_action_to_string(&policer->action[e_RTE_METER_RED]));
-       }
-
-       printf("\tPort %u (entry_ptr = %p)\n",
-               flow->params.port_id,
-               flow->entry_ptr);
-}
-
-
-static int
-app_pipeline_fa_flow_ls(struct app_params *app,
-               uint32_t pipeline_id)
-{
-       struct app_pipeline_fa *p;
-       uint32_t i;
-
-       /* Check input arguments */
-       if (app == NULL)
-               return -1;
-
-       p = app_pipeline_data_fe(app, pipeline_id,
-               &pipeline_flow_actions);
-       if (p == NULL)
-               return -1;
-
-       for (i = 0; i < p->params.n_flows; i++) {
-               struct app_pipeline_fa_flow *flow = &p->flows[i];
-
-               print_flow(p, i, flow);
-       }
-
-       return 0;
-}
-
-static int
-app_pipeline_fa_dscp_ls(struct app_params *app,
-               uint32_t pipeline_id)
-{
-       struct app_pipeline_fa *p;
-       uint32_t i;
-
-       /* Check input arguments */
-       if (app == NULL)
-               return -1;
-
-       p = app_pipeline_data_fe(app, pipeline_id,
-               &pipeline_flow_actions);
-       if (p == NULL)
-               return -1;
-
-       if (p->params.dscp_enabled == 0)
-               return -1;
-
-       for (i = 0; i < RTE_DIM(p->dscp); i++) {
-               struct app_pipeline_fa_dscp *dscp =     &p->dscp[i];
-
-               printf("DSCP = %2" PRIu32 ": Traffic class = %" PRIu32
-                       ", Color = %s\n",
-                       i,
-                       dscp->traffic_class,
-                       color_to_string(dscp->color));
-       }
-
-       return 0;
-}
-
-int
-app_pipeline_fa_load_file(char *filename,
-       uint32_t *flow_ids,
-       struct pipeline_fa_flow_params *p,
-       uint32_t *n_flows,
-       uint32_t *line)
-{
-       FILE *f = NULL;
-       char file_buf[1024];
-       uint32_t i, l;
-
-       /* Check input arguments */
-       if ((filename == NULL) ||
-               (flow_ids == NULL) ||
-               (p == NULL) ||
-               (n_flows == NULL) ||
-               (*n_flows == 0) ||
-               (line == NULL)) {
-               if (line)
-                       *line = 0;
-               return -1;
-               }
-
-       /* Open input file */
-       f = fopen(filename, "r");
-       if (f == NULL) {
-               *line = 0;
-               return -1;
-       }
-
-       /* Read file */
-       for (i = 0, l = 1; i < *n_flows; l++) {
-               char *tokens[64];
-               uint32_t n_tokens = RTE_DIM(tokens);
-
-               int status;
-
-               if (fgets(file_buf, sizeof(file_buf), f) == NULL)
-                       break;
-
-               status = parse_tokenize_string(file_buf, tokens, &n_tokens);
-               if (status)
-                       goto error1;
-
-               if ((n_tokens == 0) || (tokens[0][0] == '#'))
-                       continue;
-
-
-               if ((n_tokens != 64) ||
-                       /* flow */
-                       strcmp(tokens[0], "flow") ||
-                       parser_read_uint32(&flow_ids[i], tokens[1]) ||
-
-                       /* meter & policer 0 */
-                       strcmp(tokens[2], "meter") ||
-                       strcmp(tokens[3], "0") ||
-                       strcmp(tokens[4], "trtcm") ||
-                       parser_read_uint64(&p[i].m[0].cir, tokens[5]) ||
-                       parser_read_uint64(&p[i].m[0].pir, tokens[6]) ||
-                       parser_read_uint64(&p[i].m[0].cbs, tokens[7]) ||
-                       parser_read_uint64(&p[i].m[0].pbs, tokens[8]) ||
-                       strcmp(tokens[9], "policer") ||
-                       strcmp(tokens[10], "0") ||
-                       strcmp(tokens[11], "g") ||
-                       string_to_policer_action(tokens[12],
-                               &p[i].p[0].action[e_RTE_METER_GREEN]) ||
-                       strcmp(tokens[13], "y") ||
-                       string_to_policer_action(tokens[14],
-                               &p[i].p[0].action[e_RTE_METER_YELLOW]) ||
-                       strcmp(tokens[15], "r") ||
-                       string_to_policer_action(tokens[16],
-                               &p[i].p[0].action[e_RTE_METER_RED]) ||
-
-                       /* meter & policer 1 */
-                       strcmp(tokens[17], "meter") ||
-                       strcmp(tokens[18], "1") ||
-                       strcmp(tokens[19], "trtcm") ||
-                       parser_read_uint64(&p[i].m[1].cir, tokens[20]) ||
-                       parser_read_uint64(&p[i].m[1].pir, tokens[21]) ||
-                       parser_read_uint64(&p[i].m[1].cbs, tokens[22]) ||
-                       parser_read_uint64(&p[i].m[1].pbs, tokens[23]) ||
-                       strcmp(tokens[24], "policer") ||
-                       strcmp(tokens[25], "1") ||
-                       strcmp(tokens[26], "g") ||
-                       string_to_policer_action(tokens[27],
-                               &p[i].p[1].action[e_RTE_METER_GREEN]) ||
-                       strcmp(tokens[28], "y") ||
-                       string_to_policer_action(tokens[29],
-                               &p[i].p[1].action[e_RTE_METER_YELLOW]) ||
-                       strcmp(tokens[30], "r") ||
-                       string_to_policer_action(tokens[31],
-                               &p[i].p[1].action[e_RTE_METER_RED]) ||
-
-                       /* meter & policer 2 */
-                       strcmp(tokens[32], "meter") ||
-                       strcmp(tokens[33], "2") ||
-                       strcmp(tokens[34], "trtcm") ||
-                       parser_read_uint64(&p[i].m[2].cir, tokens[35]) ||
-                       parser_read_uint64(&p[i].m[2].pir, tokens[36]) ||
-                       parser_read_uint64(&p[i].m[2].cbs, tokens[37]) ||
-                       parser_read_uint64(&p[i].m[2].pbs, tokens[38]) ||
-                       strcmp(tokens[39], "policer") ||
-                       strcmp(tokens[40], "2") ||
-                       strcmp(tokens[41], "g") ||
-                       string_to_policer_action(tokens[42],
-                               &p[i].p[2].action[e_RTE_METER_GREEN]) ||
-                       strcmp(tokens[43], "y") ||
-                       string_to_policer_action(tokens[44],
-                               &p[i].p[2].action[e_RTE_METER_YELLOW]) ||
-                       strcmp(tokens[45], "r") ||
-                       string_to_policer_action(tokens[46],
-                               &p[i].p[2].action[e_RTE_METER_RED]) ||
-
-                       /* meter & policer 3 */
-                       strcmp(tokens[47], "meter") ||
-                       strcmp(tokens[48], "3") ||
-                       strcmp(tokens[49], "trtcm") ||
-                       parser_read_uint64(&p[i].m[3].cir, tokens[50]) ||
-                       parser_read_uint64(&p[i].m[3].pir, tokens[51]) ||
-                       parser_read_uint64(&p[i].m[3].cbs, tokens[52]) ||
-                       parser_read_uint64(&p[i].m[3].pbs, tokens[53]) ||
-                       strcmp(tokens[54], "policer") ||
-                       strcmp(tokens[55], "3") ||
-                       strcmp(tokens[56], "g") ||
-                       string_to_policer_action(tokens[57],
-                               &p[i].p[3].action[e_RTE_METER_GREEN]) ||
-                       strcmp(tokens[58], "y") ||
-                       string_to_policer_action(tokens[59],
-                               &p[i].p[3].action[e_RTE_METER_YELLOW]) ||
-                       strcmp(tokens[60], "r") ||
-                       string_to_policer_action(tokens[61],
-                               &p[i].p[3].action[e_RTE_METER_RED]) ||
-
-                       /* port */
-                       strcmp(tokens[62], "port") ||
-                       parser_read_uint32(&p[i].port_id, tokens[63]))
-                       goto error1;
-
-               i++;
-       }
-
-       /* Close file */
-       *n_flows = i;
-       fclose(f);
-       return 0;
-
-error1:
-       *line = l;
-       fclose(f);
-       return -1;
-}
-
-/*
- * action
- *
- * flow meter, policer and output port configuration:
- *    p <pipelineid> action flow <flowid> meter <meterid> trtcm <cir> <pir> <cbs> <pbs>
- *
- *    p <pipelineid> action flow <flowid> policer <policerid> g <gaction> y <yaction> r <raction>
- *  <action> is one of the following:
- *      G = recolor to green
- *      Y = recolor as yellow
- *      R = recolor as red
- *      D = drop
- *
- *    p <pipelineid> action flow <flowid> port <port ID>
- *
- *    p <pipelineid> action flow bulk <file>
- *
- * flow policer stats read:
- *    p <pipelineid> action flow <flowid> stats
- *
- * flow ls:
- *    p <pipelineid> action flow ls
- *
- * dscp table configuration:
- *    p <pipelineid> action dscp <dscpid> class <class ID> color <color>
- *
- * dscp table ls:
- *    p <pipelineid> action dscp ls
-**/
-
-struct cmd_action_result {
-       cmdline_fixed_string_t p_string;
-       uint32_t pipeline_id;
-       cmdline_fixed_string_t action_string;
-       cmdline_multi_string_t multi_string;
-};
-
-static void
-cmd_action_parsed(
-       void *parsed_result,
-       __rte_unused struct cmdline *cl,
-       void *data)
-{
-       struct cmd_action_result *params = parsed_result;
-       struct app_params *app = data;
-
-       char *tokens[16];
-       uint32_t n_tokens = RTE_DIM(tokens);
-       int status;
-
-       status = parse_tokenize_string(params->multi_string, tokens, &n_tokens);
-       if (status != 0) {
-               printf(CMD_MSG_TOO_MANY_ARGS, "action");
-               return;
-       }
-
-       /* action flow meter */
-       if ((n_tokens >= 3) &&
-               (strcmp(tokens[0], "flow") == 0) &&
-               strcmp(tokens[1], "bulk") &&
-               strcmp(tokens[1], "ls") &&
-               (strcmp(tokens[2], "meter") == 0)) {
-               struct pipeline_fa_flow_params flow_params;
-               uint32_t flow_id, meter_id;
-
-               if (n_tokens != 9) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action flow meter");
-                       return;
-               }
-
-               memset(&flow_params, 0, sizeof(flow_params));
-
-               if (parser_read_uint32(&flow_id, tokens[1])) {
-                       printf(CMD_MSG_INVALID_ARG, "flowid");
-                       return;
-               }
-
-               if (parser_read_uint32(&meter_id, tokens[3]) ||
-                       (meter_id >= PIPELINE_FA_N_TC_MAX)) {
-                       printf(CMD_MSG_INVALID_ARG, "meterid");
-                       return;
-               }
-
-               if (strcmp(tokens[4], "trtcm")) {
-                       printf(CMD_MSG_ARG_NOT_FOUND, "trtcm");
-                       return;
-               }
-
-               if (parser_read_uint64(&flow_params.m[meter_id].cir, tokens[5])) {
-                       printf(CMD_MSG_INVALID_ARG, "cir");
-                       return;
-               }
-
-               if (parser_read_uint64(&flow_params.m[meter_id].pir, tokens[6])) {
-                       printf(CMD_MSG_INVALID_ARG, "pir");
-                       return;
-               }
-
-               if (parser_read_uint64(&flow_params.m[meter_id].cbs, tokens[7])) {
-                       printf(CMD_MSG_INVALID_ARG, "cbs");
-                       return;
-               }
-
-               if (parser_read_uint64(&flow_params.m[meter_id].pbs, tokens[8])) {
-                       printf(CMD_MSG_INVALID_ARG, "pbs");
-                       return;
-               }
-
-               status = app_pipeline_fa_flow_config(app,
-                       params->pipeline_id,
-                       flow_id,
-                       1 << meter_id,
-                       0,
-                       0,
-                       &flow_params);
-               if (status)
-                       printf(CMD_MSG_FAIL, "action flow meter");
-
-               return;
-       } /* action flow meter */
-
-       /* action flow policer */
-       if ((n_tokens >= 3) &&
-               (strcmp(tokens[0], "flow") == 0) &&
-               strcmp(tokens[1], "bulk") &&
-               strcmp(tokens[1], "ls") &&
-               (strcmp(tokens[2], "policer") == 0)) {
-               struct pipeline_fa_flow_params flow_params;
-               uint32_t flow_id, policer_id;
-
-               if (n_tokens != 10) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action flow policer");
-                       return;
-               }
-
-               memset(&flow_params, 0, sizeof(flow_params));
-
-               if (parser_read_uint32(&flow_id, tokens[1])) {
-                       printf(CMD_MSG_INVALID_ARG, "flowid");
-                       return;
-               }
-
-               if (parser_read_uint32(&policer_id, tokens[3]) ||
-                       (policer_id >= PIPELINE_FA_N_TC_MAX)) {
-                       printf(CMD_MSG_INVALID_ARG, "policerid");
-                       return;
-               }
-
-               if (strcmp(tokens[4], "g")) {
-                       printf(CMD_MSG_ARG_NOT_FOUND, "g");
-                       return;
-               }
-
-               if (string_to_policer_action(tokens[5],
-                       &flow_params.p[policer_id].action[e_RTE_METER_GREEN])) {
-                       printf(CMD_MSG_INVALID_ARG, "gaction");
-                       return;
-               }
-
-               if (strcmp(tokens[6], "y")) {
-                       printf(CMD_MSG_ARG_NOT_FOUND, "y");
-                       return;
-               }
-
-               if (string_to_policer_action(tokens[7],
-                       &flow_params.p[policer_id].action[e_RTE_METER_YELLOW])) {
-                       printf(CMD_MSG_INVALID_ARG, "yaction");
-                       return;
-               }
-
-               if (strcmp(tokens[8], "r")) {
-                       printf(CMD_MSG_ARG_NOT_FOUND, "r");
-                       return;
-               }
-
-               if (string_to_policer_action(tokens[9],
-                       &flow_params.p[policer_id].action[e_RTE_METER_RED])) {
-                       printf(CMD_MSG_INVALID_ARG, "raction");
-                       return;
-               }
-
-               status = app_pipeline_fa_flow_config(app,
-                       params->pipeline_id,
-                       flow_id,
-                       0,
-                       1 << policer_id,
-                       0,
-                       &flow_params);
-               if (status != 0)
-                       printf(CMD_MSG_FAIL, "action flow policer");
-
-               return;
-       } /* action flow policer */
-
-       /* action flow port */
-       if ((n_tokens >= 3) &&
-               (strcmp(tokens[0], "flow") == 0) &&
-               strcmp(tokens[1], "bulk") &&
-               strcmp(tokens[1], "ls") &&
-               (strcmp(tokens[2], "port") == 0)) {
-               struct pipeline_fa_flow_params flow_params;
-               uint32_t flow_id, port_id;
-
-               if (n_tokens != 4) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action flow port");
-                       return;
-               }
-
-               memset(&flow_params, 0, sizeof(flow_params));
-
-               if (parser_read_uint32(&flow_id, tokens[1])) {
-                       printf(CMD_MSG_INVALID_ARG, "flowid");
-                       return;
-               }
-
-               if (parser_read_uint32(&port_id, tokens[3])) {
-                       printf(CMD_MSG_INVALID_ARG, "portid");
-                       return;
-               }
-
-               flow_params.port_id = port_id;
-
-               status = app_pipeline_fa_flow_config(app,
-                       params->pipeline_id,
-                       flow_id,
-                       0,
-                       0,
-                       1,
-                       &flow_params);
-               if (status)
-                       printf(CMD_MSG_FAIL, "action flow port");
-
-               return;
-       } /* action flow port */
-
-       /* action flow stats */
-       if ((n_tokens >= 3) &&
-               (strcmp(tokens[0], "flow") == 0) &&
-               strcmp(tokens[1], "bulk") &&
-               strcmp(tokens[1], "ls") &&
-               (strcmp(tokens[2], "stats") == 0)) {
-               struct pipeline_fa_policer_stats stats;
-               uint32_t flow_id, policer_id;
-
-               if (n_tokens != 3) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action flow stats");
-                       return;
-               }
-
-               if (parser_read_uint32(&flow_id, tokens[1])) {
-                       printf(CMD_MSG_INVALID_ARG, "flowid");
-                       return;
-               }
-
-               for (policer_id = 0;
-                       policer_id < PIPELINE_FA_N_TC_MAX;
-                       policer_id++) {
-                       status = app_pipeline_fa_flow_policer_stats_read(app,
-                               params->pipeline_id,
-                               flow_id,
-                               policer_id,
-                               1,
-                               &stats);
-                       if (status != 0) {
-                               printf(CMD_MSG_FAIL, "action flow stats");
-                               return;
-                       }
-
-                       /* Display stats */
-                       printf("\tPolicer: %" PRIu32
-                               "\tPkts G: %" PRIu64
-                               "\tPkts Y: %" PRIu64
-                               "\tPkts R: %" PRIu64
-                               "\tPkts D: %" PRIu64 "\n",
-                               policer_id,
-                               stats.n_pkts[e_RTE_METER_GREEN],
-                               stats.n_pkts[e_RTE_METER_YELLOW],
-                               stats.n_pkts[e_RTE_METER_RED],
-                               stats.n_pkts_drop);
-               }
-
-               return;
-       } /* action flow stats */
-
-       /* action flow bulk */
-       if ((n_tokens >= 2) &&
-               (strcmp(tokens[0], "flow") == 0) &&
-               (strcmp(tokens[1], "bulk") == 0)) {
-               struct pipeline_fa_flow_params *flow_params;
-               uint32_t *flow_ids, n_flows, line;
-               char *filename;
-
-               if (n_tokens != 3) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action flow bulk");
-                       return;
-               }
-
-               filename = tokens[2];
-
-               n_flows = APP_PIPELINE_FA_MAX_RECORDS_IN_FILE;
-               flow_ids = malloc(n_flows * sizeof(uint32_t));
-               if (flow_ids == NULL) {
-                       printf(CMD_MSG_OUT_OF_MEMORY);
-                       return;
-               }
-
-               flow_params = malloc(n_flows * sizeof(struct pipeline_fa_flow_params));
-               if (flow_params == NULL) {
-                       printf(CMD_MSG_OUT_OF_MEMORY);
-                       free(flow_ids);
-                       return;
-               }
-
-               status = app_pipeline_fa_load_file(filename,
-                       flow_ids,
-                       flow_params,
-                       &n_flows,
-                       &line);
-               if (status) {
-                       printf(CMD_MSG_FILE_ERR, filename, line);
-                       free(flow_params);
-                       free(flow_ids);
-                       return;
-               }
-
-               status = app_pipeline_fa_flow_config_bulk(app,
-                       params->pipeline_id,
-                       flow_ids,
-                       n_flows,
-                       0xF,
-                       0xF,
-                       1,
-                       flow_params);
-               if (status)
-                       printf(CMD_MSG_FAIL, "action flow bulk");
-
-               free(flow_params);
-               free(flow_ids);
-               return;
-       } /* action flow bulk */
-
-       /* action flow ls */
-       if ((n_tokens >= 2) &&
-               (strcmp(tokens[0], "flow") == 0) &&
-               (strcmp(tokens[1], "ls") == 0)) {
-               if (n_tokens != 2) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action flow ls");
-                       return;
-               }
-
-               status = app_pipeline_fa_flow_ls(app,
-                       params->pipeline_id);
-               if (status)
-                       printf(CMD_MSG_FAIL, "action flow ls");
-
-               return;
-       } /* action flow ls */
-
-       /* action dscp */
-       if ((n_tokens >= 2) &&
-               (strcmp(tokens[0], "dscp") == 0) &&
-               strcmp(tokens[1], "ls")) {
-               uint32_t dscp_id, tc_id;
-               enum rte_meter_color color;
-
-               if (n_tokens != 6) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action dscp");
-                       return;
-               }
-
-               if (parser_read_uint32(&dscp_id, tokens[1])) {
-                       printf(CMD_MSG_INVALID_ARG, "dscpid");
-                       return;
-               }
-
-               if (strcmp(tokens[2], "class")) {
-                       printf(CMD_MSG_ARG_NOT_FOUND, "class");
-                       return;
-               }
-
-               if (parser_read_uint32(&tc_id, tokens[3])) {
-                       printf(CMD_MSG_INVALID_ARG, "classid");
-                       return;
-               }
-
-               if (strcmp(tokens[4], "color")) {
-                       printf(CMD_MSG_ARG_NOT_FOUND, "color");
-                       return;
-               }
-
-               if (string_to_color(tokens[5], &color)) {
-                       printf(CMD_MSG_INVALID_ARG, "colorid");
-                       return;
-               }
-
-               status = app_pipeline_fa_dscp_config(app,
-                       params->pipeline_id,
-                       dscp_id,
-                       tc_id,
-                       color);
-               if (status != 0)
-                       printf(CMD_MSG_FAIL, "action dscp");
-
-               return;
-       } /* action dscp */
-
-       /* action dscp ls */
-       if ((n_tokens >= 2) &&
-               (strcmp(tokens[0], "dscp") == 0) &&
-               (strcmp(tokens[1], "ls") == 0)) {
-               if (n_tokens != 2) {
-                       printf(CMD_MSG_MISMATCH_ARGS, "action dscp ls");
-                       return;
-               }
-
-               status = app_pipeline_fa_dscp_ls(app,
-                       params->pipeline_id);
-               if (status)
-                       printf(CMD_MSG_FAIL, "action dscp ls");
-
-               return;
-       } /* action dscp ls */
-
-       printf(CMD_MSG_FAIL, "action");
-}
-
-static cmdline_parse_token_string_t cmd_action_p_string =
-       TOKEN_STRING_INITIALIZER(struct cmd_action_result, p_string, "p");
-
-static cmdline_parse_token_num_t cmd_action_pipeline_id =
-       TOKEN_NUM_INITIALIZER(struct cmd_action_result, pipeline_id, UINT32);
-
-static cmdline_parse_token_string_t cmd_action_action_string =
-       TOKEN_STRING_INITIALIZER(struct cmd_action_result, action_string, "action");
-
-static cmdline_parse_token_string_t cmd_action_multi_string =
-       TOKEN_STRING_INITIALIZER(struct cmd_action_result, multi_string,
-       TOKEN_STRING_MULTI);
-
-cmdline_parse_inst_t cmd_action = {
-       .f = cmd_action_parsed,
-       .data = NULL,
-       .help_str = "flow actions (meter, policer, policer stats, dscp table)",
-       .tokens = {
-               (void *) &cmd_action_p_string,
-               (void *) &cmd_action_pipeline_id,
-               (void *) &cmd_action_action_string,
-               (void *) &cmd_action_multi_string,
-               NULL,
-       },
-};
-
-static cmdline_parse_ctx_t pipeline_cmds[] = {
-       (cmdline_parse_inst_t *) &cmd_action,
-       NULL,
-};
-
-static struct pipeline_fe_ops pipeline_flow_actions_fe_ops = {
-       .f_init = app_pipeline_fa_init,
-       .f_post_init = NULL,
-       .f_free = app_pipeline_fa_free,
-       .f_track = app_pipeline_track_default,
-       .cmds = pipeline_cmds,
-};
-
-struct pipeline_type pipeline_flow_actions = {
-       .name = "FLOW_ACTIONS",
-       .be_ops = &pipeline_flow_actions_be_ops,
-       .fe_ops = &pipeline_flow_actions_fe_ops,
-};
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_actions.h b/examples/ip_pipeline/pipeline/pipeline_flow_actions.h
deleted file mode 100644 (file)
index 885923e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#ifndef __INCLUDE_PIPELINE_FLOW_ACTIONS_H__
-#define __INCLUDE_PIPELINE_FLOW_ACTIONS_H__
-
-#include <rte_meter.h>
-
-#include "pipeline.h"
-#include "pipeline_flow_actions_be.h"
-
-int
-app_pipeline_fa_flow_config(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t flow_id,
-       uint32_t meter_update_mask,
-       uint32_t policer_update_mask,
-       uint32_t port_update,
-       struct pipeline_fa_flow_params *params);
-
-int
-app_pipeline_fa_flow_config_bulk(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t *flow_id,
-       uint32_t n_flows,
-       uint32_t meter_update_mask,
-       uint32_t policer_update_mask,
-       uint32_t port_update,
-       struct pipeline_fa_flow_params *params);
-
-int
-app_pipeline_fa_dscp_config(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t dscp,
-       uint32_t traffic_class,
-       enum rte_meter_color color);
-
-int
-app_pipeline_fa_flow_policer_stats_read(struct app_params *app,
-       uint32_t pipeline_id,
-       uint32_t flow_id,
-       uint32_t policer_id,
-       int clear,
-       struct pipeline_fa_policer_stats *stats);
-
-#ifndef APP_PIPELINE_FA_MAX_RECORDS_IN_FILE
-#define APP_PIPELINE_FA_MAX_RECORDS_IN_FILE            65536
-#endif
-
-int
-app_pipeline_fa_load_file(char *filename,
-       uint32_t *flow_ids,
-       struct pipeline_fa_flow_params *p,
-       uint32_t *n_flows,
-       uint32_t *line);
-
-extern struct pipeline_type pipeline_flow_actions;
-
-#endif
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c
deleted file mode 100644 (file)
index 33f1c41..0000000
+++ /dev/null
@@ -1,983 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-
-#include <string.h>
-
-#include <rte_common.h>
-#include <rte_malloc.h>
-#include <rte_cycles.h>
-#include <rte_table_array.h>
-#include <rte_byteorder.h>
-#include <rte_ip.h>
-
-#include "pipeline_actions_common.h"
-#include "pipeline_flow_actions_be.h"
-#include "parser.h"
-#include "hash_func.h"
-
-int
-pipeline_fa_flow_params_set_default(struct pipeline_fa_flow_params *params)
-{
-       uint32_t i;
-
-       if (params == NULL)
-               return -1;
-
-       for (i = 0; i < PIPELINE_FA_N_TC_MAX; i++) {
-               struct rte_meter_trtcm_params *m = &params->m[i];
-
-               m->cir = 1;
-               m->cbs = 1;
-               m->pir = 1;
-               m->pbs = 2;
-       }
-
-       for (i = 0; i < PIPELINE_FA_N_TC_MAX; i++) {
-               struct pipeline_fa_policer_params *p = &params->p[i];
-               uint32_t j;
-
-               for (j = 0; j < e_RTE_METER_COLORS; j++) {
-                       struct pipeline_fa_policer_action *a = &p->action[j];
-
-                       a->drop = 0;
-                       a->color = (enum rte_meter_color) j;
-               }
-       }
-
-       params->port_id = 0;
-
-       return 0;
-}
-
-struct dscp_entry {
-       uint32_t traffic_class;
-       enum rte_meter_color color;
-};
-
-struct pipeline_flow_actions {
-       struct pipeline p;
-       struct pipeline_fa_params params;
-       pipeline_msg_req_handler custom_handlers[PIPELINE_FA_MSG_REQS];
-
-       struct dscp_entry dscp[PIPELINE_FA_N_DSCP];
-} __rte_cache_aligned;
-
-static void *
-pipeline_fa_msg_req_custom_handler(struct pipeline *p, void *msg);
-
-static pipeline_msg_req_handler handlers[] = {
-       [PIPELINE_MSG_REQ_PING] =
-               pipeline_msg_req_ping_handler,
-       [PIPELINE_MSG_REQ_STATS_PORT_IN] =
-               pipeline_msg_req_stats_port_in_handler,
-       [PIPELINE_MSG_REQ_STATS_PORT_OUT] =
-               pipeline_msg_req_stats_port_out_handler,
-       [PIPELINE_MSG_REQ_STATS_TABLE] =
-               pipeline_msg_req_stats_table_handler,
-       [PIPELINE_MSG_REQ_PORT_IN_ENABLE] =
-               pipeline_msg_req_port_in_enable_handler,
-       [PIPELINE_MSG_REQ_PORT_IN_DISABLE] =
-               pipeline_msg_req_port_in_disable_handler,
-       [PIPELINE_MSG_REQ_CUSTOM] =
-               pipeline_fa_msg_req_custom_handler,
-};
-
-static void *
-pipeline_fa_msg_req_flow_config_handler(struct pipeline *p, void *msg);
-
-static void *
-pipeline_fa_msg_req_flow_config_bulk_handler(struct pipeline *p, void *msg);
-
-static void *
-pipeline_fa_msg_req_dscp_config_handler(struct pipeline *p, void *msg);
-
-static void *
-pipeline_fa_msg_req_policer_stats_read_handler(struct pipeline *p, void *msg);
-
-static pipeline_msg_req_handler custom_handlers[] = {
-       [PIPELINE_FA_MSG_REQ_FLOW_CONFIG] =
-               pipeline_fa_msg_req_flow_config_handler,
-       [PIPELINE_FA_MSG_REQ_FLOW_CONFIG_BULK] =
-               pipeline_fa_msg_req_flow_config_bulk_handler,
-       [PIPELINE_FA_MSG_REQ_DSCP_CONFIG] =
-               pipeline_fa_msg_req_dscp_config_handler,
-       [PIPELINE_FA_MSG_REQ_POLICER_STATS_READ] =
-               pipeline_fa_msg_req_policer_stats_read_handler,
-};
-
-/*
- * Flow table
- */
-struct meter_policer {
-       struct rte_meter_trtcm meter;
-       struct rte_meter_trtcm_profile meter_profile;
-       struct pipeline_fa_policer_params policer;
-       struct pipeline_fa_policer_stats stats;
-};
-
-struct flow_table_entry {
-       struct rte_pipeline_table_entry head;
-       struct meter_policer mp[PIPELINE_FA_N_TC_MAX];
-};
-
-static int
-flow_table_entry_set_meter(struct flow_table_entry *entry,
-       uint32_t meter_id,
-       struct pipeline_fa_flow_params *params)
-{
-       struct rte_meter_trtcm *meter = &entry->mp[meter_id].meter;
-       struct rte_meter_trtcm_params *meter_params = &params->m[meter_id];
-       struct rte_meter_trtcm_profile *meter_profile =
-                                       &entry->mp[meter_id].meter_profile;
-       int status;
-
-       status = rte_meter_trtcm_profile_config(meter_profile, meter_params);
-       if (status)
-               return status;
-
-       return rte_meter_trtcm_config(meter, meter_profile);
-}
-
-static void
-flow_table_entry_set_policer(struct flow_table_entry *entry,
-       uint32_t policer_id,
-       struct pipeline_fa_flow_params *params)
-{
-       struct pipeline_fa_policer_params *p0 = &entry->mp[policer_id].policer;
-       struct pipeline_fa_policer_params *p1 = &params->p[policer_id];
-
-       memcpy(p0, p1, sizeof(*p0));
-}
-
-static void
-flow_table_entry_set_port_id(struct pipeline_flow_actions *p,
-       struct flow_table_entry *entry,
-       struct pipeline_fa_flow_params *params)
-{
-       entry->head.action = RTE_PIPELINE_ACTION_PORT;
-       entry->head.port_id = p->p.port_out_id[params->port_id];
-}
-
-static int
-flow_table_entry_set_default(struct pipeline_flow_actions *p,
-       struct flow_table_entry *entry)
-{
-       struct pipeline_fa_flow_params params;
-       uint32_t i;
-
-       pipeline_fa_flow_params_set_default(&params);
-
-       memset(entry, 0, sizeof(*entry));
-
-       flow_table_entry_set_port_id(p, entry, &params);
-
-       for (i = 0; i < PIPELINE_FA_N_TC_MAX; i++) {
-               int status;
-
-               status = flow_table_entry_set_meter(entry, i, &params);
-               if (status)
-                       return status;
-       }
-
-       for (i = 0; i < PIPELINE_FA_N_TC_MAX; i++)
-               flow_table_entry_set_policer(entry, i, &params);
-
-       return 0;
-}
-
-static inline uint64_t
-pkt_work(
-       struct rte_mbuf *pkt,
-       struct rte_pipeline_table_entry *table_entry,
-       void *arg,
-       uint64_t time)
-{
-       struct pipeline_flow_actions *p = arg;
-       struct flow_table_entry *entry =
-               (struct flow_table_entry *) table_entry;
-
-       struct ipv4_hdr *pkt_ip = (struct ipv4_hdr *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkt, p->params.ip_hdr_offset);
-       enum rte_meter_color *pkt_color = (enum rte_meter_color *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkt, p->params.color_offset);
-
-       /* Read (IP header) */
-       uint32_t total_length = rte_bswap16(pkt_ip->total_length);
-       uint32_t dscp = pkt_ip->type_of_service >> 2;
-
-       uint32_t tc = p->dscp[dscp].traffic_class;
-       enum rte_meter_color color = p->dscp[dscp].color;
-
-       struct rte_meter_trtcm *meter = &entry->mp[tc].meter;
-       struct rte_meter_trtcm_profile *meter_profile =
-                                       &entry->mp[tc].meter_profile;
-       struct pipeline_fa_policer_params *policer = &entry->mp[tc].policer;
-       struct pipeline_fa_policer_stats *stats = &entry->mp[tc].stats;
-
-       /* Read (entry), compute */
-       enum rte_meter_color color2 = rte_meter_trtcm_color_aware_check(meter,
-               meter_profile,
-               time,
-               total_length,
-               color);
-
-       enum rte_meter_color color3 = policer->action[color2].color;
-       uint64_t drop = policer->action[color2].drop;
-
-       /* Read (entry), write (entry, color) */
-       stats->n_pkts[color3] += drop ^ 1LLU;
-       stats->n_pkts_drop += drop;
-       *pkt_color = color3;
-
-       return drop;
-}
-
-static inline uint64_t
-pkt4_work(
-       struct rte_mbuf **pkts,
-       struct rte_pipeline_table_entry **table_entries,
-       void *arg,
-       uint64_t time)
-{
-       struct pipeline_flow_actions *p = arg;
-
-       struct flow_table_entry *entry0 =
-               (struct flow_table_entry *) table_entries[0];
-       struct flow_table_entry *entry1 =
-               (struct flow_table_entry *) table_entries[1];
-       struct flow_table_entry *entry2 =
-               (struct flow_table_entry *) table_entries[2];
-       struct flow_table_entry *entry3 =
-               (struct flow_table_entry *) table_entries[3];
-
-       struct ipv4_hdr *pkt0_ip = (struct ipv4_hdr *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[0], p->params.ip_hdr_offset);
-       struct ipv4_hdr *pkt1_ip = (struct ipv4_hdr *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[1], p->params.ip_hdr_offset);
-       struct ipv4_hdr *pkt2_ip = (struct ipv4_hdr *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[2], p->params.ip_hdr_offset);
-       struct ipv4_hdr *pkt3_ip = (struct ipv4_hdr *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[3], p->params.ip_hdr_offset);
-
-       enum rte_meter_color *pkt0_color = (enum rte_meter_color *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[0], p->params.color_offset);
-       enum rte_meter_color *pkt1_color = (enum rte_meter_color *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[1], p->params.color_offset);
-       enum rte_meter_color *pkt2_color = (enum rte_meter_color *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[2], p->params.color_offset);
-       enum rte_meter_color *pkt3_color = (enum rte_meter_color *)
-               RTE_MBUF_METADATA_UINT32_PTR(pkts[3], p->params.color_offset);
-
-       /* Read (IP header) */
-       uint32_t total_length0 = rte_bswap16(pkt0_ip->total_length);
-       uint32_t dscp0 = pkt0_ip->type_of_service >> 2;
-
-       uint32_t total_length1 = rte_bswap16(pkt1_ip->total_length);
-       uint32_t dscp1 = pkt1_ip->type_of_service >> 2;
-
-       uint32_t total_length2 = rte_bswap16(pkt2_ip->total_length);
-       uint32_t dscp2 = pkt2_ip->type_of_service >> 2;
-
-       uint32_t total_length3 = rte_bswap16(pkt3_ip->total_length);
-       uint32_t dscp3 = pkt3_ip->type_of_service >> 2;
-
-       uint32_t tc0 = p->dscp[dscp0].traffic_class;
-       enum rte_meter_color color0 = p->dscp[dscp0].color;
-
-       uint32_t tc1 = p->dscp[dscp1].traffic_class;
-       enum rte_meter_color color1 = p->dscp[dscp1].color;
-
-       uint32_t tc2 = p->dscp[dscp2].traffic_class;
-       enum rte_meter_color color2 = p->dscp[dscp2].color;
-
-       uint32_t tc3 = p->dscp[dscp3].traffic_class;
-       enum rte_meter_color color3 = p->dscp[dscp3].color;
-
-       struct rte_meter_trtcm *meter0 = &entry0->mp[tc0].meter;
-       struct rte_meter_trtcm_profile *meter0_profile =
-                               &entry0->mp[tc0].meter_profile;
-       struct pipeline_fa_policer_params *policer0 = &entry0->mp[tc0].policer;
-       struct pipeline_fa_policer_stats *stats0 = &entry0->mp[tc0].stats;
-
-       struct rte_meter_trtcm *meter1 = &entry1->mp[tc1].meter;
-       struct rte_meter_trtcm_profile *meter1_profile =
-                               &entry1->mp[tc1].meter_profile;
-       struct pipeline_fa_policer_params *policer1 = &entry1->mp[tc1].policer;
-       struct pipeline_fa_policer_stats *stats1 = &entry1->mp[tc1].stats;
-
-       struct rte_meter_trtcm *meter2 = &entry2->mp[tc2].meter;
-       struct rte_meter_trtcm_profile *meter2_profile =
-                               &entry2->mp[tc2].meter_profile;
-       struct pipeline_fa_policer_params *policer2 = &entry2->mp[tc2].policer;
-       struct pipeline_fa_policer_stats *stats2 = &entry2->mp[tc2].stats;
-
-       struct rte_meter_trtcm *meter3 = &entry3->mp[tc3].meter;
-       struct rte_meter_trtcm_profile *meter3_profile =
-                               &entry3->mp[tc3].meter_profile;
-       struct pipeline_fa_policer_params *policer3 = &entry3->mp[tc3].policer;
-       struct pipeline_fa_policer_stats *stats3 = &entry3->mp[tc3].stats;
-
-       /* Read (entry), compute, write (entry) */
-       enum rte_meter_color color2_0 = rte_meter_trtcm_color_aware_check(
-               meter0,
-               meter0_profile,
-               time,
-               total_length0,
-               color0);
-
-       enum rte_meter_color color2_1 = rte_meter_trtcm_color_aware_check(
-               meter1,
-               meter1_profile,
-               time,
-               total_length1,
-               color1);
-
-       enum rte_meter_color color2_2 = rte_meter_trtcm_color_aware_check(
-               meter2,
-               meter2_profile,
-               time,
-               total_length2,
-               color2);
-
-       enum rte_meter_color color2_3 = rte_meter_trtcm_color_aware_check(
-               meter3,
-               meter3_profile,
-               time,
-               total_length3,
-               color3);
-
-       enum rte_meter_color color3_0 = policer0->action[color2_0].color;
-       enum rte_meter_color color3_1 = policer1->action[color2_1].color;
-       enum rte_meter_color color3_2 = policer2->action[color2_2].color;
-       enum rte_meter_color color3_3 = policer3->action[color2_3].color;
-
-       uint64_t drop0 = policer0->action[color2_0].drop;
-       uint64_t drop1 = policer1->action[color2_1].drop;
-       uint64_t drop2 = policer2->action[color2_2].drop;
-       uint64_t drop3 = policer3->action[color2_3].drop;
-
-       /* Read (entry), write (entry, color) */
-       stats0->n_pkts[color3_0] += drop0 ^ 1LLU;
-       stats0->n_pkts_drop += drop0;
-
-       stats1->n_pkts[color3_1] += drop1 ^ 1LLU;
-       stats1->n_pkts_drop += drop1;
-
-       stats2->n_pkts[color3_2] += drop2 ^ 1LLU;
-       stats2->n_pkts_drop += drop2;
-
-       stats3->n_pkts[color3_3] += drop3 ^ 1LLU;
-       stats3->n_pkts_drop += drop3;
-
-       *pkt0_color = color3_0;
-       *pkt1_color = color3_1;
-       *pkt2_color = color3_2;
-       *pkt3_color = color3_3;
-
-       return drop0 | (drop1 << 1) | (drop2 << 2) | (drop3 << 3);
-}
-
-PIPELINE_TABLE_AH_HIT_DROP_TIME(fa_table_ah_hit, pkt_work, pkt4_work);
-
-static rte_pipeline_table_action_handler_hit
-get_fa_table_ah_hit(__rte_unused struct pipeline_flow_actions *p)
-{
-       return fa_table_ah_hit;
-}
-
-/*
- * Argument parsing
- */
-int
-pipeline_fa_parse_args(struct pipeline_fa_params *p,
-       struct pipeline_params *params)
-{
-       uint32_t n_flows_present = 0;
-       uint32_t n_meters_per_flow_present = 0;
-       uint32_t flow_id_offset_present = 0;
-       uint32_t ip_hdr_offset_present = 0;
-       uint32_t color_offset_present = 0;
-       uint32_t i;
-
-       /* Default values */
-       p->n_meters_per_flow = 1;
-       p->dscp_enabled = 0;
-
-       for (i = 0; i < params->n_args; i++) {
-               char *arg_name = params->args_name[i];
-               char *arg_value = params->args_value[i];
-
-               /* n_flows */
-               if (strcmp(arg_name, "n_flows") == 0) {
-                       int status;
-
-                       PIPELINE_PARSE_ERR_DUPLICATE(
-                               n_flows_present == 0, params->name,
-                               arg_name);
-                       n_flows_present = 1;
-
-                       status = parser_read_uint32(&p->n_flows,
-                               arg_value);
-                       PIPELINE_PARSE_ERR_INV_VAL(((status != -EINVAL) &&
-                               (p->n_flows != 0)), params->name,
-                               arg_name, arg_value);
-                       PIPELINE_PARSE_ERR_OUT_RNG((status != -ERANGE),
-                               params->name, arg_name, arg_value);
-
-                       continue;
-               }
-
-               /* n_meters_per_flow */
-               if (strcmp(arg_name, "n_meters_per_flow") == 0) {
-                       int status;
-
-                       PIPELINE_PARSE_ERR_DUPLICATE(
-                               n_meters_per_flow_present == 0,
-                               params->name, arg_name);
-                       n_meters_per_flow_present = 1;
-
-                       status = parser_read_uint32(&p->n_meters_per_flow,
-                               arg_value);
-                       PIPELINE_PARSE_ERR_INV_VAL(((status != -EINVAL) &&
-                               (p->n_meters_per_flow != 0)),
-                               params->name, arg_name, arg_value);
-                       PIPELINE_PARSE_ERR_OUT_RNG(((status != -ERANGE) &&
-                               (p->n_meters_per_flow <=
-                               PIPELINE_FA_N_TC_MAX)), params->name,
-                               arg_name, arg_value);
-
-                       continue;
-               }
-
-               /* flow_id_offset */
-               if (strcmp(arg_name, "flow_id_offset") == 0) {
-                       int status;
-
-                       PIPELINE_PARSE_ERR_DUPLICATE(
-                               flow_id_offset_present == 0,
-                               params->name, arg_name);
-                       flow_id_offset_present = 1;
-
-                       status = parser_read_uint32(&p->flow_id_offset,
-                               arg_value);
-                       PIPELINE_PARSE_ERR_INV_VAL((status != -EINVAL),
-                               params->name, arg_name, arg_value);
-                       PIPELINE_PARSE_ERR_OUT_RNG((status != -ERANGE),
-                               params->name, arg_name, arg_value);
-
-                       continue;
-               }
-
-               /* ip_hdr_offset */
-               if (strcmp(arg_name, "ip_hdr_offset") == 0) {
-                       int status;
-
-                       PIPELINE_PARSE_ERR_DUPLICATE(
-                               ip_hdr_offset_present == 0,
-                               params->name, arg_name);
-                       ip_hdr_offset_present = 1;
-
-                       status = parser_read_uint32(&p->ip_hdr_offset,
-                               arg_value);
-                       PIPELINE_PARSE_ERR_INV_VAL((status != -EINVAL),
-                               params->name, arg_name, arg_value);
-                       PIPELINE_PARSE_ERR_OUT_RNG((status != -ERANGE),
-                               params->name, arg_name, arg_value);
-
-                       continue;
-               }
-
-               /* color_offset */
-               if (strcmp(arg_name, "color_offset") == 0) {
-                       int status;
-
-                       PIPELINE_PARSE_ERR_DUPLICATE(
-                               color_offset_present == 0, params->name,
-                               arg_name);
-                       color_offset_present = 1;
-
-                       status = parser_read_uint32(&p->color_offset,
-                               arg_value);
-                       PIPELINE_PARSE_ERR_INV_VAL((status != -EINVAL),
-                               params->name, arg_name, arg_value);
-                       PIPELINE_PARSE_ERR_OUT_RNG((status != -ERANGE),
-                               params->name, arg_name, arg_value);
-
-                       p->dscp_enabled = 1;
-
-                       continue;
-               }
-
-               /* Unknown argument */
-               PIPELINE_PARSE_ERR_INV_ENT(0, params->name, arg_name);
-       }
-
-       /* Check that mandatory arguments are present */
-       PIPELINE_PARSE_ERR_MANDATORY((n_flows_present), params->name,
-               "n_flows");
-       PIPELINE_PARSE_ERR_MANDATORY((flow_id_offset_present),
-               params->name, "flow_id_offset");
-       PIPELINE_PARSE_ERR_MANDATORY((ip_hdr_offset_present),
-               params->name, "ip_hdr_offset");
-       PIPELINE_PARSE_ERR_MANDATORY((color_offset_present), params->name,
-               "color_offset");
-
-       return 0;
-}
-
-static void
-dscp_init(struct pipeline_flow_actions *p)
-{
-       uint32_t i;
-
-       for (i = 0; i < PIPELINE_FA_N_DSCP; i++) {
-               p->dscp[i].traffic_class = 0;
-               p->dscp[i].color = e_RTE_METER_GREEN;
-       }
-}
-
-static void *pipeline_fa_init(struct pipeline_params *params,
-       __rte_unused void *arg)
-{
-       struct pipeline *p;
-       struct pipeline_flow_actions *p_fa;
-       uint32_t size, i;
-
-       /* Check input arguments */
-       if (params == NULL)
-               return NULL;
-
-       if (params->n_ports_in != params->n_ports_out)
-               return NULL;
-
-       /* Memory allocation */
-       size = RTE_CACHE_LINE_ROUNDUP(
-               sizeof(struct pipeline_flow_actions));
-       p = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
-       if (p == NULL)
-               return NULL;
-       p_fa = (struct pipeline_flow_actions *) p;
-
-       strcpy(p->name, params->name);
-       p->log_level = params->log_level;
-
-       PLOG(p, HIGH, "Flow actions");
-
-       /* Parse arguments */
-       if (pipeline_fa_parse_args(&p_fa->params, params))
-               return NULL;
-
-       dscp_init(p_fa);
-
-       /* Pipeline */
-       {
-               struct rte_pipeline_params pipeline_params = {
-                       .name = params->name,
-                       .socket_id = params->socket_id,
-                       .offset_port_id = 0,
-               };
-
-               p->p = rte_pipeline_create(&pipeline_params);
-               if (p->p == NULL) {
-                       rte_free(p);
-                       return NULL;
-               }
-       }
-
-       /* Input ports */
-       p->n_ports_in = params->n_ports_in;
-       for (i = 0; i < p->n_ports_in; i++) {
-               struct rte_pipeline_port_in_params port_params = {
-                       .ops = pipeline_port_in_params_get_ops(
-                               &params->port_in[i]),
-                       .arg_create = pipeline_port_in_params_convert(
-                               &params->port_in[i]),
-                       .f_action = NULL,
-                       .arg_ah = NULL,
-                       .burst_size = params->port_in[i].burst_size,
-               };
-
-               int status = rte_pipeline_port_in_create(p->p,
-                       &port_params,
-                       &p->port_in_id[i]);
-
-               if (status) {
-                       rte_pipeline_free(p->p);
-                       rte_free(p);
-                       return NULL;
-               }
-       }
-
-       /* Output ports */
-       p->n_ports_out = params->n_ports_out;
-       for (i = 0; i < p->n_ports_out; i++) {
-               struct rte_pipeline_port_out_params port_params = {
-                       .ops = pipeline_port_out_params_get_ops(
-                               &params->port_out[i]),
-                       .arg_create = pipeline_port_out_params_convert(
-                               &params->port_out[i]),
-                       .f_action = NULL,
-                       .arg_ah = NULL,
-               };
-
-               int status = rte_pipeline_port_out_create(p->p,
-                       &port_params,
-                       &p->port_out_id[i]);
-
-               if (status) {
-                       rte_pipeline_free(p->p);
-                       rte_free(p);
-                       return NULL;
-               }
-       }
-
-       /* Tables */
-       p->n_tables = 1;
-       {
-               struct rte_table_array_params table_array_params = {
-                       .n_entries = p_fa->params.n_flows,
-                       .offset = p_fa->params.flow_id_offset,
-               };
-
-               struct rte_pipeline_table_params table_params = {
-                       .ops = &rte_table_array_ops,
-                       .arg_create = &table_array_params,
-                       .f_action_hit = get_fa_table_ah_hit(p_fa),
-                       .f_action_miss = NULL,
-                       .arg_ah = p_fa,
-                       .action_data_size =
-                               sizeof(struct flow_table_entry) -
-                               sizeof(struct rte_pipeline_table_entry),
-               };
-
-               int status;
-
-               status = rte_pipeline_table_create(p->p,
-                       &table_params,
-                       &p->table_id[0]);
-
-               if (status) {
-                       rte_pipeline_free(p->p);
-                       rte_free(p);
-                       return NULL;
-               }
-       }
-
-       /* Connecting input ports to tables */
-       for (i = 0; i < p->n_ports_in; i++) {
-               int status = rte_pipeline_port_in_connect_to_table(p->p,
-                       p->port_in_id[i],
-                       p->table_id[0]);
-
-               if (status) {
-                       rte_pipeline_free(p->p);
-                       rte_free(p);
-                       return NULL;
-               }
-       }
-
-       /* Enable input ports */
-       for (i = 0; i < p->n_ports_in; i++) {
-               int status = rte_pipeline_port_in_enable(p->p,
-                       p->port_in_id[i]);
-
-               if (status) {
-                       rte_pipeline_free(p->p);
-                       rte_free(p);
-                       return NULL;
-               }
-       }
-
-       /* Initialize table entries */
-       for (i = 0; i < p_fa->params.n_flows; i++) {
-               struct rte_table_array_key key = {
-                       .pos = i,
-               };
-
-               struct flow_table_entry entry;
-               struct rte_pipeline_table_entry *entry_ptr;
-               int key_found, status;
-
-               flow_table_entry_set_default(p_fa, &entry);
-
-               status = rte_pipeline_table_entry_add(p->p,
-                       p->table_id[0],
-                       &key,
-                       (struct rte_pipeline_table_entry *) &entry,
-                       &key_found,
-                       &entry_ptr);
-
-               if (status) {
-                       rte_pipeline_free(p->p);
-                       rte_free(p);
-                       return NULL;
-               }
-       }
-
-       /* Check pipeline consistency */
-       if (rte_pipeline_check(p->p) < 0) {
-               rte_pipeline_free(p->p);
-               rte_free(p);
-               return NULL;
-       }
-
-       /* Message queues */
-       p->n_msgq = params->n_msgq;
-       for (i = 0; i < p->n_msgq; i++)
-               p->msgq_in[i] = params->msgq_in[i];
-       for (i = 0; i < p->n_msgq; i++)
-               p->msgq_out[i] = params->msgq_out[i];
-
-       /* Message handlers */
-       memcpy(p->handlers, handlers, sizeof(p->handlers));
-       memcpy(p_fa->custom_handlers,
-               custom_handlers,
-               sizeof(p_fa->custom_handlers));
-
-       return p;
-}
-
-static int
-pipeline_fa_free(void *pipeline)
-{
-       struct pipeline *p = (struct pipeline *) pipeline;
-
-       /* Check input arguments */
-       if (p == NULL)
-               return -1;
-
-       /* Free resources */
-       rte_pipeline_free(p->p);
-       rte_free(p);
-       return 0;
-}
-
-static int
-pipeline_fa_timer(void *pipeline)
-{
-       struct pipeline *p = (struct pipeline *) pipeline;
-
-       pipeline_msg_req_handle(p);
-       rte_pipeline_flush(p->p);
-
-       return 0;
-}
-
-void *
-pipeline_fa_msg_req_custom_handler(struct pipeline *p, void *msg)
-{
-       struct pipeline_flow_actions *p_fa =
-                       (struct pipeline_flow_actions *) p;
-       struct pipeline_custom_msg_req *req = msg;
-       pipeline_msg_req_handler f_handle;
-
-       f_handle = (req->subtype < PIPELINE_FA_MSG_REQS) ?
-               p_fa->custom_handlers[req->subtype] :
-               pipeline_msg_req_invalid_handler;
-
-       if (f_handle == NULL)
-               f_handle = pipeline_msg_req_invalid_handler;
-
-       return f_handle(p, req);
-}
-
-void *
-pipeline_fa_msg_req_flow_config_handler(struct pipeline *p, void *msg)
-{
-       struct pipeline_flow_actions *p_fa = (struct pipeline_flow_actions *) p;
-       struct pipeline_fa_flow_config_msg_req *req = msg;
-       struct pipeline_fa_flow_config_msg_rsp *rsp = msg;
-       struct flow_table_entry *entry;
-       uint32_t mask, i;
-
-       /* Set flow table entry to default if not configured before */
-       if (req->entry_ptr == NULL) {
-               struct rte_table_array_key key = {
-                       .pos = req->flow_id % p_fa->params.n_flows,
-               };
-
-               struct flow_table_entry default_entry;
-
-               int key_found, status;
-
-               flow_table_entry_set_default(p_fa, &default_entry);
-
-               status = rte_pipeline_table_entry_add(p->p,
-                       p->table_id[0],
-                       &key,
-                       (struct rte_pipeline_table_entry *) &default_entry,
-                       &key_found,
-                       (struct rte_pipeline_table_entry **) &entry);
-               if (status) {
-                       rsp->status = -1;
-                       return rsp;
-               }
-       } else
-               entry = (struct flow_table_entry *) req->entry_ptr;
-
-       /* Meter */
-       for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
-               int status;
-
-               if ((mask & req->meter_update_mask) == 0)
-                       continue;
-
-               status = flow_table_entry_set_meter(entry, i, &req->params);
-               if (status) {
-                       rsp->status = -1;
-                       return rsp;
-               }
-       }
-
-       /* Policer */
-       for (i = 0, mask = 1; i < PIPELINE_FA_N_TC_MAX; i++, mask <<= 1) {
-               if ((mask & req->policer_update_mask) == 0)
-                       continue;
-
-               flow_table_entry_set_policer(entry, i, &req->params);
-       }
-
-       /* Port */
-       if (req->port_update)
-               flow_table_entry_set_port_id(p_fa, entry, &req->params);
-
-       /* Response */
-       rsp->status = 0;
-       rsp->entry_ptr = (void *) entry;
-       return rsp;
-}
-
-void *
-pipeline_fa_msg_req_flow_config_bulk_handler(struct pipeline *p, void *msg)
-{
-       struct pipeline_flow_actions *p_fa = (struct pipeline_flow_actions *) p;
-       struct pipeline_fa_flow_config_bulk_msg_req *req = msg;
-       struct pipeline_fa_flow_config_bulk_msg_rsp *rsp = msg;
-       uint32_t i;
-
-       for (i = 0; i < req->n_flows; i++) {
-               struct flow_table_entry *entry;
-               uint32_t j, mask;
-
-               /* Set flow table entry to default if not configured before */
-               if (req->entry_ptr[i] == NULL) {
-                       struct rte_table_array_key key = {
-                               .pos = req->flow_id[i] % p_fa->params.n_flows,
-                       };
-
-                       struct flow_table_entry entry_to_add;
-
-                       int key_found, status;
-
-                       flow_table_entry_set_default(p_fa, &entry_to_add);
-
-                       status = rte_pipeline_table_entry_add(p->p,
-                        p->table_id[0],
-                        &key,
-                        (struct rte_pipeline_table_entry *) &entry_to_add,
-                        &key_found,
-                        (struct rte_pipeline_table_entry **) &entry);
-                       if (status) {
-                               rsp->n_flows = i;
-                               return rsp;
-                       }
-
-                       req->entry_ptr[i] = (void *) entry;
-               } else
-                       entry = (struct flow_table_entry *) req->entry_ptr[i];
-
-               /* Meter */
-               for (j = 0, mask = 1;
-                       j < PIPELINE_FA_N_TC_MAX;
-                       j++, mask <<= 1) {
-                       int status;
-
-                       if ((mask & req->meter_update_mask) == 0)
-                               continue;
-
-                       status = flow_table_entry_set_meter(entry,
-                               j, &req->params[i]);
-                       if (status) {
-                               rsp->n_flows = i;
-                               return rsp;
-                       }
-               }
-
-               /* Policer */
-               for (j = 0, mask = 1;
-                       j < PIPELINE_FA_N_TC_MAX;
-                       j++, mask <<= 1) {
-                       if ((mask & req->policer_update_mask) == 0)
-                               continue;
-
-                       flow_table_entry_set_policer(entry,
-                        j, &req->params[i]);
-               }
-
-               /* Port */
-               if (req->port_update)
-                       flow_table_entry_set_port_id(p_fa,
-                        entry, &req->params[i]);
-       }
-
-       /* Response */
-       rsp->n_flows = i;
-       return rsp;
-}
-
-void *
-pipeline_fa_msg_req_dscp_config_handler(struct pipeline *p, void *msg)
-{
-       struct pipeline_flow_actions *p_fa = (struct pipeline_flow_actions *) p;
-       struct pipeline_fa_dscp_config_msg_req *req = msg;
-       struct pipeline_fa_dscp_config_msg_rsp *rsp = msg;
-
-       /* Check request */
-       if ((req->dscp >= PIPELINE_FA_N_DSCP) ||
-               (req->traffic_class >= PIPELINE_FA_N_TC_MAX) ||
-               (req->color >= e_RTE_METER_COLORS)) {
-               rsp->status = -1;
-               return rsp;
-       }
-
-       p_fa->dscp[req->dscp].traffic_class = req->traffic_class;
-       p_fa->dscp[req->dscp].color = req->color;
-       rsp->status = 0;
-       return rsp;
-}
-
-void *
-pipeline_fa_msg_req_policer_stats_read_handler(__rte_unused struct pipeline *p,
-       void *msg)
-{
-       struct pipeline_fa_policer_stats_msg_req *req = msg;
-       struct pipeline_fa_policer_stats_msg_rsp *rsp = msg;
-
-       struct flow_table_entry *entry = req->entry_ptr;
-       uint32_t policer_id = req->policer_id;
-       int clear = req->clear;
-
-       /* Check request */
-       if ((req->entry_ptr == NULL) ||
-               (req->policer_id >= PIPELINE_FA_N_TC_MAX)) {
-               rsp->status = -1;
-               return rsp;
-       }
-
-       memcpy(&rsp->stats,
-               &entry->mp[policer_id].stats,
-               sizeof(rsp->stats));
-       if (clear)
-               memset(&entry->mp[policer_id].stats,
-                       0, sizeof(entry->mp[policer_id].stats));
-       rsp->status = 0;
-       return rsp;
-}
-
-struct pipeline_be_ops pipeline_flow_actions_be_ops = {
-       .f_init = pipeline_fa_init,
-       .f_free = pipeline_fa_free,
-       .f_run = NULL,
-       .f_timer = pipeline_fa_timer,
-};
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h b/examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
deleted file mode 100644 (file)
index ef6cb26..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2015 Intel Corporation
- */
-
-#ifndef __INCLUDE_PIPELINE_FLOW_ACTIONS_BE_H__
-#define __INCLUDE_PIPELINE_FLOW_ACTIONS_BE_H__
-
-#include <rte_meter.h>
-
-#include "pipeline_common_be.h"
-
-#ifndef PIPELINE_FA_N_TC_MAX
-#define PIPELINE_FA_N_TC_MAX                               4
-#endif
-
-#define PIPELINE_FA_N_DSCP                                 64
-
-struct pipeline_fa_params {
-       uint32_t n_flows;
-       uint32_t n_meters_per_flow;
-       uint32_t flow_id_offset;
-       uint32_t ip_hdr_offset;
-       uint32_t color_offset;
-       uint32_t dscp_enabled;
-};
-
-int
-pipeline_fa_parse_args(struct pipeline_fa_params *p,
-       struct pipeline_params *params);
-
-struct pipeline_fa_policer_action {
-       uint32_t drop;
-       enum rte_meter_color color;
-};
-
-struct pipeline_fa_policer_params {
-       struct pipeline_fa_policer_action action[e_RTE_METER_COLORS];
-};
-
-struct pipeline_fa_flow_params {
-       struct rte_meter_trtcm_params m[PIPELINE_FA_N_TC_MAX];
-       struct pipeline_fa_policer_params p[PIPELINE_FA_N_TC_MAX];
-       uint32_t port_id;
-};
-
-int
-pipeline_fa_flow_params_set_default(struct pipeline_fa_flow_params *params);
-
-struct pipeline_fa_policer_stats {
-       uint64_t n_pkts[e_RTE_METER_COLORS];
-       uint64_t n_pkts_drop;
-};
-
-enum pipeline_fa_msg_req_type {
-       PIPELINE_FA_MSG_REQ_FLOW_CONFIG = 0,
-       PIPELINE_FA_MSG_REQ_FLOW_CONFIG_BULK,
-       PIPELINE_FA_MSG_REQ_DSCP_CONFIG,
-       PIPELINE_FA_MSG_REQ_POLICER_STATS_READ,
-       PIPELINE_FA_MSG_REQS,
-};
-
-/*
- * MSG FLOW CONFIG
- */
-struct pipeline_fa_flow_config_msg_req {
-       enum pipeline_msg_req_type type;
-       enum pipeline_fa_msg_req_type subtype;
-
-       void *entry_ptr;
-       uint32_t flow_id;
-
-       uint32_t meter_update_mask;
-       uint32_t policer_update_mask;
-       uint32_t port_update;
-       struct pipeline_fa_flow_params params;
-};
-
-struct pipeline_fa_flow_config_msg_rsp {
-       int status;
-       void *entry_ptr;
-};
-
-/*
- * MSG FLOW CONFIG BULK
- */
-struct pipeline_fa_flow_config_bulk_msg_req {
-       enum pipeline_msg_req_type type;
-       enum pipeline_fa_msg_req_type subtype;
-
-       void **entry_ptr;
-       uint32_t *flow_id;
-       uint32_t n_flows;
-
-       uint32_t meter_update_mask;
-       uint32_t policer_update_mask;
-       uint32_t port_update;
-       struct pipeline_fa_flow_params *params;
-};
-
-struct pipeline_fa_flow_config_bulk_msg_rsp {
-       uint32_t n_flows;
-};
-
-/*
- * MSG DSCP CONFIG
- */
-struct pipeline_fa_dscp_config_msg_req {
-       enum pipeline_msg_req_type type;
-       enum pipeline_fa_msg_req_type subtype;
-
-       uint32_t dscp;
-       uint32_t traffic_class;
-       enum rte_meter_color color;
-};
-
-struct pipeline_fa_dscp_config_msg_rsp {
-       int status;
-};
-
-/*
- * MSG POLICER STATS READ
- */
-struct pipeline_fa_policer_stats_msg_req {
-       enum pipeline_msg_req_type type;
-       enum pipeline_fa_msg_req_type subtype;
-
-       void *entry_ptr;
-       uint32_t policer_id;
-       int clear;
-};
-
-struct pipeline_fa_policer_stats_msg_rsp {
-       int status;
-       struct pipeline_fa_policer_stats stats;
-};
-
-extern struct pipeline_be_ops pipeline_flow_actions_be_ops;
-
-#endif