ethdev: add flow API actions to modify TCP/UDP port numbers
[dpdk.git] / app / test-pmd / cmdline_flow.c
index 1432498..a9888ca 100644 (file)
@@ -251,6 +251,10 @@ enum index {
        ACTION_SET_IPV6_SRC_IPV6_SRC,
        ACTION_SET_IPV6_DST,
        ACTION_SET_IPV6_DST_IPV6_DST,
+       ACTION_SET_TP_SRC,
+       ACTION_SET_TP_SRC_TP_SRC,
+       ACTION_SET_TP_DST,
+       ACTION_SET_TP_DST_TP_DST,
 };
 
 /** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -828,6 +832,8 @@ static const enum index next_action[] = {
        ACTION_SET_IPV4_DST,
        ACTION_SET_IPV6_SRC,
        ACTION_SET_IPV6_DST,
+       ACTION_SET_TP_SRC,
+       ACTION_SET_TP_DST,
        ZERO,
 };
 
@@ -954,6 +960,18 @@ static const enum index action_set_ipv6_dst[] = {
        ZERO,
 };
 
+static const enum index action_set_tp_src[] = {
+       ACTION_SET_TP_SRC_TP_SRC,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_set_tp_dst[] = {
+       ACTION_SET_TP_DST_TP_DST,
+       ACTION_NEXT,
+       ZERO,
+};
+
 static const enum index action_jump[] = {
        ACTION_JUMP_GROUP,
        ACTION_NEXT,
@@ -2574,6 +2592,40 @@ static const struct token token_list[] = {
                        (struct rte_flow_action_set_ipv6, ipv6_addr)),
                .call = parse_vc_conf,
        },
+       [ACTION_SET_TP_SRC] = {
+               .name = "set_tp_src",
+               .help = "set a new source port number in the outermost"
+                       " TCP/UDP header",
+               .priv = PRIV_ACTION(SET_TP_SRC,
+                       sizeof(struct rte_flow_action_set_tp)),
+               .next = NEXT(action_set_tp_src),
+               .call = parse_vc,
+       },
+       [ACTION_SET_TP_SRC_TP_SRC] = {
+               .name = "port",
+               .help = "new source port number to set",
+               .next = NEXT(action_set_tp_src, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_set_tp, port)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_SET_TP_DST] = {
+               .name = "set_tp_dst",
+               .help = "set a new destination port number in the outermost"
+                       " TCP/UDP header",
+               .priv = PRIV_ACTION(SET_TP_DST,
+                       sizeof(struct rte_flow_action_set_tp)),
+               .next = NEXT(action_set_tp_dst),
+               .call = parse_vc,
+       },
+       [ACTION_SET_TP_DST_TP_DST] = {
+               .name = "port",
+               .help = "new destination port number to set",
+               .next = NEXT(action_set_tp_dst, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_set_tp, port)),
+               .call = parse_vc_conf,
+       },
 };
 
 /** Remove and return last entry from argument stack. */