net/hns3: fix max packet size rollback in PF
[dpdk.git] / app / test-pmd / cmdline_flow.c
index d821877..bbaf18d 100644 (file)
@@ -495,7 +495,7 @@ enum index {
 };
 
 /** Maximum size for pattern in struct rte_flow_item_raw. */
-#define ITEM_RAW_PATTERN_SIZE 40
+#define ITEM_RAW_PATTERN_SIZE 512
 
 /** Maximum size for GENEVE option data pattern in bytes. */
 #define ITEM_GENEVE_OPT_DATA_SIZE 124
@@ -2162,7 +2162,7 @@ static const struct token token_list[] = {
        },
        [COMMON_POLICY_ID] = {
                .name = "{policy_id}",
-               .type = "POLCIY_ID",
+               .type = "POLICY_ID",
                .help = "policy id",
                .call = parse_int,
                .comp = comp_none,
@@ -2370,7 +2370,7 @@ static const struct token token_list[] = {
        },
        [TUNNEL_DESTROY] = {
                .name = "destroy",
-               .help = "destroy tunel",
+               .help = "destroy tunnel",
                .next = NEXT(NEXT_ENTRY(TUNNEL_DESTROY_ID),
                             NEXT_ENTRY(COMMON_PORT_ID)),
                .args = ARGS(ARGS_ENTRY(struct buffer, port)),
@@ -2378,7 +2378,7 @@ static const struct token token_list[] = {
        },
        [TUNNEL_DESTROY_ID] = {
                .name = "id",
-               .help = "tunnel identifier to testroy",
+               .help = "tunnel identifier to destroy",
                .next = NEXT(NEXT_ENTRY(COMMON_UNSIGNED)),
                .args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)),
                .call = parse_tunnel,
@@ -5880,7 +5880,7 @@ parse_vc_item_l2tpv2_type(struct context *ctx, const struct token *token,
        struct rte_flow_item_l2tpv2 *l2tpv2_mask;
        struct rte_flow_item *item;
        uint32_t data_size;
-       uint8_t msg_type = 0;
+       uint16_t msg_type = 0;
        struct buffer *out = buf;
        const struct arg *arg;
 
@@ -7702,9 +7702,8 @@ error:
 static int
 parse_hex_string(const char *src, uint8_t *dst, uint32_t *size)
 {
-       char *c = NULL;
-       uint32_t i, len;
-       char tmp[3];
+       const uint8_t *head = dst;
+       uint32_t left;
 
        /* Check input parameters */
        if ((src == NULL) ||
@@ -7713,20 +7712,26 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t *size)
                (*size == 0))
                return -1;
 
+       left = *size;
+
        /* Convert chars to bytes */
-       for (i = 0, len = 0; i < *size; i += 2) {
-               snprintf(tmp, 3, "%s", src + i);
-               dst[len++] = strtoul(tmp, &c, 16);
-               if (*c != 0) {
-                       len--;
-                       dst[len] = 0;
-                       *size = len;
+       while (left) {
+               char tmp[3], *end = tmp;
+               uint32_t read_lim = left & 1 ? 1 : 2;
+
+               snprintf(tmp, read_lim + 1, "%s", src);
+               *dst = strtoul(tmp, &end, 16);
+               if (*end) {
+                       *dst = 0;
+                       *size = (uint32_t)(dst - head);
                        return -1;
                }
+               left -= read_lim;
+               src += read_lim;
+               dst++;
        }
-       dst[len] = 0;
-       *size = len;
-
+       *dst = 0;
+       *size = (uint32_t)(dst - head);
        return 0;
 }
 
@@ -9213,7 +9218,7 @@ cmd_set_raw_parsed(const struct buffer *in)
                                        uint8_t qfi:6;
                                        uint8_t next;
                                } psc;
-                               psc.len = sizeof(psc);
+                               psc.len = sizeof(psc) / 4;
                                psc.pdu_type = opt->hdr.type;
                                psc.qfi = opt->hdr.qfi;
                                psc.next = 0;