mk: build with _GNU_SOURCE defined by default
[dpdk.git] / app / test-pmd / cmdline_flow.c
index f926060..a527b6b 100644 (file)
@@ -243,6 +243,26 @@ enum index {
        ACTION_VXLAN_DECAP,
        ACTION_NVGRE_ENCAP,
        ACTION_NVGRE_DECAP,
+       ACTION_SET_IPV4_SRC,
+       ACTION_SET_IPV4_SRC_IPV4_SRC,
+       ACTION_SET_IPV4_DST,
+       ACTION_SET_IPV4_DST_IPV4_DST,
+       ACTION_SET_IPV6_SRC,
+       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,
+       ACTION_MAC_SWAP,
+       ACTION_DEC_TTL,
+       ACTION_SET_TTL,
+       ACTION_SET_TTL_TTL,
+       ACTION_SET_MAC_SRC,
+       ACTION_SET_MAC_SRC_MAC_SRC,
+       ACTION_SET_MAC_DST,
+       ACTION_SET_MAC_DST_MAC_DST,
 };
 
 /** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -816,6 +836,17 @@ static const enum index next_action[] = {
        ACTION_VXLAN_DECAP,
        ACTION_NVGRE_ENCAP,
        ACTION_NVGRE_DECAP,
+       ACTION_SET_IPV4_SRC,
+       ACTION_SET_IPV4_DST,
+       ACTION_SET_IPV6_SRC,
+       ACTION_SET_IPV6_DST,
+       ACTION_SET_TP_SRC,
+       ACTION_SET_TP_DST,
+       ACTION_MAC_SWAP,
+       ACTION_DEC_TTL,
+       ACTION_SET_TTL,
+       ACTION_SET_MAC_SRC,
+       ACTION_SET_MAC_DST,
        ZERO,
 };
 
@@ -918,12 +949,66 @@ static const enum index action_of_push_mpls[] = {
        ZERO,
 };
 
+static const enum index action_set_ipv4_src[] = {
+       ACTION_SET_IPV4_SRC_IPV4_SRC,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_set_mac_src[] = {
+       ACTION_SET_MAC_SRC_MAC_SRC,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_set_ipv4_dst[] = {
+       ACTION_SET_IPV4_DST_IPV4_DST,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_set_ipv6_src[] = {
+       ACTION_SET_IPV6_SRC_IPV6_SRC,
+       ACTION_NEXT,
+       ZERO,
+};
+
+static const enum index action_set_ipv6_dst[] = {
+       ACTION_SET_IPV6_DST_IPV6_DST,
+       ACTION_NEXT,
+       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_set_ttl[] = {
+       ACTION_SET_TTL_TTL,
+       ACTION_NEXT,
+       ZERO,
+};
+
 static const enum index action_jump[] = {
        ACTION_JUMP_GROUP,
        ACTION_NEXT,
        ZERO,
 };
 
+static const enum index action_set_mac_dst[] = {
+       ACTION_SET_MAC_DST_MAC_DST,
+       ACTION_NEXT,
+       ZERO,
+};
+
 static int parse_init(struct context *, const struct token *,
                      const char *, unsigned int,
                      void *, unsigned int);
@@ -2470,6 +2555,171 @@ static const struct token token_list[] = {
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                .call = parse_vc,
        },
+       [ACTION_SET_IPV4_SRC] = {
+               .name = "set_ipv4_src",
+               .help = "Set a new IPv4 source address in the outermost"
+                       " IPv4 header",
+               .priv = PRIV_ACTION(SET_IPV4_SRC,
+                       sizeof(struct rte_flow_action_set_ipv4)),
+               .next = NEXT(action_set_ipv4_src),
+               .call = parse_vc,
+       },
+       [ACTION_SET_IPV4_SRC_IPV4_SRC] = {
+               .name = "ipv4_addr",
+               .help = "new IPv4 source address to set",
+               .next = NEXT(action_set_ipv4_src, NEXT_ENTRY(IPV4_ADDR)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                       (struct rte_flow_action_set_ipv4, ipv4_addr)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_SET_IPV4_DST] = {
+               .name = "set_ipv4_dst",
+               .help = "Set a new IPv4 destination address in the outermost"
+                       " IPv4 header",
+               .priv = PRIV_ACTION(SET_IPV4_DST,
+                       sizeof(struct rte_flow_action_set_ipv4)),
+               .next = NEXT(action_set_ipv4_dst),
+               .call = parse_vc,
+       },
+       [ACTION_SET_IPV4_DST_IPV4_DST] = {
+               .name = "ipv4_addr",
+               .help = "new IPv4 destination address to set",
+               .next = NEXT(action_set_ipv4_dst, NEXT_ENTRY(IPV4_ADDR)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                       (struct rte_flow_action_set_ipv4, ipv4_addr)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_SET_IPV6_SRC] = {
+               .name = "set_ipv6_src",
+               .help = "Set a new IPv6 source address in the outermost"
+                       " IPv6 header",
+               .priv = PRIV_ACTION(SET_IPV6_SRC,
+                       sizeof(struct rte_flow_action_set_ipv6)),
+               .next = NEXT(action_set_ipv6_src),
+               .call = parse_vc,
+       },
+       [ACTION_SET_IPV6_SRC_IPV6_SRC] = {
+               .name = "ipv6_addr",
+               .help = "new IPv6 source address to set",
+               .next = NEXT(action_set_ipv6_src, NEXT_ENTRY(IPV6_ADDR)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                       (struct rte_flow_action_set_ipv6, ipv6_addr)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_SET_IPV6_DST] = {
+               .name = "set_ipv6_dst",
+               .help = "Set a new IPv6 destination address in the outermost"
+                       " IPv6 header",
+               .priv = PRIV_ACTION(SET_IPV6_DST,
+                       sizeof(struct rte_flow_action_set_ipv6)),
+               .next = NEXT(action_set_ipv6_dst),
+               .call = parse_vc,
+       },
+       [ACTION_SET_IPV6_DST_IPV6_DST] = {
+               .name = "ipv6_addr",
+               .help = "new IPv6 destination address to set",
+               .next = NEXT(action_set_ipv6_dst, NEXT_ENTRY(IPV6_ADDR)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                       (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,
+       },
+       [ACTION_MAC_SWAP] = {
+               .name = "mac_swap",
+               .help = "Swap the source and destination MAC addresses"
+                       " in the outermost Ethernet header",
+               .priv = PRIV_ACTION(MAC_SWAP, 0),
+               .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+               .call = parse_vc,
+       },
+       [ACTION_DEC_TTL] = {
+               .name = "dec_ttl",
+               .help = "decrease network TTL if available",
+               .priv = PRIV_ACTION(DEC_TTL, 0),
+               .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+               .call = parse_vc,
+       },
+       [ACTION_SET_TTL] = {
+               .name = "set_ttl",
+               .help = "set ttl value",
+               .priv = PRIV_ACTION(SET_TTL,
+                       sizeof(struct rte_flow_action_set_ttl)),
+               .next = NEXT(action_set_ttl),
+               .call = parse_vc,
+       },
+       [ACTION_SET_TTL_TTL] = {
+               .name = "ttl_value",
+               .help = "new ttl value to set",
+               .next = NEXT(action_set_ttl, NEXT_ENTRY(UNSIGNED)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_set_ttl, ttl_value)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_SET_MAC_SRC] = {
+               .name = "set_mac_src",
+               .help = "set source mac address",
+               .priv = PRIV_ACTION(SET_MAC_SRC,
+                       sizeof(struct rte_flow_action_set_mac)),
+               .next = NEXT(action_set_mac_src),
+               .call = parse_vc,
+       },
+       [ACTION_SET_MAC_SRC_MAC_SRC] = {
+               .name = "mac_addr",
+               .help = "new source mac address",
+               .next = NEXT(action_set_mac_src, NEXT_ENTRY(MAC_ADDR)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_set_mac, mac_addr)),
+               .call = parse_vc_conf,
+       },
+       [ACTION_SET_MAC_DST] = {
+               .name = "set_mac_dst",
+               .help = "set destination mac address",
+               .priv = PRIV_ACTION(SET_MAC_DST,
+                       sizeof(struct rte_flow_action_set_mac)),
+               .next = NEXT(action_set_mac_dst),
+               .call = parse_vc,
+       },
+       [ACTION_SET_MAC_DST_MAC_DST] = {
+               .name = "mac_addr",
+               .help = "new destination mac address to set",
+               .next = NEXT(action_set_mac_dst, NEXT_ENTRY(MAC_ADDR)),
+               .args = ARGS(ARGS_ENTRY_HTON
+                            (struct rte_flow_action_set_mac, mac_addr)),
+               .call = parse_vc_conf,
+       },
 };
 
 /** Remove and return last entry from argument stack. */