doc: update qede management firmware guide
[dpdk.git] / app / test-pmd / cmdline_flow.c
index 5bda08f..934cf7e 100644 (file)
@@ -91,6 +91,8 @@ enum index {
        ITEM_PHY_PORT_INDEX,
        ITEM_PORT_ID,
        ITEM_PORT_ID_ID,
+       ITEM_MARK,
+       ITEM_MARK_ID,
        ITEM_RAW,
        ITEM_RAW_RELATIVE,
        ITEM_RAW_SEARCH,
@@ -183,6 +185,8 @@ enum index {
        ACTION_END,
        ACTION_VOID,
        ACTION_PASSTHRU,
+       ACTION_JUMP,
+       ACTION_JUMP_GROUP,
        ACTION_MARK,
        ACTION_MARK_ID,
        ACTION_FLAG,
@@ -190,6 +194,8 @@ enum index {
        ACTION_QUEUE_INDEX,
        ACTION_DROP,
        ACTION_COUNT,
+       ACTION_COUNT_SHARED,
+       ACTION_COUNT_ID,
        ACTION_RSS,
        ACTION_RSS_FUNC,
        ACTION_RSS_LEVEL,
@@ -222,6 +228,17 @@ enum index {
        ACTION_OF_DEC_NW_TTL,
        ACTION_OF_COPY_TTL_OUT,
        ACTION_OF_COPY_TTL_IN,
+       ACTION_OF_POP_VLAN,
+       ACTION_OF_PUSH_VLAN,
+       ACTION_OF_PUSH_VLAN_ETHERTYPE,
+       ACTION_OF_SET_VLAN_VID,
+       ACTION_OF_SET_VLAN_VID_VLAN_VID,
+       ACTION_OF_SET_VLAN_PCP,
+       ACTION_OF_SET_VLAN_PCP_VLAN_PCP,
+       ACTION_OF_POP_MPLS,
+       ACTION_OF_POP_MPLS_ETHERTYPE,
+       ACTION_OF_PUSH_MPLS,
+       ACTION_OF_PUSH_MPLS_ETHERTYPE,
 };
 
 /** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -405,7 +422,7 @@ struct buffer {
                } destroy; /**< Destroy arguments. */
                struct {
                        uint32_t rule;
-                       enum rte_flow_action_type action;
+                       struct rte_flow_action action;
                } query; /**< Query arguments. */
                struct {
                        uint32_t *group;
@@ -481,6 +498,7 @@ static const enum index next_item[] = {
        ITEM_VF,
        ITEM_PHY_PORT,
        ITEM_PORT_ID,
+       ITEM_MARK,
        ITEM_RAW,
        ITEM_ETH,
        ITEM_VLAN,
@@ -542,6 +560,12 @@ static const enum index item_port_id[] = {
        ZERO,
 };
 
+static const enum index item_mark[] = {
+       ITEM_MARK_ID,
+       ITEM_NEXT,
+       ZERO,
+};
+
 static const enum index item_raw[] = {
        ITEM_RAW_RELATIVE,
        ITEM_RAW_SEARCH,
@@ -727,6 +751,7 @@ static const enum index next_action[] = {
        ACTION_END,
        ACTION_VOID,
        ACTION_PASSTHRU,
+       ACTION_JUMP,
        ACTION_MARK,
        ACTION_FLAG,
        ACTION_QUEUE,
@@ -744,6 +769,12 @@ static const enum index next_action[] = {
        ACTION_OF_DEC_NW_TTL,
        ACTION_OF_COPY_TTL_OUT,
        ACTION_OF_COPY_TTL_IN,
+       ACTION_OF_POP_VLAN,
+       ACTION_OF_PUSH_VLAN,
+       ACTION_OF_SET_VLAN_VID,
+       ACTION_OF_SET_VLAN_PCP,
+       ACTION_OF_POP_MPLS,
+       ACTION_OF_PUSH_MPLS,
        ZERO,
 };
 
@@ -759,6 +790,13 @@ static const enum index action_queue[] = {
        ZERO,
 };
 
+static const enum index action_count[] = {
+       ACTION_COUNT_ID,
+       ACTION_COUNT_SHARED,
+       ACTION_NEXT,
+       ZERO,
+};
+
 static const enum index action_rss[] = {
        ACTION_RSS_FUNC,
        ACTION_RSS_LEVEL,
@@ -809,6 +847,42 @@ static const enum index action_of_set_nw_ttl[] = {
        ZERO,
 };
 
+static const enum index action_of_push_vlan[] = {
+       ACTION_OF_PUSH_VLAN_ETHERTYPE,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_of_set_vlan_vid[] = {
+       ACTION_OF_SET_VLAN_VID_VLAN_VID,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_of_set_vlan_pcp[] = {
+       ACTION_OF_SET_VLAN_PCP_VLAN_PCP,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_of_pop_mpls[] = {
+       ACTION_OF_POP_MPLS_ETHERTYPE,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_of_push_mpls[] = {
+       ACTION_OF_PUSH_MPLS_ETHERTYPE,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_jump[] = {
+       ACTION_JUMP_GROUP,
+       ACTION_NEXT,
+       ZERO,
+};
+
 static int parse_init(struct context *, const struct token *,
                      const char *, unsigned int,
                      void *, unsigned int);
@@ -1036,7 +1110,7 @@ static const struct token token_list[] = {
                .next = NEXT(NEXT_ENTRY(QUERY_ACTION),
                             NEXT_ENTRY(RULE_ID),
                             NEXT_ENTRY(PORT_ID)),
-               .args = ARGS(ARGS_ENTRY(struct buffer, args.query.action),
+               .args = ARGS(ARGS_ENTRY(struct buffer, args.query.action.type),
                             ARGS_ENTRY(struct buffer, args.query.rule),
                             ARGS_ENTRY(struct buffer, port)),
                .call = parse_query,
@@ -1233,6 +1307,19 @@ static const struct token token_list[] = {
                .next = NEXT(item_port_id, NEXT_ENTRY(UNSIGNED), item_param),
                .args = ARGS(ARGS_ENTRY(struct rte_flow_item_port_id, id)),
        },
+       [ITEM_MARK] = {
+               .name = "mark",
+               .help = "match traffic against value set in previously matched rule",
+               .priv = PRIV_ITEM(MARK, sizeof(struct rte_flow_item_mark)),
+               .next = NEXT(item_mark),
+               .call = parse_vc,
+       },
+       [ITEM_MARK_ID] = {
+               .name = "id",
+               .help = "Integer value to match against",
+               .next = NEXT(item_mark, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY(struct rte_flow_item_mark, id)),
+       },
        [ITEM_RAW] = {
                .name = "raw",
                .help = "match an arbitrary byte string",
@@ -1884,6 +1971,20 @@ static const struct token token_list[] = {
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                .call = parse_vc,
        },
+       [ACTION_JUMP] = {
+               .name = "jump",
+               .help = "redirect traffic to a given group",
+               .priv = PRIV_ACTION(JUMP, sizeof(struct rte_flow_action_jump)),
+               .next = NEXT(action_jump),
+               .call = parse_vc,
+       },
+       [ACTION_JUMP_GROUP] = {
+               .name = "group",
+               .help = "group to redirect traffic to",
+               .next = NEXT(action_jump, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY(struct rte_flow_action_jump, group)),
+               .call = parse_vc_conf,
+       },
        [ACTION_MARK] = {
                .name = "mark",
                .help = "attach 32 bit value to packets",
@@ -1930,10 +2031,26 @@ static const struct token token_list[] = {
        [ACTION_COUNT] = {
                .name = "count",
                .help = "enable counters for this rule",
-               .priv = PRIV_ACTION(COUNT, 0),
-               .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+               .priv = PRIV_ACTION(COUNT,
+                                   sizeof(struct rte_flow_action_count)),
+               .next = NEXT(action_count),
                .call = parse_vc,
        },
+       [ACTION_COUNT_ID] = {
+               .name = "identifier",
+               .help = "counter identifier to use",
+               .next = NEXT(action_count, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY(struct rte_flow_action_count, id)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_COUNT_SHARED] = {
+               .name = "shared",
+               .help = "shared counter",
+               .next = NEXT(action_count, NEXT_ENTRY(BOOLEAN)),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_action_count,
+                                          shared, 1)),
+               .call = parse_vc_conf,
+       },
        [ACTION_RSS] = {
                .name = "rss",
                .help = "spread packets among several queues",
@@ -2174,6 +2291,102 @@ static const struct token token_list[] = {
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                .call = parse_vc,
        },
+       [ACTION_OF_POP_VLAN] = {
+               .name = "of_pop_vlan",
+               .help = "OpenFlow's OFPAT_POP_VLAN",
+               .priv = PRIV_ACTION(OF_POP_VLAN, 0),
+               .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+               .call = parse_vc,
+       },
+       [ACTION_OF_PUSH_VLAN] = {
+               .name = "of_push_vlan",
+               .help = "OpenFlow's OFPAT_PUSH_VLAN",
+               .priv = PRIV_ACTION
+                       (OF_PUSH_VLAN,
+                        sizeof(struct rte_flow_action_of_push_vlan)),
+               .next = NEXT(action_of_push_vlan),
+               .call = parse_vc,
+       },
+       [ACTION_OF_PUSH_VLAN_ETHERTYPE] = {
+               .name = "ethertype",
+               .help = "EtherType",
+               .next = NEXT(action_of_push_vlan, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_of_push_vlan,
+                             ethertype)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_OF_SET_VLAN_VID] = {
+               .name = "of_set_vlan_vid",
+               .help = "OpenFlow's OFPAT_SET_VLAN_VID",
+               .priv = PRIV_ACTION
+                       (OF_SET_VLAN_VID,
+                        sizeof(struct rte_flow_action_of_set_vlan_vid)),
+               .next = NEXT(action_of_set_vlan_vid),
+               .call = parse_vc,
+       },
+       [ACTION_OF_SET_VLAN_VID_VLAN_VID] = {
+               .name = "vlan_vid",
+               .help = "VLAN id",
+               .next = NEXT(action_of_set_vlan_vid, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_of_set_vlan_vid,
+                             vlan_vid)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_OF_SET_VLAN_PCP] = {
+               .name = "of_set_vlan_pcp",
+               .help = "OpenFlow's OFPAT_SET_VLAN_PCP",
+               .priv = PRIV_ACTION
+                       (OF_SET_VLAN_PCP,
+                        sizeof(struct rte_flow_action_of_set_vlan_pcp)),
+               .next = NEXT(action_of_set_vlan_pcp),
+               .call = parse_vc,
+       },
+       [ACTION_OF_SET_VLAN_PCP_VLAN_PCP] = {
+               .name = "vlan_pcp",
+               .help = "VLAN priority",
+               .next = NEXT(action_of_set_vlan_pcp, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_of_set_vlan_pcp,
+                             vlan_pcp)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_OF_POP_MPLS] = {
+               .name = "of_pop_mpls",
+               .help = "OpenFlow's OFPAT_POP_MPLS",
+               .priv = PRIV_ACTION(OF_POP_MPLS,
+                                   sizeof(struct rte_flow_action_of_pop_mpls)),
+               .next = NEXT(action_of_pop_mpls),
+               .call = parse_vc,
+       },
+       [ACTION_OF_POP_MPLS_ETHERTYPE] = {
+               .name = "ethertype",
+               .help = "EtherType",
+               .next = NEXT(action_of_pop_mpls, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_of_pop_mpls,
+                             ethertype)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_OF_PUSH_MPLS] = {
+               .name = "of_push_mpls",
+               .help = "OpenFlow's OFPAT_PUSH_MPLS",
+               .priv = PRIV_ACTION
+                       (OF_PUSH_MPLS,
+                        sizeof(struct rte_flow_action_of_push_mpls)),
+               .next = NEXT(action_of_push_mpls),
+               .call = parse_vc,
+       },
+       [ACTION_OF_PUSH_MPLS_ETHERTYPE] = {
+               .name = "ethertype",
+               .help = "EtherType",
+               .next = NEXT(action_of_push_mpls, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_of_push_mpls,
+                             ethertype)),
+               .call = parse_vc_conf,
+       },
 };
 
 /** Remove and return last entry from argument stack. */
@@ -2584,7 +2797,8 @@ parse_vc_action_rss(struct context *ctx, const struct token *token,
                        .key = action_rss_data->key,
                        .queue = action_rss_data->queue,
                },
-               .key = "testpmd's default RSS hash key",
+               .key = "testpmd's default RSS hash key, "
+                       "override it for better balancing",
                .queue = { 0 },
        };
        for (i = 0; i < action_rss_data->conf.queue_num; ++i)
@@ -2708,7 +2922,7 @@ parse_vc_action_rss_queue(struct context *ctx, const struct token *token,
        i = ctx->objdata >> 16;
        if (!strcmp_partial("end", str, len)) {
                ctx->objdata &= 0xffff;
-               return len;
+               goto end;
        }
        if (i >= ACTION_RSS_QUEUE_NUM)
                return -1;
@@ -2728,6 +2942,7 @@ parse_vc_action_rss_queue(struct context *ctx, const struct token *token,
        if (ctx->next_num == RTE_DIM(ctx->next))
                return -1;
        ctx->next[ctx->next_num++] = next;
+end:
        if (!ctx->object)
                return len;
        action_rss_data = ctx->object;
@@ -3654,7 +3869,7 @@ cmd_flow_parsed(const struct buffer *in)
                break;
        case QUERY:
                port_flow_query(in->port, in->args.query.rule,
-                               in->args.query.action);
+                               &in->args.query.action);
                break;
        case LIST:
                port_flow_list(in->port, in->args.list.group_n,