crypto/qat: add PCI device struct
[dpdk.git] / app / test-pmd / cmdline_flow.c
index 4239602..9918d7f 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,
@@ -416,7 +420,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;
@@ -492,6 +496,7 @@ static const enum index next_item[] = {
        ITEM_VF,
        ITEM_PHY_PORT,
        ITEM_PORT_ID,
+       ITEM_MARK,
        ITEM_RAW,
        ITEM_ETH,
        ITEM_VLAN,
@@ -553,6 +558,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,
@@ -738,6 +749,7 @@ static const enum index next_action[] = {
        ACTION_END,
        ACTION_VOID,
        ACTION_PASSTHRU,
+       ACTION_JUMP,
        ACTION_MARK,
        ACTION_FLAG,
        ACTION_QUEUE,
@@ -856,6 +868,12 @@ static const enum index action_of_push_mpls[] = {
        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);
@@ -1083,7 +1101,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,
@@ -1280,6 +1298,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",
@@ -1931,6 +1962,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",
@@ -2727,7 +2772,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)
@@ -2851,7 +2897,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;
@@ -2871,6 +2917,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;
@@ -3797,7 +3844,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,