ethdev: support flow aging
[dpdk.git] / app / test-pmd / cmdline_flow.c
index 680cb1c..45bcff3 100644 (file)
@@ -170,6 +170,7 @@ enum index {
        ITEM_FUZZY,
        ITEM_FUZZY_THRESH,
        ITEM_GTP,
+       ITEM_GTP_FLAGS,
        ITEM_GTP_MSG_TYPE,
        ITEM_GTP_TEID,
        ITEM_GTPC,
@@ -222,6 +223,9 @@ enum index {
        ITEM_ESP_SPI,
        ITEM_AH,
        ITEM_AH_SPI,
+       ITEM_PFCP,
+       ITEM_PFCP_S_FIELD,
+       ITEM_PFCP_SEID,
 
        /* Validate/create actions. */
        ACTIONS,
@@ -339,6 +343,8 @@ enum index {
        ACTION_SET_IPV4_DSCP_VALUE,
        ACTION_SET_IPV6_DSCP,
        ACTION_SET_IPV6_DSCP_VALUE,
+       ACTION_AGE,
+       ACTION_AGE_TIMEOUT,
 };
 
 /** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -771,6 +777,7 @@ static const enum index next_item[] = {
        ITEM_L2TPV3OIP,
        ITEM_ESP,
        ITEM_AH,
+       ITEM_PFCP,
        END_SET,
        ZERO,
 };
@@ -934,6 +941,7 @@ static const enum index item_gre_key[] = {
 };
 
 static const enum index item_gtp[] = {
+       ITEM_GTP_FLAGS,
        ITEM_GTP_MSG_TYPE,
        ITEM_GTP_TEID,
        ITEM_NEXT,
@@ -1031,7 +1039,6 @@ static const enum index item_pppoes[] = {
 };
 
 static const enum index item_pppoe_proto_id[] = {
-       ITEM_PPPOE_PROTO_ID,
        ITEM_NEXT,
        ZERO,
 };
@@ -1055,6 +1062,13 @@ static const enum index item_ah[] = {
        ZERO,
 };
 
+static const enum index item_pfcp[] = {
+       ITEM_PFCP_S_FIELD,
+       ITEM_PFCP_SEID,
+       ITEM_NEXT,
+       ZERO,
+};
+
 static const enum index next_set_raw[] = {
        SET_RAW_INDEX,
        ITEM_ETH,
@@ -1133,6 +1147,7 @@ static const enum index next_action[] = {
        ACTION_SET_META,
        ACTION_SET_IPV4_DSCP,
        ACTION_SET_IPV6_DSCP,
+       ACTION_AGE,
        ZERO,
 };
 
@@ -1358,6 +1373,13 @@ static const enum index action_set_ipv6_dscp[] = {
        ZERO,
 };
 
+static const enum index action_age[] = {
+       ACTION_AGE,
+       ACTION_AGE_TIMEOUT,
+       ACTION_NEXT,
+       ZERO,
+};
+
 static int parse_set_raw_encap_decap(struct context *, const struct token *,
                                     const char *, unsigned int,
                                     void *, unsigned int);
@@ -2336,12 +2358,18 @@ static const struct token token_list[] = {
                .next = NEXT(item_gtp),
                .call = parse_vc,
        },
+       [ITEM_GTP_FLAGS] = {
+               .name = "v_pt_rsv_flags",
+               .help = "GTP flags",
+               .next = NEXT(item_gtp, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY(struct rte_flow_item_gtp,
+                                       v_pt_rsv_flags)),
+       },
        [ITEM_GTP_MSG_TYPE] = {
                .name = "msg_type",
                .help = "GTP message type",
                .next = NEXT(item_gtp, NEXT_ENTRY(UNSIGNED), item_param),
-               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp,
-                                            msg_type)),
+               .args = ARGS(ARGS_ENTRY(struct rte_flow_item_gtp, msg_type)),
        },
        [ITEM_GTP_TEID] = {
                .name = "teid",
@@ -2630,11 +2658,14 @@ static const struct token token_list[] = {
                                        session_id)),
        },
        [ITEM_PPPOE_PROTO_ID] = {
-               .name = "proto_id",
+               .name = "pppoe_proto_id",
                .help = "match PPPoE session protocol identifier",
                .priv = PRIV_ITEM(PPPOE_PROTO_ID,
                                sizeof(struct rte_flow_item_pppoe_proto_id)),
-               .next = NEXT(item_pppoe_proto_id),
+               .next = NEXT(item_pppoe_proto_id, NEXT_ENTRY(UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_item_pppoe_proto_id, proto_id)),
                .call = parse_vc,
        },
        [ITEM_HIGIG2] = {
@@ -2721,6 +2752,26 @@ static const struct token token_list[] = {
                .next = NEXT(item_ah, NEXT_ENTRY(UNSIGNED), item_param),
                .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ah, spi)),
        },
+       [ITEM_PFCP] = {
+               .name = "pfcp",
+               .help = "match pfcp header",
+               .priv = PRIV_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
+               .next = NEXT(item_pfcp),
+               .call = parse_vc,
+       },
+       [ITEM_PFCP_S_FIELD] = {
+               .name = "s_field",
+               .help = "S field",
+               .next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
+                               s_field)),
+       },
+       [ITEM_PFCP_SEID] = {
+               .name = "seid",
+               .help = "session endpoint identifier",
+               .next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp, seid)),
+       },
        /* Validate/create actions. */
        [ACTIONS] = {
                .name = "actions",
@@ -3653,6 +3704,22 @@ static const struct token token_list[] = {
                             (struct rte_flow_action_set_dscp, dscp)),
                .call = parse_vc_conf,
        },
+       [ACTION_AGE] = {
+               .name = "age",
+               .help = "set a specific metadata header",
+               .next = NEXT(action_age),
+               .priv = PRIV_ACTION(AGE,
+                       sizeof(struct rte_flow_action_age)),
+               .call = parse_vc,
+       },
+       [ACTION_AGE_TIMEOUT] = {
+               .name = "timeout",
+               .help = "flow age timeout value",
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_action_age,
+                                          timeout, 24)),
+               .next = NEXT(action_age, NEXT_ENTRY(UNSIGNED)),
+               .call = parse_vc_conf,
+       },
 };
 
 /** Remove and return last entry from argument stack. */
@@ -6469,6 +6536,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
        case RTE_FLOW_ITEM_TYPE_AH:
                mask = &rte_flow_item_ah_mask;
                break;
+       case RTE_FLOW_ITEM_TYPE_PFCP:
+               mask = &rte_flow_item_pfcp_mask;
+               break;
        default:
                break;
        }
@@ -6570,6 +6640,12 @@ cmd_set_raw_parsed(const struct buffer *in)
                        size = sizeof(struct rte_flow_item_ah);
                        proto = 0x33;
                        break;
+               case RTE_FLOW_ITEM_TYPE_GTP:
+                       size = sizeof(struct rte_flow_item_gtp);
+                       break;
+               case RTE_FLOW_ITEM_TYPE_PFCP:
+                       size = sizeof(struct rte_flow_item_pfcp);
+                       break;
                default:
                        printf("Error - Not supported item\n");
                        *total_size = 0;