test/crypto: support wireless algos for dpaa2-sec
[dpdk.git] / app / test-pmd / cmdline_flow.c
index a15a756..4958713 100644 (file)
@@ -18,6 +18,7 @@
 #include <rte_ethdev.h>
 #include <rte_byteorder.h>
 #include <cmdline_parse.h>
+#include <cmdline_parse_etheraddr.h>
 #include <rte_flow.h>
 
 #include "testpmd.h"
@@ -152,6 +153,8 @@ enum index {
        ITEM_NVGRE_TNI,
        ITEM_MPLS,
        ITEM_MPLS_LABEL,
+       ITEM_MPLS_TC,
+       ITEM_MPLS_S,
        ITEM_GRE,
        ITEM_GRE_PROTO,
        ITEM_GRE_C_RSVD0_VER,
@@ -800,6 +803,8 @@ static const enum index item_nvgre[] = {
 
 static const enum index item_mpls[] = {
        ITEM_MPLS_LABEL,
+       ITEM_MPLS_TC,
+       ITEM_MPLS_S,
        ITEM_NEXT,
        ZERO,
 };
@@ -1997,6 +2002,22 @@ static const struct token token_list[] = {
                                                  label_tc_s,
                                                  "\xff\xff\xf0")),
        },
+       [ITEM_MPLS_TC] = {
+               .name = "tc",
+               .help = "MPLS Traffic Class",
+               .next = NEXT(item_mpls, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_mpls,
+                                                 label_tc_s,
+                                                 "\x00\x00\x0e")),
+       },
+       [ITEM_MPLS_S] = {
+               .name = "s",
+               .help = "MPLS Bottom-of-Stack",
+               .next = NEXT(item_mpls, NEXT_ENTRY(UNSIGNED), item_param),
+               .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_mpls,
+                                                 label_tc_s,
+                                                 "\x00\x00\x01")),
+       },
        [ITEM_GRE] = {
                .name = "gre",
                .help = "match GRE header",
@@ -4958,8 +4979,8 @@ parse_mac_addr(struct context *ctx, const struct token *token,
        /* Only network endian is supported. */
        if (!arg->hton)
                goto error;
-       ret = rte_ether_unformat_addr(str, &tmp);
-       if (ret < 0)
+       ret = cmdline_parse_etheraddr(NULL, str, &tmp, size);
+       if (ret < 0 || (unsigned int)ret != len)
                goto error;
        if (!ctx->object)
                return len;
@@ -5663,6 +5684,7 @@ static const void *
 flow_item_default_mask(const struct rte_flow_item *item)
 {
        const void *mask = NULL;
+       static rte_be32_t gre_key_default_mask = RTE_BE32(UINT32_MAX);
 
        switch (item->type) {
        case RTE_FLOW_ITEM_TYPE_ANY:
@@ -5719,6 +5741,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
        case RTE_FLOW_ITEM_TYPE_GRE:
                mask = &rte_flow_item_gre_mask;
                break;
+       case RTE_FLOW_ITEM_TYPE_GRE_KEY:
+               mask = &gre_key_default_mask;
+               break;
        case RTE_FLOW_ITEM_TYPE_META:
                mask = &rte_flow_item_meta_mask;
                break;
@@ -5804,6 +5829,9 @@ cmd_set_raw_parsed(const struct buffer *in)
                        size = sizeof(struct rte_flow_item_gre);
                        proto = 0x2F;
                        break;
+               case RTE_FLOW_ITEM_TYPE_GRE_KEY:
+                       size = sizeof(rte_be32_t);
+                       break;
                case RTE_FLOW_ITEM_TYPE_MPLS:
                        size = sizeof(struct rte_flow_item_mpls);
                        break;